file_path stringlengths 3 280 | file_language stringclasses 66
values | content stringlengths 1 1.04M | repo_name stringlengths 5 92 | repo_stars int64 0 154k | repo_description stringlengths 0 402 | repo_primary_language stringclasses 108
values | developer_username stringlengths 1 25 | developer_name stringlengths 0 30 | developer_company stringlengths 0 82 |
|---|---|---|---|---|---|---|---|---|---|
crates/swc_ecma_minifier/tests/fixture/projects/underscore/1/output.js | JavaScript | _.contains = _.include = function(obj, target) {
return null != obj && (nativeIndexOf && obj.indexOf === nativeIndexOf ? -1 != obj.indexOf(target) : any(obj, function(value) {
return value === target;
}));
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/10/input.js | JavaScript | var eq = function (a, b, aStack, bStack) {
// Identical objects are equal. `0 === -0`, but they aren't identical.
// See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
if (a === b) return a !== 0 || 1 / a == 1 / b;
// A strict comparison is necessary because `null == undefined`.
if (a == null || b == null) return a === b;
// Unwrap any wrapped objects.
if (a instanceof _) a = a._wrapped;
if (b instanceof _) b = b._wrapped;
// Compare `[[Class]]` names.
var className = toString.call(a);
if (className != toString.call(b)) return false;
switch (className) {
// Strings, numbers, dates, and booleans are compared by value.
case "[object String]":
// Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
// equivalent to `new String("5")`.
return a == String(b);
case "[object Number]":
// `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for
// other numeric values.
return a != +a ? b != +b : a == 0 ? 1 / a == 1 / b : a == +b;
case "[object Date]":
case "[object Boolean]":
// Coerce dates and booleans to numeric primitive values. Dates are compared by their
// millisecond representations. Note that invalid dates with millisecond representations
// of `NaN` are not equivalent.
return +a == +b;
// RegExps are compared by their source patterns and flags.
case "[object RegExp]":
return (
a.source == b.source &&
a.global == b.global &&
a.multiline == b.multiline &&
a.ignoreCase == b.ignoreCase
);
}
if (typeof a != "object" || typeof b != "object") return false;
// Assume equality for cyclic structures. The algorithm for detecting cyclic
// structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
var length = aStack.length;
while (length--) {
// Linear search. Performance is inversely proportional to the number of
// unique nested structures.
if (aStack[length] == a) return bStack[length] == b;
}
// Objects with different constructors are not equivalent, but `Object`s
// from different frames are.
var aCtor = a.constructor,
bCtor = b.constructor;
if (
aCtor !== bCtor &&
!(
_.isFunction(aCtor) &&
aCtor instanceof aCtor &&
_.isFunction(bCtor) &&
bCtor instanceof bCtor
)
) {
return false;
}
// Add the first object to the stack of traversed objects.
aStack.push(a);
bStack.push(b);
var size = 0,
result = true;
// Recursively compare objects and arrays.
if (className == "[object Array]") {
// Compare array lengths to determine if a deep comparison is necessary.
size = a.length;
result = size == b.length;
if (result) {
// Deep compare the contents, ignoring non-numeric properties.
while (size--) {
if (!(result = eq(a[size], b[size], aStack, bStack))) break;
}
}
} else {
// Deep compare objects.
for (var key in a) {
if (_.has(a, key)) {
// Count the expected number of properties.
size++;
// Deep compare each member.
if (
!(result =
_.has(b, key) && eq(a[key], b[key], aStack, bStack))
)
break;
}
}
// Ensure that both objects contain the same number of properties.
if (result) {
for (key in b) {
if (_.has(b, key) && !size--) break;
}
result = !size;
}
}
// Remove the first object from the stack of traversed objects.
aStack.pop();
bStack.pop();
return result;
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/10/output.js | JavaScript | var eq = function(a, b, aStack, bStack) {
// Identical objects are equal. `0 === -0`, but they aren't identical.
// See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
if (a === b) return 0 !== a || 1 / a == 1 / b;
// A strict comparison is necessary because `null == undefined`.
if (null == a || null == b) return a === b;
a instanceof _ && (a = a._wrapped), b instanceof _ && (b = b._wrapped);
// Compare `[[Class]]` names.
var className = toString.call(a);
if (className != toString.call(b)) return !1;
switch(className){
// Strings, numbers, dates, and booleans are compared by value.
case "[object String]":
// Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
// equivalent to `new String("5")`.
return a == String(b);
case "[object Number]":
// `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for
// other numeric values.
return a != +a ? b != +b : 0 == a ? 1 / a == 1 / b : a == +b;
case "[object Date]":
case "[object Boolean]":
// Coerce dates and booleans to numeric primitive values. Dates are compared by their
// millisecond representations. Note that invalid dates with millisecond representations
// of `NaN` are not equivalent.
return +a == +b;
// RegExps are compared by their source patterns and flags.
case "[object RegExp]":
return a.source == b.source && a.global == b.global && a.multiline == b.multiline && a.ignoreCase == b.ignoreCase;
}
if ("object" != typeof a || "object" != typeof b) return !1;
for(// Assume equality for cyclic structures. The algorithm for detecting cyclic
// structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
var length = aStack.length; length--;)// Linear search. Performance is inversely proportional to the number of
// unique nested structures.
if (aStack[length] == a) return bStack[length] == b;
// Objects with different constructors are not equivalent, but `Object`s
// from different frames are.
var aCtor = a.constructor, bCtor = b.constructor;
if (aCtor !== bCtor && !(_.isFunction(aCtor) && aCtor instanceof aCtor && _.isFunction(bCtor) && bCtor instanceof bCtor)) return !1;
// Add the first object to the stack of traversed objects.
aStack.push(a), bStack.push(b);
var size = 0, result = !0;
// Recursively compare objects and arrays.
if ("[object Array]" == className) {
if (result = // Compare array lengths to determine if a deep comparison is necessary.
(size = a.length) == b.length) // Deep compare the contents, ignoring non-numeric properties.
for(; size-- && (result = eq(a[size], b[size], aStack, bStack)););
} else {
// Deep compare objects.
for(var key in a)if (_.has(a, key) && (// Count the expected number of properties.
size++, !(result = _.has(b, key) && eq(a[key], b[key], aStack, bStack)))) break;
// Ensure that both objects contain the same number of properties.
if (result) {
for(key in b)if (_.has(b, key) && !size--) break;
result = !size;
}
}
return(// Remove the first object from the stack of traversed objects.
aStack.pop(), bStack.pop(), result);
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/11/input.js | JavaScript | if (typeof /./ !== "function") {
_.isFunction = function (obj) {
return typeof obj === "function";
};
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/11/output.js | JavaScript | "function" != typeof /./ && (_.isFunction = function(obj) {
return "function" == typeof obj;
});
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/12/input.js | JavaScript | _.random = function (min, max) {
if (max == null) {
max = min;
min = 0;
}
return min + Math.floor(Math.random() * (max - min + 1));
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/12/output.js | JavaScript | _.random = function(min, max) {
return null == max && (max = min, min = 0), min + Math.floor(Math.random() * (max - min + 1));
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/13/input.js | JavaScript | _.result = function (object, property) {
if (object == null) return void 0;
var value = object[property];
return _.isFunction(value) ? value.call(object) : value;
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/13/output.js | JavaScript | _.result = function(object, property) {
if (null != object) {
var value = object[property];
return _.isFunction(value) ? value.call(object) : value;
}
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/14/input.js | JavaScript | _.mixin = function (obj) {
each(_.functions(obj), function (name) {
var func = (_[name] = obj[name]);
_.prototype[name] = function () {
var args = [this._wrapped];
push.apply(args, arguments);
return result.call(this, func.apply(_, args));
};
});
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/14/output.js | JavaScript | _.mixin = function(obj) {
each(_.functions(obj), function(name) {
var func = _[name] = obj[name];
_.prototype[name] = function() {
var args = [
this._wrapped
];
return push.apply(args, arguments), result.call(this, func.apply(_, args));
};
});
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/15/input.js | JavaScript | function foo(a, b) {
var aCtor = a.constructor,
bCtor = b.constructor;
if (
aCtor !== bCtor &&
!(
_.isFunction(aCtor) &&
aCtor instanceof aCtor &&
_.isFunction(bCtor) &&
bCtor instanceof bCtor
)
) {
return false;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/15/output.js | JavaScript | function foo(a, b) {
var aCtor = a.constructor, bCtor = b.constructor;
if (aCtor !== bCtor && !(_.isFunction(aCtor) && aCtor instanceof aCtor && _.isFunction(bCtor) && bCtor instanceof bCtor)) return !1;
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/16/input.js | JavaScript | function foo() {
// Add the first object to the stack of traversed objects.
aStack.push(a);
bStack.push(b);
var size = 0,
result = true;
// Recursively compare objects and arrays.
if (className == "[object Array]") {
// Compare array lengths to determine if a deep comparison is necessary.
size = a.length;
result = size == b.length;
if (result) {
// Deep compare the contents, ignoring non-numeric properties.
while (size--) {
if (!(result = eq(a[size], b[size], aStack, bStack))) break;
}
}
} else {
// Deep compare objects.
for (var key in a) {
if (_.has(a, key)) {
// Count the expected number of properties.
size++;
// Deep compare each member.
if (
!(result =
_.has(b, key) && eq(a[key], b[key], aStack, bStack))
)
break;
}
}
// Ensure that both objects contain the same number of properties.
if (result) {
for (key in b) {
if (_.has(b, key) && !size--) break;
}
result = !size;
}
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/16/output.js | JavaScript | function foo() {
// Add the first object to the stack of traversed objects.
aStack.push(a), bStack.push(b);
var size = 0, result = !0;
// Recursively compare objects and arrays.
if ("[object Array]" == className) {
if (result = // Compare array lengths to determine if a deep comparison is necessary.
(size = a.length) == b.length) // Deep compare the contents, ignoring non-numeric properties.
for(; size-- && (result = eq(a[size], b[size], aStack, bStack)););
} else {
// Deep compare objects.
for(var key in a)if (_.has(a, key) && (// Count the expected number of properties.
size++, !(result = _.has(b, key) && eq(a[key], b[key], aStack, bStack)))) break;
// Ensure that both objects contain the same number of properties.
if (result) {
for(key in b)if (_.has(b, key) && !size--) break;
result = !size;
}
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/17/input.js | JavaScript | export function foo() {
var size = 0,
result = true;
// Recursively compare objects and arrays.
if (className == "[object Array]") {
// Compare array lengths to determine if a deep comparison is necessary.
size = a.length;
result = size == b.length;
if (result) {
// Deep compare the contents, ignoring non-numeric properties.
while (size--) {
if (!(result = eq(a[size], b[size], aStack, bStack))) break;
}
}
} else {
// Deep compare objects.
for (var key in a) {
if (_.has(a, key)) {
// Count the expected number of properties.
size++;
// Deep compare each member.
if (
!(result =
_.has(b, key) && eq(a[key], b[key], aStack, bStack))
)
break;
}
}
// Ensure that both objects contain the same number of properties.
if (result) {
for (key in b) {
if (_.has(b, key) && !size--) break;
}
result = !size;
}
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/17/output.js | JavaScript | export function foo() {
var size = 0, result = !0;
// Recursively compare objects and arrays.
if ("[object Array]" == className) {
if (result = // Compare array lengths to determine if a deep comparison is necessary.
(size = a.length) == b.length) // Deep compare the contents, ignoring non-numeric properties.
for(; size-- && (result = eq(a[size], b[size], aStack, bStack)););
} else {
// Deep compare objects.
for(var key in a)if (_.has(a, key) && (// Count the expected number of properties.
size++, !(result = _.has(b, key) && eq(a[key], b[key], aStack, bStack)))) break;
// Ensure that both objects contain the same number of properties.
if (result) {
for(key in b)if (_.has(b, key) && !size--) break;
result = !size;
}
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/18/input.js | JavaScript | _.sortedIndex = function (array, obj, iterator, context) {
iterator = iterator == null ? _.identity : lookupIterator(iterator);
var value = iterator.call(context, obj);
var low = 0,
high = array.length;
while (low < high) {
var mid = (low + high) >>> 1;
iterator.call(context, array[mid]) < value
? (low = mid + 1)
: (high = mid);
}
return low;
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/18/output.js | JavaScript | _.sortedIndex = function(array, obj, iterator, context) {
for(var value = (iterator = null == iterator ? _.identity : lookupIterator(iterator)).call(context, obj), low = 0, high = array.length; low < high;){
var mid = low + high >>> 1;
iterator.call(context, array[mid]) < value ? low = mid + 1 : high = mid;
}
return low;
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/19/input.js | JavaScript | export function foo() {
while (size--) {
if (!(result = eq(a[size], b[size], aStack, bStack))) break;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/19/output.js | JavaScript | export function foo() {
for(; size-- && (result = eq(a[size], b[size], aStack, bStack)););
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/2/input.js | JavaScript | _.invoke = function (obj, method) {
var args = slice.call(arguments, 2);
var isFunc = _.isFunction(method);
return _.map(obj, function (value) {
return (isFunc ? method : value[method]).apply(value, args);
});
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/2/output.js | JavaScript | _.invoke = function(obj, method) {
var args = slice.call(arguments, 2), isFunc = _.isFunction(method);
return _.map(obj, function(value) {
return (isFunc ? method : value[method]).apply(value, args);
});
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/20/input.js | JavaScript | if ((name == "shift" || name == "splice") && obj.length === 0) delete obj[0];
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/20/output.js | JavaScript | ("shift" == name || "splice" == name) && 0 === obj.length && delete obj[0];
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/21/input.js | JavaScript | _.shuffle = function (obj) {
var rand;
var index = 0;
var shuffled = [];
each(obj, function (value) {
rand = _.random(index++);
shuffled[index - 1] = shuffled[rand];
shuffled[rand] = value;
});
return shuffled;
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/21/output.js | JavaScript | _.shuffle = function(obj) {
var rand, index = 0, shuffled = [];
return each(obj, function(value) {
rand = _.random(index++), shuffled[index - 1] = shuffled[rand], shuffled[rand] = value;
}), shuffled;
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/22/input.js | JavaScript | _.indexOf = function (array, item, isSorted) {
if (array == null) return -1;
var i = 0,
length = array.length;
if (isSorted) {
if (typeof isSorted == "number") {
i = isSorted < 0 ? Math.max(0, length + isSorted) : isSorted;
} else {
i = _.sortedIndex(array, item);
return array[i] === item ? i : -1;
}
}
if (nativeIndexOf && array.indexOf === nativeIndexOf)
return array.indexOf(item, isSorted);
for (; i < length; i++) if (array[i] === item) return i;
return -1;
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/22/output.js | JavaScript | _.indexOf = function(array, item, isSorted) {
if (null == array) return -1;
var i = 0, length = array.length;
if (isSorted) {
if ("number" != typeof isSorted) return i = _.sortedIndex(array, item), array[i] === item ? i : -1;
i = isSorted < 0 ? Math.max(0, length + isSorted) : isSorted;
}
if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item, isSorted);
for(; i < length; i++)if (array[i] === item) return i;
return -1;
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/23/input.js | JavaScript | _.once = function (func) {
var ran = false,
memo;
return function () {
if (ran) return memo;
ran = true;
memo = func.apply(this, arguments);
func = null;
return memo;
};
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/23/output.js | JavaScript | _.once = function(func) {
var memo, ran = !1;
return function() {
return ran || (ran = !0, memo = func.apply(this, arguments), func = null), memo;
};
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/24/input.js | JavaScript | (function () {
var idCounter = 0;
_.uniqueId = function (prefix) {
var id = ++idCounter + "";
return prefix ? prefix + id : id;
};
})();
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/24/output.js | JavaScript | !function() {
var idCounter = 0;
_.uniqueId = function(prefix) {
var id = ++idCounter + "";
return prefix ? prefix + id : id;
};
}();
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/3/input.js | JavaScript | _.max = function (obj, iterator, context) {
if (
!iterator &&
_.isArray(obj) &&
obj[0] === +obj[0] &&
obj.length < 65535
) {
return Math.max.apply(Math, obj);
}
if (!iterator && _.isEmpty(obj)) return -Infinity;
var result = { computed: -Infinity, value: -Infinity };
each(obj, function (value, index, list) {
var computed = iterator
? iterator.call(context, value, index, list)
: value;
computed > result.computed &&
(result = { value: value, computed: computed });
});
return result.value;
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/3/output.js | JavaScript | _.max = function(obj, iterator, context) {
if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) return Math.max.apply(Math, obj);
if (!iterator && _.isEmpty(obj)) return -1 / 0;
var result = {
computed: -1 / 0,
value: -1 / 0
};
return each(obj, function(value, index, list) {
var computed = iterator ? iterator.call(context, value, index, list) : value;
computed > result.computed && (result = {
value: value,
computed: computed
});
}), result.value;
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/4/input.js | JavaScript | _.sample = function (obj, n, guard) {
if (arguments.length < 2 || guard) {
return obj[_.random(obj.length - 1)];
}
return _.shuffle(obj).slice(0, Math.max(0, n));
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/4/output.js | JavaScript | _.sample = function(obj, n, guard) {
return arguments.length < 2 || guard ? obj[_.random(obj.length - 1)] : _.shuffle(obj).slice(0, Math.max(0, n));
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/5/input.js | JavaScript | _.uniq = _.unique = function (array, isSorted, iterator, context) {
if (_.isFunction(isSorted)) {
context = iterator;
iterator = isSorted;
isSorted = false;
}
var initial = iterator ? _.map(array, iterator, context) : array;
var results = [];
var seen = [];
each(initial, function (value, index) {
if (
isSorted
? !index || seen[seen.length - 1] !== value
: !_.contains(seen, value)
) {
seen.push(value);
results.push(array[index]);
}
});
return results;
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/5/output.js | JavaScript | _.uniq = _.unique = function(array, isSorted, iterator, context) {
_.isFunction(isSorted) && (context = iterator, iterator = isSorted, isSorted = !1);
var initial = iterator ? _.map(array, iterator, context) : array, results = [], seen = [];
return each(initial, function(value, index) {
(isSorted ? index && seen[seen.length - 1] === value : _.contains(seen, value)) || (seen.push(value), results.push(array[index]));
}), results;
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/6/input.js | JavaScript | _.indexOf = function (array, item, isSorted) {
if (array == null) return -1;
var i = 0,
length = array.length;
if (isSorted) {
if (typeof isSorted == "number") {
i = isSorted < 0 ? Math.max(0, length + isSorted) : isSorted;
} else {
i = _.sortedIndex(array, item);
return array[i] === item ? i : -1;
}
}
if (nativeIndexOf && array.indexOf === nativeIndexOf)
return array.indexOf(item, isSorted);
for (; i < length; i++) if (array[i] === item) return i;
return -1;
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/6/output.js | JavaScript | _.indexOf = function(array, item, isSorted) {
if (null == array) return -1;
var i = 0, length = array.length;
if (isSorted) {
if ("number" != typeof isSorted) return i = _.sortedIndex(array, item), array[i] === item ? i : -1;
i = isSorted < 0 ? Math.max(0, length + isSorted) : isSorted;
}
if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item, isSorted);
for(; i < length; i++)if (array[i] === item) return i;
return -1;
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/7/input.js | JavaScript | _.partial = function (func) {
var args = slice.call(arguments, 1);
return function () {
return func.apply(this, args.concat(slice.call(arguments)));
};
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/7/output.js | JavaScript | _.partial = function(func) {
var args = slice.call(arguments, 1);
return function() {
return func.apply(this, args.concat(slice.call(arguments)));
};
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/8/input.js | JavaScript | _.throttle = function (func, wait, options) {
var context, args, result;
var timeout = null;
var previous = 0;
options || (options = {});
var later = function () {
previous = options.leading === false ? 0 : new Date();
timeout = null;
result = func.apply(context, args);
};
return function () {
var now = new Date();
if (!previous && options.leading === false) previous = now;
var remaining = wait - (now - previous);
context = this;
args = arguments;
if (remaining <= 0) {
clearTimeout(timeout);
timeout = null;
previous = now;
result = func.apply(context, args);
} else if (!timeout && options.trailing !== false) {
timeout = setTimeout(later, remaining);
}
return result;
};
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/8/output.js | JavaScript | _.throttle = function(func, wait, options) {
var context, args, result, timeout = null, previous = 0;
options || (options = {});
var later = function() {
previous = !1 === options.leading ? 0 : new Date(), timeout = null, result = func.apply(context, args);
};
return function() {
var now = new Date();
previous || !1 !== options.leading || (previous = now);
var remaining = wait - (now - previous);
return context = this, args = arguments, remaining <= 0 ? (clearTimeout(timeout), timeout = null, previous = now, result = func.apply(context, args)) : timeout || !1 === options.trailing || (timeout = setTimeout(later, remaining)), result;
};
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/9/input.js | JavaScript | _.once = function (func) {
var ran = false,
memo;
return function () {
if (ran) return memo;
ran = true;
memo = func.apply(this, arguments);
func = null;
return memo;
};
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/underscore/9/output.js | JavaScript | _.once = function(func) {
var memo, ran = !1;
return function() {
return ran || (ran = !0, memo = func.apply(this, arguments), func = null), memo;
};
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/wmr/archive-1/chunks/.compat.2f7d9500/input.js | JavaScript | import {
_,
l as l$1,
v as v$1,
d as d$1,
A as A$2,
a as l$2,
p as p$1,
y as y$1,
h as h$1,
b as s,
c as _$1,
e as d$2,
f as A$3,
F as F$1,
T as T$1,
D as D$1,
g as p$2,
B as B$1,
S as S$1,
q as q$2,
s as style,
m as m$1,
} from "../index.f66dda46.js";
function S(n, t) {
for (var e in t) n[e] = t[e];
return n;
}
function C(n, t) {
for (var e in n) if ("__source" !== e && !(e in t)) return !0;
for (var r in t) if ("__source" !== r && n[r] !== t[r]) return !0;
return !1;
}
function E(n) {
this.props = n;
}
function g$1(n, t) {
function e(n) {
var e = this.props.ref,
r = e == n.ref;
return (
!r && e && (e.call ? e(null) : (e.current = null)),
t ? !t(this.props, n) || !r : C(this.props, n)
);
}
function r(t) {
return (this.shouldComponentUpdate = e), v$1(n, t);
}
return (
(r.displayName = "Memo(" + (n.displayName || n.name) + ")"),
(r.prototype.isReactComponent = !0),
(r.__f = !0),
r
);
}
((E.prototype = new _()).isPureReactComponent = !0),
(E.prototype.shouldComponentUpdate = function (n, t) {
return C(this.props, n) || C(this.state, t);
});
var w$1 = l$1.__b;
l$1.__b = function (n) {
n.type && n.type.__f && n.ref && ((n.props.ref = n.ref), (n.ref = null)),
w$1 && w$1(n);
};
var R =
("undefined" != typeof Symbol &&
Symbol.for &&
Symbol.for("react.forward_ref")) ||
3911;
function x$1(n) {
function t(t, e) {
var r = S({}, t);
return (
delete r.ref,
n(
r,
(e = t.ref || e) && ("object" != typeof e || "current" in e)
? e
: null
)
);
}
return (
(t.$$typeof = R),
(t.render = t),
(t.prototype.isReactComponent = t.__f = !0),
(t.displayName = "ForwardRef(" + (n.displayName || n.name) + ")"),
t
);
}
var N = function (n, t) {
return null == n ? null : A$2(A$2(n).map(t));
},
k$1 = {
map: N,
forEach: N,
count: function (n) {
return n ? A$2(n).length : 0;
},
only: function (n) {
var t = A$2(n);
if (1 !== t.length) throw "Children.only";
return t[0];
},
toArray: A$2,
},
A$1 = l$1.__e;
l$1.__e = function (n, t, e) {
if (n.then)
for (var r, u = t; (u = u.__); )
if ((r = u.__c) && r.__c)
return (
null == t.__e && ((t.__e = e.__e), (t.__k = e.__k)),
r.__c(n, t)
);
A$1(n, t, e);
};
var O = l$1.unmount;
function L() {
(this.__u = 0), (this.t = null), (this.__b = null);
}
function U(n) {
var t = n.__.__c;
return t && t.__e && t.__e(n);
}
function F(n) {
var t, e, r;
function u(u) {
if (
(t ||
(t = n()).then(
function (n) {
e = n.default || n;
},
function (n) {
r = n;
}
),
r)
)
throw r;
if (!e) throw t;
return v$1(e, u);
}
return (u.displayName = "Lazy"), (u.__f = !0), u;
}
function M() {
(this.u = null), (this.o = null);
}
(l$1.unmount = function (n) {
var t = n.__c;
t && t.__R && t.__R(), t && !0 === n.__h && (n.type = null), O && O(n);
}),
((L.prototype = new _()).__c = function (n, t) {
var e = t.__c,
r = this;
null == r.t && (r.t = []), r.t.push(e);
var u = U(r.__v),
o = !1,
i = function () {
o || ((o = !0), (e.__R = null), u ? u(l) : l());
};
e.__R = i;
var l = function () {
if (!--r.__u) {
if (r.state.__e) {
var n = r.state.__e;
r.__v.__k[0] = (function n(t, e, r) {
return (
t &&
((t.__v = null),
(t.__k =
t.__k &&
t.__k.map(function (t) {
return n(t, e, r);
})),
t.__c &&
t.__c.__P === e &&
(t.__e && r.insertBefore(t.__e, t.__d),
(t.__c.__e = !0),
(t.__c.__P = r))),
t
);
})(n, n.__c.__P, n.__c.__O);
}
var t;
for (
r.setState({
__e: (r.__b = null),
});
(t = r.t.pop());
)
t.forceUpdate();
}
},
f = !0 === t.__h;
r.__u++ ||
f ||
r.setState({
__e: (r.__b = r.__v.__k[0]),
}),
n.then(i, i);
}),
(L.prototype.componentWillUnmount = function () {
this.t = [];
}),
(L.prototype.render = function (n, t) {
if (this.__b) {
if (this.__v.__k) {
var e = document.createElement("div"),
r = this.__v.__k[0].__c;
this.__v.__k[0] = (function n(t, e, r) {
return (
t &&
(t.__c &&
t.__c.__H &&
(t.__c.__H.__.forEach(function (n) {
"function" == typeof n.__c && n.__c();
}),
(t.__c.__H = null)),
null != (t = S({}, t)).__c &&
(t.__c.__P === r && (t.__c.__P = e),
(t.__c = null)),
(t.__k =
t.__k &&
t.__k.map(function (t) {
return n(t, e, r);
}))),
t
);
})(this.__b, e, (r.__O = r.__P));
}
this.__b = null;
}
var u = t.__e && v$1(d$1, null, n.fallback);
return (
u && (u.__h = null), [v$1(d$1, null, t.__e ? null : n.children), u]
);
});
var T = function (n, t, e) {
if (
(++e[1] === e[0] && n.o.delete(t),
n.props.revealOrder && ("t" !== n.props.revealOrder[0] || !n.o.size))
)
for (e = n.u; e; ) {
for (; e.length > 3; ) e.pop()();
if (e[1] < e[0]) break;
n.u = e = e[2];
}
};
function D(n) {
return (
(this.getChildContext = function () {
return n.context;
}),
n.children
);
}
function I(n) {
var t = this,
e = n.i;
(t.componentWillUnmount = function () {
S$1(null, t.l), (t.l = null), (t.i = null);
}),
t.i && t.i !== e && t.componentWillUnmount(),
n.__v
? (t.l ||
((t.i = e),
(t.l = {
nodeType: 1,
parentNode: e,
childNodes: [],
appendChild: function (n) {
this.childNodes.push(n), t.i.appendChild(n);
},
insertBefore: function (n, e) {
this.childNodes.push(n), t.i.appendChild(n);
},
removeChild: function (n) {
this.childNodes.splice(
this.childNodes.indexOf(n) >>> 1,
1
),
t.i.removeChild(n);
},
})),
S$1(
v$1(
D,
{
context: t.context,
},
n.__v
),
t.l
))
: t.l && t.componentWillUnmount();
}
function W(n, t) {
return v$1(I, {
__v: n,
i: t,
});
}
((M.prototype = new _()).__e = function (n) {
var t = this,
e = U(t.__v),
r = t.o.get(n);
return (
r[0]++,
function (u) {
var o = function () {
t.props.revealOrder ? (r.push(u), T(t, n, r)) : u();
};
e ? e(o) : o();
}
);
}),
(M.prototype.render = function (n) {
(this.u = null), (this.o = new Map());
var t = A$2(n.children);
n.revealOrder && "b" === n.revealOrder[0] && t.reverse();
for (var e = t.length; e--; )
this.o.set(t[e], (this.u = [1, 0, this.u]));
return n.children;
}),
(M.prototype.componentDidUpdate = M.prototype.componentDidMount =
function () {
var n = this;
this.o.forEach(function (t, e) {
T(n, e, t);
});
});
var j =
("undefined" != typeof Symbol &&
Symbol.for &&
Symbol.for("react.element")) ||
60103,
P =
/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|fill|flood|font|glyph(?!R)|horiz|marker(?!H|W|U)|overline|paint|stop|strikethrough|stroke|text(?!L)|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,
V = function (n) {
return (
"undefined" != typeof Symbol && "symbol" == typeof Symbol()
? /fil|che|rad/i
: /fil|che|ra/i
).test(n);
};
function z$1(n, t, e) {
return (
null == t.__k && (t.textContent = ""),
S$1(n, t),
"function" == typeof e && e(),
n ? n.__c : null
);
}
function B(n, t, e) {
return q$2(n, t), "function" == typeof e && e(), n ? n.__c : null;
}
(_.prototype.isReactComponent = {}),
[
"componentWillMount",
"componentWillReceiveProps",
"componentWillUpdate",
].forEach(function (n) {
Object.defineProperty(_.prototype, n, {
configurable: !0,
get: function () {
return this["UNSAFE_" + n];
},
set: function (t) {
Object.defineProperty(this, n, {
configurable: !0,
writable: !0,
value: t,
});
},
});
});
var H = l$1.event;
function Z() {}
function Y() {
return this.cancelBubble;
}
function $() {
return this.defaultPrevented;
}
l$1.event = function (n) {
return (
H && (n = H(n)),
(n.persist = Z),
(n.isPropagationStopped = Y),
(n.isDefaultPrevented = $),
(n.nativeEvent = n)
);
};
var q$1,
G = {
configurable: !0,
get: function () {
return this.class;
},
},
J = l$1.vnode;
l$1.vnode = function (n) {
var t = n.type,
e = n.props,
r = e;
if ("string" == typeof t) {
for (var u in ((r = {}), e)) {
var o = e[u];
("value" === u && "defaultValue" in e && null == o) ||
("defaultValue" === u && "value" in e && null == e.value
? (u = "value")
: "download" === u && !0 === o
? (o = "")
: /ondoubleclick/i.test(u)
? (u = "ondblclick")
: /^onchange(textarea|input)/i.test(u + t) && !V(e.type)
? (u = "oninput")
: /^on(Ani|Tra|Tou|BeforeInp)/.test(u)
? (u = u.toLowerCase())
: P.test(u)
? (u = u.replace(/[A-Z0-9]/, "-$&").toLowerCase())
: null === o && (o = void 0),
(r[u] = o));
}
"select" == t &&
r.multiple &&
Array.isArray(r.value) &&
(r.value = A$2(e.children).forEach(function (n) {
n.props.selected = -1 != r.value.indexOf(n.props.value);
})),
"select" == t &&
null != r.defaultValue &&
(r.value = A$2(e.children).forEach(function (n) {
n.props.selected = r.multiple
? -1 != r.defaultValue.indexOf(n.props.value)
: r.defaultValue == n.props.value;
})),
(n.props = r);
}
t &&
e.class != e.className &&
((G.enumerable = "className" in e),
null != e.className && (r.class = e.className),
Object.defineProperty(r, "className", G)),
(n.$$typeof = j),
J && J(n);
};
var K = l$1.__r;
l$1.__r = function (n) {
K && K(n), (q$1 = n.__c);
};
var Q = {
ReactCurrentDispatcher: {
current: {
readContext: function (n) {
return q$1.__n[n.__c].props.value;
},
},
},
};
function nn(n) {
return v$1.bind(null, n);
}
function tn(n) {
return !!n && n.$$typeof === j;
}
function en(n) {
return tn(n) ? B$1.apply(null, arguments) : n;
}
function rn(n) {
return !!n.__k && (S$1(null, n), !0);
}
function un(n) {
return (n && (n.base || (1 === n.nodeType && n))) || null;
}
var on = function (n, t) {
return n(t);
},
ln = function (n, t) {
return n(t);
};
const React = {
useState: l$2,
useReducer: p$1,
useEffect: y$1,
useLayoutEffect: h$1,
useRef: s,
useImperativeHandle: _$1,
useMemo: d$2,
useCallback: A$3,
useContext: F$1,
useDebugValue: T$1,
version: "17.0.2",
Children: k$1,
render: z$1,
hydrate: B,
unmountComponentAtNode: rn,
createPortal: W,
createElement: v$1,
createContext: D$1,
createFactory: nn,
cloneElement: en,
createRef: p$2,
Fragment: d$1,
isValidElement: tn,
findDOMNode: un,
Component: _,
PureComponent: E,
memo: g$1,
forwardRef: x$1,
flushSync: ln,
unstable_batchedUpdates: on,
StrictMode: d$1,
Suspense: L,
SuspenseList: M,
lazy: F,
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: Q,
};
var module$7 = {
exports: {},
},
exports = module$7.exports;
var b = "function" === typeof Symbol && Symbol.for,
c = b ? Symbol.for("react.element") : 60103,
d = b ? Symbol.for("react.portal") : 60106,
e = b ? Symbol.for("react.fragment") : 60107,
f = b ? Symbol.for("react.strict_mode") : 60108,
g = b ? Symbol.for("react.profiler") : 60114,
h = b ? Symbol.for("react.provider") : 60109,
k = b ? Symbol.for("react.context") : 60110,
l = b ? Symbol.for("react.async_mode") : 60111,
m = b ? Symbol.for("react.concurrent_mode") : 60111,
n = b ? Symbol.for("react.forward_ref") : 60112,
p = b ? Symbol.for("react.suspense") : 60113,
q = b ? Symbol.for("react.suspense_list") : 60120,
r = b ? Symbol.for("react.memo") : 60115,
t = b ? Symbol.for("react.lazy") : 60116,
v = b ? Symbol.for("react.block") : 60121,
w = b ? Symbol.for("react.fundamental") : 60117,
x = b ? Symbol.for("react.responder") : 60118,
y = b ? Symbol.for("react.scope") : 60119;
function z(a) {
if ("object" === typeof a && null !== a) {
var u = a.$$typeof;
switch (u) {
case c:
switch (((a = a.type), a)) {
case l:
case m:
case e:
case g:
case f:
case p:
return a;
default:
switch (((a = a && a.$$typeof), a)) {
case k:
case n:
case t:
case r:
case h:
return a;
default:
return u;
}
}
case d:
return u;
}
}
}
function A(a) {
return z(a) === m;
}
exports.AsyncMode = l;
exports.ConcurrentMode = m;
exports.ContextConsumer = k;
exports.ContextProvider = h;
exports.Element = c;
exports.ForwardRef = n;
exports.Fragment = e;
exports.Lazy = t;
exports.Memo = r;
exports.Portal = d;
exports.Profiler = g;
exports.StrictMode = f;
exports.Suspense = p;
exports.isAsyncMode = function (a) {
return A(a) || z(a) === l;
};
exports.isConcurrentMode = A;
exports.isContextConsumer = function (a) {
return z(a) === k;
};
exports.isContextProvider = function (a) {
return z(a) === h;
};
exports.isElement = function (a) {
return "object" === typeof a && null !== a && a.$$typeof === c;
};
exports.isForwardRef = function (a) {
return z(a) === n;
};
exports.isFragment = function (a) {
return z(a) === e;
};
exports.isLazy = function (a) {
return z(a) === t;
};
exports.isMemo = function (a) {
return z(a) === r;
};
exports.isPortal = function (a) {
return z(a) === d;
};
exports.isProfiler = function (a) {
return z(a) === g;
};
exports.isStrictMode = function (a) {
return z(a) === f;
};
exports.isSuspense = function (a) {
return z(a) === p;
};
exports.isValidElementType = function (a) {
return (
"string" === typeof a ||
"function" === typeof a ||
a === e ||
a === m ||
a === g ||
a === f ||
a === p ||
a === q ||
("object" === typeof a &&
null !== a &&
(a.$$typeof === t ||
a.$$typeof === r ||
a.$$typeof === h ||
a.$$typeof === k ||
a.$$typeof === n ||
a.$$typeof === w ||
a.$$typeof === x ||
a.$$typeof === y ||
a.$$typeof === v))
);
};
exports.typeOf = z;
const reactIs_production_min = module$7.exports;
const $cjs$_cjs_react_is_production_min_js = /*#__PURE__*/ Object.freeze({
__proto__: null,
default: reactIs_production_min,
});
function $$cjs_default$$$3(m, i) {
for (i in m) if (i != "default") return m;
return m.default || m;
}
var module$6 = {
exports: {},
};
{
module$6.exports = $$cjs_default$$$3($cjs$_cjs_react_is_production_min_js);
}
const index$1 = module$6.exports;
const $cjs$react_is = /*#__PURE__*/ Object.freeze({
__proto__: null,
default: index$1,
});
var module$5 = {
exports: {},
};
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var hasOwnProperty = Object.prototype.hasOwnProperty;
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
function toObject(val) {
if (val === null || val === undefined) {
throw new TypeError(
"Object.assign cannot be called with null or undefined"
);
}
return Object(val);
}
function shouldUseNative() {
try {
if (!Object.assign) {
return false;
}
// Detect buggy property enumeration order in older V8 versions.
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
var test1 = new String("abc");
test1[5] = "de";
if (Object.getOwnPropertyNames(test1)[0] === "5") {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test2 = {};
for (var i = 0; i < 10; i++) {
test2["_" + String.fromCharCode(i)] = i;
}
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
return test2[n];
});
if (order2.join("") !== "0123456789") {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test3 = {};
"abcdefghijklmnopqrst".split("").forEach(function (letter) {
test3[letter] = letter;
});
if (
Object.keys(Object.assign({}, test3)).join("") !==
"abcdefghijklmnopqrst"
) {
return false;
}
return true;
} catch (err) {
// We don't expect any of the above to throw, but better to be safe.
return false;
}
}
module$5.exports = shouldUseNative()
? Object.assign
: function (target, source) {
var from;
var to = toObject(target);
var symbols;
for (var s = 1; s < arguments.length; s++) {
from = Object(arguments[s]);
for (var key in from) {
if (hasOwnProperty.call(from, key)) {
to[key] = from[key];
}
}
if (getOwnPropertySymbols) {
symbols = getOwnPropertySymbols(from);
for (var i = 0; i < symbols.length; i++) {
if (propIsEnumerable.call(from, symbols[i])) {
to[symbols[i]] = from[symbols[i]];
}
}
}
}
return to;
};
const index = module$5.exports;
const $cjs$object_assign = /*#__PURE__*/ Object.freeze({
__proto__: null,
default: index,
});
var module$4 = {
exports: {},
};
var ReactPropTypesSecret$1 = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
module$4.exports = ReactPropTypesSecret$1;
const ReactPropTypesSecret$2 = module$4.exports;
const $cjs$_lib_ReactPropTypesSecret = /*#__PURE__*/ Object.freeze({
__proto__: null,
default: ReactPropTypesSecret$2,
});
var module$3 = {
exports: {},
};
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {}
checkPropTypes.resetWarningCache = function () {};
module$3.exports = checkPropTypes;
const checkPropTypes$1 = module$3.exports;
const $cjs$_checkPropTypes = /*#__PURE__*/ Object.freeze({
__proto__: null,
default: checkPropTypes$1,
});
function $$cjs_default$$$2(m, i) {
for (i in m) if (i != "default") return m;
return m.default || m;
}
$$cjs_default$$$2($cjs$react_is);
$$cjs_default$$$2($cjs$object_assign);
$$cjs_default$$$2($cjs$_lib_ReactPropTypesSecret);
$$cjs_default$$$2($cjs$_checkPropTypes);
Function.call.bind(Object.prototype.hasOwnProperty);
function $$cjs_default$$$1(m, i) {
for (i in m) if (i != "default") return m;
return m.default || m;
}
var module$2 = {
exports: {},
};
var ReactPropTypesSecret = $$cjs_default$$$1($cjs$_lib_ReactPropTypesSecret);
function emptyFunction() {}
function emptyFunctionWithReset() {}
emptyFunctionWithReset.resetWarningCache = emptyFunction;
module$2.exports = function () {
function shim(
props,
propName,
componentName,
location,
propFullName,
secret
) {
if (secret === ReactPropTypesSecret) {
// It is still safe when called from React.
return;
}
var err = 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"
);
err.name = "Invariant Violation";
throw err;
}
shim.isRequired = shim;
function getShim() {
return shim;
} // Important!
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
var ReactPropTypes = {
array: shim,
bool: shim,
func: shim,
number: shim,
object: shim,
string: shim,
symbol: shim,
any: shim,
arrayOf: getShim,
element: shim,
elementType: shim,
instanceOf: getShim,
node: shim,
objectOf: getShim,
oneOf: getShim,
oneOfType: getShim,
shape: getShim,
exact: getShim,
checkPropTypes: emptyFunctionWithReset,
resetWarningCache: emptyFunction,
};
ReactPropTypes.PropTypes = ReactPropTypes;
return ReactPropTypes;
};
const factoryWithThrowingShims = module$2.exports;
const $cjs$_factoryWithThrowingShims = /*#__PURE__*/ Object.freeze({
__proto__: null,
default: factoryWithThrowingShims,
});
function $$cjs_default$$(m, i) {
for (i in m) if (i != "default") return m;
return m.default || m;
}
var module$1 = {
exports: {},
};
{
// By explicitly using `prop-types` you are opting into new production behavior.
// http://fb.me/prop-types-in-prod
module$1.exports = $$cjs_default$$($cjs$_factoryWithThrowingShims)();
}
const PropTypes = module$1.exports;
function mergeClassNames() {
return Array.prototype.slice
.call(arguments)
.reduce(function (classList, arg) {
return typeof arg === "string" || Array.isArray(arg)
? classList.concat(arg)
: classList;
}, [])
.filter(Boolean)
.join(" ");
}
var module = {
exports: {},
};
var FUNC_ERROR_TEXT = "Expected a function";
var INFINITY = 1 / 0,
MAX_INTEGER = 1.7976931348623157e308,
NAN = 0 / 0;
var symbolTag = "[object Symbol]";
var reTrim = /^\s+|\s+$/g;
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
var reIsBinary = /^0b[01]+$/i;
var reIsOctal = /^0o[0-7]+$/i;
var freeParseInt = parseInt;
var objectProto = Object.prototype;
var objectToString = objectProto.toString;
function before(n, func) {
var result;
if (typeof func != "function") {
throw new TypeError(FUNC_ERROR_TEXT);
}
n = toInteger(n);
return function () {
if (--n > 0) {
result = func.apply(this, arguments);
}
if (n <= 1) {
func = undefined;
}
return result;
};
}
function once(func) {
return before(2, func);
}
function isObject(value) {
var type = typeof value;
return !!value && (type == "object" || type == "function");
}
function isObjectLike(value) {
return !!value && typeof value == "object";
}
function isSymbol(value) {
return (
typeof value == "symbol" ||
(isObjectLike(value) && objectToString.call(value) == symbolTag)
);
}
function toFinite(value) {
if (!value) {
return value === 0 ? value : 0;
}
value = toNumber(value);
if (value === INFINITY || value === -INFINITY) {
var sign = value < 0 ? -1 : 1;
return sign * MAX_INTEGER;
}
return value === value ? value : 0;
}
function toInteger(value) {
var result = toFinite(value),
remainder = result % 1;
return result === result ? (remainder ? result - remainder : result) : 0;
}
function toNumber(value) {
if (typeof value == "number") {
return value;
}
if (isSymbol(value)) {
return NAN;
}
if (isObject(value)) {
var other =
typeof value.valueOf == "function" ? value.valueOf() : value;
value = isObject(other) ? other + "" : other;
}
if (typeof value != "string") {
return value === 0 ? value : +value;
}
value = value.replace(reTrim, "");
var isBinary = reIsBinary.test(value);
return isBinary || reIsOctal.test(value)
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
: reIsBadHex.test(value)
? NAN
: +value;
}
module.exports = once;
const once$1 = module.exports;
function filterDuplicates(arr) {
return arr.filter(function (el, index, self) {
return self.indexOf(el) === index;
});
}
function fixLowercaseProperties(arr) {
return arr.map(function (el) {
if (!el || el.indexOf("-") === -1 || el.toLowerCase() !== el) {
return el;
}
var splitEl = el.split("-");
return "".concat(splitEl[0], "-").concat(splitEl[1].toUpperCase());
});
}
function getUserLocalesInternal() {
var languageList = [];
if (typeof window !== "undefined") {
if (window.navigator.languages) {
languageList = languageList.concat(window.navigator.languages);
}
if (window.navigator.language) {
languageList.push(window.navigator.language);
}
if (window.navigator.userLanguage) {
languageList.push(window.navigator.userLanguage);
}
if (window.navigator.browserLanguage) {
languageList.push(window.navigator.browserLanguage);
}
if (window.navigator.systemLanguage) {
languageList.push(window.navigator.systemLanguage);
}
}
languageList.push("en-US"); // Fallback
return fixLowercaseProperties(filterDuplicates(languageList));
}
var getUserLocales = once$1(getUserLocalesInternal);
function getUserLocaleInternal() {
return getUserLocales()[0];
}
var getUserLocale = once$1(getUserLocaleInternal);
/**
* Utils
*/
function makeGetEdgeOfNeighbor(getPeriod, getEdgeOfPeriod, defaultOffset) {
return function makeGetEdgeOfNeighborInternal(date) {
var offset =
arguments.length > 1 && arguments[1] !== undefined
? arguments[1]
: defaultOffset;
var previousPeriod = getPeriod(date) + offset;
return getEdgeOfPeriod(previousPeriod);
};
}
function makeGetEnd(getBeginOfNextPeriod) {
return function makeGetEndInternal(date) {
return new Date(getBeginOfNextPeriod(date).getTime() - 1);
};
}
function makeGetRange(functions) {
return function makeGetRangeInternal(date) {
return functions.map(function (fn) {
return fn(date);
});
};
}
/**
* Simple getters - getting a property of a given point in time
*/
/**
* Gets year from date.
*
* @param {Date|number|string} date Date to get year from.
*/
function getYear(date) {
if (date instanceof Date) {
return date.getFullYear();
}
if (typeof date === "number") {
return date;
}
var year = parseInt(date, 10);
if (typeof date === "string" && !isNaN(year)) {
return year;
}
throw new Error("Failed to get year from date: ".concat(date, "."));
}
/**
* Gets month from date.
*
* @param {Date} date Date to get month from.
*/
function getMonth(date) {
if (date instanceof Date) {
return date.getMonth();
}
throw new Error("Failed to get month from date: ".concat(date, "."));
}
/**
* Gets human-readable day of the month from date.
*
* @param {Date} date Date to get day of the month from.
*/
function getDate(date) {
if (date instanceof Date) {
return date.getDate();
}
throw new Error("Failed to get year from date: ".concat(date, "."));
}
/**
* Century
*/
function getCenturyStart(date) {
var year = getYear(date);
var centuryStartYear = year + ((-year + 1) % 100);
var centuryStartDate = new Date();
centuryStartDate.setFullYear(centuryStartYear, 0, 1);
centuryStartDate.setHours(0, 0, 0, 0);
return centuryStartDate;
}
var getPreviousCenturyStart = makeGetEdgeOfNeighbor(
getYear,
getCenturyStart,
-100
);
var getNextCenturyStart = makeGetEdgeOfNeighbor(getYear, getCenturyStart, 100);
var getCenturyEnd = makeGetEnd(getNextCenturyStart);
var getPreviousCenturyEnd = makeGetEdgeOfNeighbor(getYear, getCenturyEnd, -100);
var getCenturyRange = makeGetRange([getCenturyStart, getCenturyEnd]);
/**
* Decade
*/
function getDecadeStart(date) {
var year = getYear(date);
var decadeStartYear = year + ((-year + 1) % 10);
var decadeStartDate = new Date();
decadeStartDate.setFullYear(decadeStartYear, 0, 1);
decadeStartDate.setHours(0, 0, 0, 0);
return decadeStartDate;
}
var getPreviousDecadeStart = makeGetEdgeOfNeighbor(
getYear,
getDecadeStart,
-10
);
var getNextDecadeStart = makeGetEdgeOfNeighbor(getYear, getDecadeStart, 10);
var getDecadeEnd = makeGetEnd(getNextDecadeStart);
var getPreviousDecadeEnd = makeGetEdgeOfNeighbor(getYear, getDecadeEnd, -10);
var getDecadeRange = makeGetRange([getDecadeStart, getDecadeEnd]);
/**
* Year
*/
function getYearStart(date) {
var year = getYear(date);
var yearStartDate = new Date();
yearStartDate.setFullYear(year, 0, 1);
yearStartDate.setHours(0, 0, 0, 0);
return yearStartDate;
}
var getPreviousYearStart = makeGetEdgeOfNeighbor(getYear, getYearStart, -1);
var getNextYearStart = makeGetEdgeOfNeighbor(getYear, getYearStart, 1);
var getYearEnd = makeGetEnd(getNextYearStart);
var getPreviousYearEnd = makeGetEdgeOfNeighbor(getYear, getYearEnd, -1);
var getYearRange = makeGetRange([getYearStart, getYearEnd]);
/**
* Month
*/
function makeGetEdgeOfNeighborMonth(getEdgeOfPeriod, defaultOffset) {
return function makeGetEdgeOfNeighborMonthInternal(date) {
var offset =
arguments.length > 1 && arguments[1] !== undefined
? arguments[1]
: defaultOffset;
var year = getYear(date);
var month = getMonth(date) + offset;
var previousPeriod = new Date();
previousPeriod.setFullYear(year, month, 1);
previousPeriod.setHours(0, 0, 0, 0);
return getEdgeOfPeriod(previousPeriod);
};
}
function getMonthStart(date) {
var year = getYear(date);
var month = getMonth(date);
var monthStartDate = new Date();
monthStartDate.setFullYear(year, month, 1);
monthStartDate.setHours(0, 0, 0, 0);
return monthStartDate;
}
var getPreviousMonthStart = makeGetEdgeOfNeighborMonth(getMonthStart, -1);
var getNextMonthStart = makeGetEdgeOfNeighborMonth(getMonthStart, 1);
var getMonthEnd = makeGetEnd(getNextMonthStart);
var getPreviousMonthEnd = makeGetEdgeOfNeighborMonth(getMonthEnd, -1);
var getMonthRange = makeGetRange([getMonthStart, getMonthEnd]);
/**
* Day
*/
function makeGetEdgeOfNeighborDay(getEdgeOfPeriod, defaultOffset) {
return function makeGetEdgeOfNeighborDayInternal(date) {
var offset =
arguments.length > 1 && arguments[1] !== undefined
? arguments[1]
: defaultOffset;
var year = getYear(date);
var month = getMonth(date);
var day = getDate(date) + offset;
var previousPeriod = new Date();
previousPeriod.setFullYear(year, month, day);
previousPeriod.setHours(0, 0, 0, 0);
return getEdgeOfPeriod(previousPeriod);
};
}
function getDayStart(date) {
var year = getYear(date);
var month = getMonth(date);
var day = getDate(date);
var dayStartDate = new Date();
dayStartDate.setFullYear(year, month, day);
dayStartDate.setHours(0, 0, 0, 0);
return dayStartDate;
}
var getNextDayStart = makeGetEdgeOfNeighborDay(getDayStart, 1);
var getDayEnd = makeGetEnd(getNextDayStart);
var getDayRange = makeGetRange([getDayStart, getDayEnd]);
/**
* Other
*/
/**
* Returns a number of days in a month of a given date.
*
* @param {Date} date Date.
*/
function getDaysInMonth(date) {
return getDate(getMonthEnd(date));
}
var _CALENDAR_TYPE_LOCALE;
function _toConsumableArray$2(arr) {
return (
_arrayWithoutHoles$2(arr) ||
_iterableToArray$2(arr) ||
_unsupportedIterableToArray$2(arr) ||
_nonIterableSpread$2()
);
}
function _nonIterableSpread$2() {
throw new TypeError(
"Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."
);
}
function _unsupportedIterableToArray$2(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray$2(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
return _arrayLikeToArray$2(o, minLen);
}
function _iterableToArray$2(iter) {
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter))
return Array.from(iter);
}
function _arrayWithoutHoles$2(arr) {
if (Array.isArray(arr)) return _arrayLikeToArray$2(arr);
}
function _arrayLikeToArray$2(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) {
arr2[i] = arr[i];
}
return arr2;
}
function _defineProperty$c(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true,
});
} else {
obj[key] = value;
}
return obj;
}
var CALENDAR_TYPES = {
ARABIC: "Arabic",
HEBREW: "Hebrew",
ISO_8601: "ISO 8601",
US: "US",
};
var CALENDAR_TYPE_LOCALES =
((_CALENDAR_TYPE_LOCALE = {}),
_defineProperty$c(_CALENDAR_TYPE_LOCALE, CALENDAR_TYPES.US, [
"en-CA",
"en-US",
"es-AR",
"es-BO",
"es-CL",
"es-CO",
"es-CR",
"es-DO",
"es-EC",
"es-GT",
"es-HN",
"es-MX",
"es-NI",
"es-PA",
"es-PE",
"es-PR",
"es-SV",
"es-VE",
"pt-BR",
]),
_defineProperty$c(_CALENDAR_TYPE_LOCALE, CALENDAR_TYPES.ARABIC, [
// ar-LB, ar-MA intentionally missing
"ar",
"ar-AE",
"ar-BH",
"ar-DZ",
"ar-EG",
"ar-IQ",
"ar-JO",
"ar-KW",
"ar-LY",
"ar-OM",
"ar-QA",
"ar-SA",
"ar-SD",
"ar-SY",
"ar-YE",
"dv",
"dv-MV",
"ps",
"ps-AR",
]),
_defineProperty$c(_CALENDAR_TYPE_LOCALE, CALENDAR_TYPES.HEBREW, [
"he",
"he-IL",
]),
_CALENDAR_TYPE_LOCALE);
var WEEKDAYS = _toConsumableArray$2(Array(7)).map(function (el, index) {
return index;
});
function getFormatter(options) {
return function (locale, date) {
return date.toLocaleString(locale || getUserLocale(), options);
};
}
/**
* Changes the hour in a Date to ensure right date formatting even if DST is messed up.
* Workaround for bug in WebKit and Firefox with historical dates.
* For more details, see:
* https://bugs.chromium.org/p/chromium/issues/detail?id=750465
* https://bugzilla.mozilla.org/show_bug.cgi?id=1385643
*
* @param {Date} date Date.
*/
function toSafeHour(date) {
var safeDate = new Date(date);
return new Date(safeDate.setHours(12));
}
function getSafeFormatter(options) {
return function (locale, date) {
return getFormatter(options)(locale, toSafeHour(date));
};
}
var formatDayOptions = {
day: "numeric",
};
var formatLongDateOptions = {
day: "numeric",
month: "long",
year: "numeric",
};
var formatMonthOptions = {
month: "long",
};
var formatMonthYearOptions = {
month: "long",
year: "numeric",
};
var formatShortWeekdayOptions = {
weekday: "short",
};
var formatWeekdayOptions = {
weekday: "long",
};
var formatYearOptions = {
year: "numeric",
};
var formatDay = getSafeFormatter(formatDayOptions);
var formatLongDate = getSafeFormatter(formatLongDateOptions);
var formatMonth = getSafeFormatter(formatMonthOptions);
var formatMonthYear = getSafeFormatter(formatMonthYearOptions);
var formatShortWeekday = getSafeFormatter(formatShortWeekdayOptions);
var formatWeekday = getSafeFormatter(formatWeekdayOptions);
var formatYear = getSafeFormatter(formatYearOptions);
var SUNDAY = WEEKDAYS[0];
var FRIDAY = WEEKDAYS[5];
var SATURDAY = WEEKDAYS[6];
/* Simple getters - getting a property of a given point in time */
function getDayOfWeek(date) {
var calendarType =
arguments.length > 1 && arguments[1] !== undefined
? arguments[1]
: CALENDAR_TYPES.ISO_8601;
var weekday = date.getDay();
switch (calendarType) {
case CALENDAR_TYPES.ISO_8601:
// Shifts days of the week so that Monday is 0, Sunday is 6
return (weekday + 6) % 7;
case CALENDAR_TYPES.ARABIC:
return (weekday + 1) % 7;
case CALENDAR_TYPES.HEBREW:
case CALENDAR_TYPES.US:
return weekday;
default:
throw new Error("Unsupported calendar type.");
}
}
/**
* Century
*/
function getBeginOfCenturyYear(date) {
var beginOfCentury = getCenturyStart(date);
return getYear(beginOfCentury);
}
/**
* Decade
*/
function getBeginOfDecadeYear(date) {
var beginOfDecade = getDecadeStart(date);
return getYear(beginOfDecade);
}
/**
* Week
*/
/**
* Returns the beginning of a given week.
*
* @param {Date} date Date.
* @param {string} calendarType Calendar type. Can be ISO 8601 or US.
*/
function getBeginOfWeek(date) {
var calendarType =
arguments.length > 1 && arguments[1] !== undefined
? arguments[1]
: CALENDAR_TYPES.ISO_8601;
var year = getYear(date);
var monthIndex = getMonth(date);
var day = date.getDate() - getDayOfWeek(date, calendarType);
return new Date(year, monthIndex, day);
}
/**
* Gets week number according to ISO 8601 or US standard.
* In ISO 8601, Arabic and Hebrew week 1 is the one with January 4.
* In US calendar week 1 is the one with January 1.
*
* @param {Date} date Date.
* @param {string} calendarType Calendar type. Can be ISO 8601 or US.
*/
function getWeekNumber(date) {
var calendarType =
arguments.length > 1 && arguments[1] !== undefined
? arguments[1]
: CALENDAR_TYPES.ISO_8601;
var calendarTypeForWeekNumber =
calendarType === CALENDAR_TYPES.US
? CALENDAR_TYPES.US
: CALENDAR_TYPES.ISO_8601;
var beginOfWeek = getBeginOfWeek(date, calendarTypeForWeekNumber);
var year = getYear(date) + 1;
var dayInWeekOne;
var beginOfFirstWeek; // Look for the first week one that does not come after a given date
do {
dayInWeekOne = new Date(
year,
0,
calendarTypeForWeekNumber === CALENDAR_TYPES.ISO_8601 ? 4 : 1
);
beginOfFirstWeek = getBeginOfWeek(
dayInWeekOne,
calendarTypeForWeekNumber
);
year -= 1;
} while (date - beginOfFirstWeek < 0);
return Math.round((beginOfWeek - beginOfFirstWeek) / (8.64e7 * 7)) + 1;
}
/**
* Others
*/
/**
* Returns the beginning of a given range.
*
* @param {string} rangeType Range type (e.g. 'day')
* @param {Date} date Date.
*/
function getBegin(rangeType, date) {
switch (rangeType) {
case "century":
return getCenturyStart(date);
case "decade":
return getDecadeStart(date);
case "year":
return getYearStart(date);
case "month":
return getMonthStart(date);
case "day":
return getDayStart(date);
default:
throw new Error("Invalid rangeType: ".concat(rangeType));
}
}
function getBeginPrevious(rangeType, date) {
switch (rangeType) {
case "century":
return getPreviousCenturyStart(date);
case "decade":
return getPreviousDecadeStart(date);
case "year":
return getPreviousYearStart(date);
case "month":
return getPreviousMonthStart(date);
default:
throw new Error("Invalid rangeType: ".concat(rangeType));
}
}
function getBeginNext(rangeType, date) {
switch (rangeType) {
case "century":
return getNextCenturyStart(date);
case "decade":
return getNextDecadeStart(date);
case "year":
return getNextYearStart(date);
case "month":
return getNextMonthStart(date);
default:
throw new Error("Invalid rangeType: ".concat(rangeType));
}
}
var getBeginPrevious2 = function getBeginPrevious2(rangeType, date) {
switch (rangeType) {
case "decade":
return getPreviousDecadeStart(date, -100);
case "year":
return getPreviousYearStart(date, -10);
case "month":
return getPreviousMonthStart(date, -12);
default:
throw new Error("Invalid rangeType: ".concat(rangeType));
}
};
var getBeginNext2 = function getBeginNext2(rangeType, date) {
switch (rangeType) {
case "decade":
return getNextDecadeStart(date, 100);
case "year":
return getNextYearStart(date, 10);
case "month":
return getNextMonthStart(date, 12);
default:
throw new Error("Invalid rangeType: ".concat(rangeType));
}
};
/**
* Returns the end of a given range.
*
* @param {string} rangeType Range type (e.g. 'day')
* @param {Date} date Date.
*/
function getEnd(rangeType, date) {
switch (rangeType) {
case "century":
return getCenturyEnd(date);
case "decade":
return getDecadeEnd(date);
case "year":
return getYearEnd(date);
case "month":
return getMonthEnd(date);
case "day":
return getDayEnd(date);
default:
throw new Error("Invalid rangeType: ".concat(rangeType));
}
}
function getEndPrevious(rangeType, date) {
switch (rangeType) {
case "century":
return getPreviousCenturyEnd(date);
case "decade":
return getPreviousDecadeEnd(date);
case "year":
return getPreviousYearEnd(date);
case "month":
return getPreviousMonthEnd(date);
default:
throw new Error("Invalid rangeType: ".concat(rangeType));
}
}
var getEndPrevious2 = function getEndPrevious2(rangeType, date) {
switch (rangeType) {
case "decade":
return getPreviousDecadeEnd(date, -100);
case "year":
return getPreviousYearEnd(date, -10);
case "month":
return getPreviousMonthEnd(date, -12);
default:
throw new Error("Invalid rangeType: ".concat(rangeType));
}
};
/**
* Returns an array with the beginning and the end of a given range.
*
* @param {string} rangeType Range type (e.g. 'day')
* @param {Date} date Date.
*/
function getRange(rangeType, date) {
switch (rangeType) {
case "century":
return getCenturyRange(date);
case "decade":
return getDecadeRange(date);
case "year":
return getYearRange(date);
case "month":
return getMonthRange(date);
case "day":
return getDayRange(date);
default:
throw new Error("Invalid rangeType: ".concat(rangeType));
}
}
/**
* Creates a range out of two values, ensuring they are in order and covering entire period ranges.
*
* @param {string} rangeType Range type (e.g. 'day')
* @param {Date} date1 First date.
* @param {Date} date2 Second date.
*/
function getValueRange(rangeType, date1, date2) {
var rawNextValue = [date1, date2].sort(function (a, b) {
return a - b;
});
return [
getBegin(rangeType, rawNextValue[0]),
getEnd(rangeType, rawNextValue[1]),
];
}
function toYearLabel(locale) {
var formatYear$1 =
arguments.length > 1 && arguments[1] !== undefined
? arguments[1]
: formatYear;
var dates = arguments.length > 2 ? arguments[2] : undefined;
return dates
.map(function (date) {
return formatYear$1(locale, date);
})
.join(" – ");
}
/**
* Returns a string labelling a century of a given date.
* For example, for 2017 it will return 2001-2100.
*
* @param {Date|String|Number} date Date or a year as a string or as a number.
*/
function getCenturyLabel(locale, formatYear, date) {
return toYearLabel(locale, formatYear, getCenturyRange(date));
}
/**
* Returns a string labelling a century of a given date.
* For example, for 2017 it will return 2011-2020.
*
* @param {Date|String|Number} date Date or a year as a string or as a number.
*/
function getDecadeLabel(locale, formatYear, date) {
return toYearLabel(locale, formatYear, getDecadeRange(date));
}
/**
* Returns a boolean determining whether a given date is on Saturday or Sunday.
*
* @param {Date} date Date.
*/
function isWeekend(date) {
var calendarType =
arguments.length > 1 && arguments[1] !== undefined
? arguments[1]
: CALENDAR_TYPES.ISO_8601;
var weekday = date.getDay();
switch (calendarType) {
case CALENDAR_TYPES.ARABIC:
case CALENDAR_TYPES.HEBREW:
return weekday === FRIDAY || weekday === SATURDAY;
case CALENDAR_TYPES.ISO_8601:
case CALENDAR_TYPES.US:
return weekday === SATURDAY || weekday === SUNDAY;
default:
throw new Error("Unsupported calendar type.");
}
}
function _typeof$2(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof$2 = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof$2 = function _typeof(obj) {
return obj &&
typeof Symbol === "function" &&
obj.constructor === Symbol &&
obj !== Symbol.prototype
? "symbol"
: typeof obj;
};
}
return _typeof$2(obj);
}
var calendarTypes = Object.values(CALENDAR_TYPES);
var allViews$1 = ["century", "decade", "year", "month"];
var isCalendarType = PropTypes.oneOf(calendarTypes);
var isClassName = PropTypes.oneOfType([
PropTypes.string,
PropTypes.arrayOf(PropTypes.string),
]);
var isMinDate = function isMinDate(props, propName, componentName) {
var minDate = props[propName];
if (!minDate) {
return null;
}
if (!(minDate instanceof Date)) {
return new Error(
"Invalid prop `"
.concat(propName, "` of type `")
.concat(_typeof$2(minDate), "` supplied to `")
.concat(componentName, "`, expected instance of `Date`.")
);
}
var maxDate = props.maxDate;
if (maxDate && minDate > maxDate) {
return new Error(
"Invalid prop `"
.concat(propName, "` of type `")
.concat(_typeof$2(minDate), "` supplied to `")
.concat(
componentName,
"`, minDate cannot be larger than maxDate."
)
);
}
return null;
};
var isMaxDate = function isMaxDate(props, propName, componentName) {
var maxDate = props[propName];
if (!maxDate) {
return null;
}
if (!(maxDate instanceof Date)) {
return new Error(
"Invalid prop `"
.concat(propName, "` of type `")
.concat(_typeof$2(maxDate), "` supplied to `")
.concat(componentName, "`, expected instance of `Date`.")
);
}
var minDate = props.minDate;
if (minDate && maxDate < minDate) {
return new Error(
"Invalid prop `"
.concat(propName, "` of type `")
.concat(_typeof$2(maxDate), "` supplied to `")
.concat(
componentName,
"`, maxDate cannot be smaller than minDate."
)
);
}
return null;
};
var isRef = PropTypes.oneOfType([
PropTypes.func,
PropTypes.shape({
current: PropTypes.any,
}),
]);
var isValue = PropTypes.oneOfType([
PropTypes.instanceOf(Date),
PropTypes.arrayOf(PropTypes.instanceOf(Date)),
]);
var isViews = PropTypes.arrayOf(PropTypes.oneOf(allViews$1));
var isView = function isView(props, propName, componentName) {
var view = props[propName];
var views = props.views;
var allowedViews = views || allViews$1;
if (view !== undefined && allowedViews.indexOf(view) === -1) {
return new Error(
"Invalid prop `"
.concat(propName, "` of value `")
.concat(view, "` supplied to `")
.concat(componentName, "`, expected one of [")
.concat(
allowedViews
.map(function (a) {
return '"'.concat(a, '"');
})
.join(", "),
"]."
)
);
} // Everything is fine
return null;
};
isView.isRequired = function (props, propName, componentName) {
var view = props[propName];
if (!view) {
return new Error(
"The prop `"
.concat(propName, "` is marked as required in `")
.concat(componentName, "`, but its value is `")
.concat(view, "`.")
);
}
return isView(props, propName, componentName);
};
var tileGroupProps = {
activeStartDate: PropTypes.instanceOf(Date).isRequired,
hover: PropTypes.instanceOf(Date),
locale: PropTypes.string,
maxDate: isMaxDate,
minDate: isMinDate,
onClick: PropTypes.func,
onMouseOver: PropTypes.func,
tileClassName: PropTypes.oneOfType([PropTypes.func, isClassName]),
tileContent: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
value: isValue,
valueType: PropTypes.string,
};
var tileProps = {
activeStartDate: PropTypes.instanceOf(Date).isRequired,
classes: PropTypes.arrayOf(PropTypes.string).isRequired,
date: PropTypes.instanceOf(Date).isRequired,
locale: PropTypes.string,
maxDate: isMaxDate,
minDate: isMinDate,
onClick: PropTypes.func,
onMouseOver: PropTypes.func,
style: PropTypes.objectOf(
PropTypes.oneOfType([PropTypes.string, PropTypes.number])
),
tileClassName: PropTypes.oneOfType([PropTypes.func, isClassName]),
tileContent: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
tileDisabled: PropTypes.func,
};
var className$5 = "react-calendar__navigation";
function Navigation(_ref) {
var activeStartDate = _ref.activeStartDate,
drillUp = _ref.drillUp,
_ref$formatMonthYear = _ref.formatMonthYear,
formatMonthYear$1 =
_ref$formatMonthYear === void 0
? formatMonthYear
: _ref$formatMonthYear,
_ref$formatYear = _ref.formatYear,
formatYear$1 =
_ref$formatYear === void 0 ? formatYear : _ref$formatYear,
locale = _ref.locale,
maxDate = _ref.maxDate,
minDate = _ref.minDate,
_ref$navigationAriaLa = _ref.navigationAriaLabel,
navigationAriaLabel =
_ref$navigationAriaLa === void 0 ? "" : _ref$navigationAriaLa,
navigationLabel = _ref.navigationLabel,
_ref$next2AriaLabel = _ref.next2AriaLabel,
next2AriaLabel =
_ref$next2AriaLabel === void 0 ? "" : _ref$next2AriaLabel,
_ref$next2Label = _ref.next2Label,
next2Label = _ref$next2Label === void 0 ? "»" : _ref$next2Label,
_ref$nextAriaLabel = _ref.nextAriaLabel,
nextAriaLabel = _ref$nextAriaLabel === void 0 ? "" : _ref$nextAriaLabel,
_ref$nextLabel = _ref.nextLabel,
nextLabel = _ref$nextLabel === void 0 ? "›" : _ref$nextLabel,
_ref$prev2AriaLabel = _ref.prev2AriaLabel,
prev2AriaLabel =
_ref$prev2AriaLabel === void 0 ? "" : _ref$prev2AriaLabel,
_ref$prev2Label = _ref.prev2Label,
prev2Label = _ref$prev2Label === void 0 ? "«" : _ref$prev2Label,
_ref$prevAriaLabel = _ref.prevAriaLabel,
prevAriaLabel = _ref$prevAriaLabel === void 0 ? "" : _ref$prevAriaLabel,
_ref$prevLabel = _ref.prevLabel,
prevLabel = _ref$prevLabel === void 0 ? "‹" : _ref$prevLabel,
setActiveStartDate = _ref.setActiveStartDate,
showDoubleView = _ref.showDoubleView,
view = _ref.view,
views = _ref.views;
var drillUpAvailable = views.indexOf(view) > 0;
var shouldShowPrevNext2Buttons = view !== "century";
var previousActiveStartDate = getBeginPrevious(view, activeStartDate);
var previousActiveStartDate2 =
shouldShowPrevNext2Buttons && getBeginPrevious2(view, activeStartDate);
var nextActiveStartDate = getBeginNext(view, activeStartDate);
var nextActiveStartDate2 =
shouldShowPrevNext2Buttons && getBeginNext2(view, activeStartDate);
var prevButtonDisabled = (function () {
if (previousActiveStartDate.getFullYear() < 0) {
return true;
}
var previousActiveEndDate = getEndPrevious(view, activeStartDate);
return minDate && minDate >= previousActiveEndDate;
})();
var prev2ButtonDisabled =
shouldShowPrevNext2Buttons &&
(function () {
if (previousActiveStartDate2.getFullYear() < 0) {
return true;
}
var previousActiveEndDate = getEndPrevious2(view, activeStartDate);
return minDate && minDate >= previousActiveEndDate;
})();
var nextButtonDisabled = maxDate && maxDate <= nextActiveStartDate;
var next2ButtonDisabled =
shouldShowPrevNext2Buttons &&
maxDate &&
maxDate <= nextActiveStartDate2;
function onClickPrevious() {
setActiveStartDate(previousActiveStartDate);
}
function onClickPrevious2() {
setActiveStartDate(previousActiveStartDate2);
}
function onClickNext() {
setActiveStartDate(nextActiveStartDate);
}
function onClickNext2() {
setActiveStartDate(nextActiveStartDate2);
}
function renderLabel(date) {
var label = (function () {
switch (view) {
case "century":
return getCenturyLabel(locale, formatYear$1, date);
case "decade":
return getDecadeLabel(locale, formatYear$1, date);
case "year":
return formatYear$1(locale, date);
case "month":
return formatMonthYear$1(locale, date);
default:
throw new Error("Invalid view: ".concat(view, "."));
}
})();
return navigationLabel
? navigationLabel({
date: date,
label: label,
locale: locale || getUserLocale(),
view: view,
})
: label;
}
function renderButton() {
var labelClassName = "".concat(className$5, "__label");
return /*#__PURE__*/ React.createElement(
"button",
{
"aria-label": navigationAriaLabel,
className: labelClassName,
disabled: !drillUpAvailable,
onClick: drillUp,
style: {
flexGrow: 1,
},
type: "button",
},
/*#__PURE__*/ React.createElement(
"span",
{
className: ""
.concat(labelClassName, "__labelText ")
.concat(labelClassName, "__labelText--from"),
},
renderLabel(activeStartDate)
),
showDoubleView &&
/*#__PURE__*/ React.createElement(
React.Fragment,
null,
/*#__PURE__*/ React.createElement(
"span",
{
className: "".concat(labelClassName, "__divider"),
},
" ",
"\u2013",
" "
),
/*#__PURE__*/ React.createElement(
"span",
{
className: ""
.concat(labelClassName, "__labelText ")
.concat(labelClassName, "__labelText--to"),
},
renderLabel(nextActiveStartDate)
)
)
);
}
return /*#__PURE__*/ React.createElement(
"div",
{
className: className$5,
style: {
display: "flex",
},
},
prev2Label !== null &&
shouldShowPrevNext2Buttons &&
/*#__PURE__*/ React.createElement(
"button",
{
"aria-label": prev2AriaLabel,
className: ""
.concat(className$5, "__arrow ")
.concat(className$5, "__prev2-button"),
disabled: prev2ButtonDisabled,
onClick: onClickPrevious2,
type: "button",
},
prev2Label
),
prevLabel !== null &&
/*#__PURE__*/ React.createElement(
"button",
{
"aria-label": prevAriaLabel,
className: ""
.concat(className$5, "__arrow ")
.concat(className$5, "__prev-button"),
disabled: prevButtonDisabled,
onClick: onClickPrevious,
type: "button",
},
prevLabel
),
renderButton(),
nextLabel !== null &&
/*#__PURE__*/ React.createElement(
"button",
{
"aria-label": nextAriaLabel,
className: ""
.concat(className$5, "__arrow ")
.concat(className$5, "__next-button"),
disabled: nextButtonDisabled,
onClick: onClickNext,
type: "button",
},
nextLabel
),
next2Label !== null &&
shouldShowPrevNext2Buttons &&
/*#__PURE__*/ React.createElement(
"button",
{
"aria-label": next2AriaLabel,
className: ""
.concat(className$5, "__arrow ")
.concat(className$5, "__next2-button"),
disabled: next2ButtonDisabled,
onClick: onClickNext2,
type: "button",
},
next2Label
)
);
}
Navigation.propTypes = {
activeStartDate: PropTypes.instanceOf(Date).isRequired,
drillUp: PropTypes.func.isRequired,
formatMonthYear: PropTypes.func,
formatYear: PropTypes.func,
locale: PropTypes.string,
maxDate: PropTypes.instanceOf(Date),
minDate: PropTypes.instanceOf(Date),
navigationAriaLabel: PropTypes.string,
navigationLabel: PropTypes.func,
next2AriaLabel: PropTypes.string,
next2Label: PropTypes.node,
nextAriaLabel: PropTypes.string,
nextLabel: PropTypes.node,
prev2AriaLabel: PropTypes.string,
prev2Label: PropTypes.node,
prevAriaLabel: PropTypes.string,
prevLabel: PropTypes.node,
setActiveStartDate: PropTypes.func.isRequired,
showDoubleView: PropTypes.bool,
view: isView.isRequired,
views: isViews.isRequired,
};
function _extends$c() {
_extends$c =
Object.assign ||
function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends$c.apply(this, arguments);
}
function ownKeys$b(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly)
symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread$b(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys$b(Object(source), true).forEach(function (key) {
_defineProperty$b(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(
target,
Object.getOwnPropertyDescriptors(source)
);
} else {
ownKeys$b(Object(source)).forEach(function (key) {
Object.defineProperty(
target,
key,
Object.getOwnPropertyDescriptor(source, key)
);
});
}
}
return target;
}
function _defineProperty$b(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true,
});
} else {
obj[key] = value;
}
return obj;
}
function _objectWithoutProperties$8(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose$8(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key))
continue;
target[key] = source[key];
}
}
return target;
}
function _objectWithoutPropertiesLoose$8(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
function toPercent(num) {
return "".concat(num, "%");
}
function Flex(_ref) {
var children = _ref.children,
className = _ref.className,
direction = _ref.direction,
count = _ref.count,
offset = _ref.offset,
style = _ref.style,
wrap = _ref.wrap,
otherProps = _objectWithoutProperties$8(_ref, [
"children",
"className",
"direction",
"count",
"offset",
"style",
"wrap",
]);
return /*#__PURE__*/ React.createElement(
"div",
_extends$c(
{
className: className,
style: _objectSpread$b(
{
display: "flex",
flexDirection: direction,
flexWrap: wrap ? "wrap" : "no-wrap",
},
style
),
},
otherProps
),
React.Children.map(children, function (child, index) {
return /*#__PURE__*/ React.cloneElement(
child,
_objectSpread$b(
_objectSpread$b({}, child.props),
{},
{
style: {
flexBasis: toPercent(100 / count),
maxWidth: toPercent(100 / count),
overflow: "hidden",
marginLeft:
offset && index === 0
? toPercent((100 * offset) / count)
: null,
},
}
)
);
})
);
}
Flex.propTypes = {
children: PropTypes.node,
className: PropTypes.string,
count: PropTypes.number.isRequired,
direction: PropTypes.string,
offset: PropTypes.number,
style: PropTypes.objectOf(
PropTypes.oneOfType([PropTypes.string, PropTypes.number])
),
wrap: PropTypes.bool,
};
function _toConsumableArray$1(arr) {
return (
_arrayWithoutHoles$1(arr) ||
_iterableToArray$1(arr) ||
_unsupportedIterableToArray$1(arr) ||
_nonIterableSpread$1()
);
}
function _nonIterableSpread$1() {
throw new TypeError(
"Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."
);
}
function _unsupportedIterableToArray$1(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
return _arrayLikeToArray$1(o, minLen);
}
function _iterableToArray$1(iter) {
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter))
return Array.from(iter);
}
function _arrayWithoutHoles$1(arr) {
if (Array.isArray(arr)) return _arrayLikeToArray$1(arr);
}
function _arrayLikeToArray$1(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) {
arr2[i] = arr[i];
}
return arr2;
}
/**
* Returns a value no smaller than min and no larger than max.
*
* @param {*} value Value to return.
* @param {*} min Minimum return value.
* @param {*} max Maximum return value.
*/
function between(value, min, max) {
if (min && min > value) {
return min;
}
if (max && max < value) {
return max;
}
return value;
}
function isValueWithinRange(value, range) {
return range[0] <= value && range[1] >= value;
}
function isRangeWithinRange(greaterRange, smallerRange) {
return (
greaterRange[0] <= smallerRange[0] && greaterRange[1] >= smallerRange[1]
);
}
function doRangesOverlap(range1, range2) {
return (
isValueWithinRange(range1[0], range2) ||
isValueWithinRange(range1[1], range2)
);
}
function getRangeClassNames(valueRange, dateRange, baseClassName) {
var isRange = doRangesOverlap(dateRange, valueRange);
var classes = [];
if (isRange) {
classes.push(baseClassName);
var isRangeStart = isValueWithinRange(valueRange[0], dateRange);
var isRangeEnd = isValueWithinRange(valueRange[1], dateRange);
if (isRangeStart) {
classes.push("".concat(baseClassName, "Start"));
}
if (isRangeEnd) {
classes.push("".concat(baseClassName, "End"));
}
if (isRangeStart && isRangeEnd) {
classes.push("".concat(baseClassName, "BothEnds"));
}
}
return classes;
}
function getTileClasses() {
var _ref =
arguments.length > 0 && arguments[0] !== undefined
? arguments[0]
: {},
value = _ref.value,
valueType = _ref.valueType,
date = _ref.date,
dateType = _ref.dateType,
hover = _ref.hover;
var className = "react-calendar__tile";
var classes = [className];
if (!date) {
return classes;
}
if (!Array.isArray(date) && !dateType) {
throw new Error(
"getTileClasses(): Unable to get tile activity classes because one or more required arguments were not passed."
);
}
var now = new Date();
var dateRange = Array.isArray(date) ? date : getRange(dateType, date);
if (isValueWithinRange(now, dateRange)) {
classes.push("".concat(className, "--now"));
}
if (!value) {
return classes;
}
if (!Array.isArray(value) && !valueType) {
throw new Error(
"getTileClasses(): Unable to get tile activity classes because one or more required arguments were not passed."
);
}
var valueRange = Array.isArray(value) ? value : getRange(valueType, value);
if (isRangeWithinRange(valueRange, dateRange)) {
classes.push("".concat(className, "--active"));
} else if (doRangesOverlap(valueRange, dateRange)) {
classes.push("".concat(className, "--hasActive"));
}
var valueRangeClassNames = getRangeClassNames(
valueRange,
dateRange,
"".concat(className, "--range")
);
classes.push.apply(classes, _toConsumableArray$1(valueRangeClassNames));
if (hover) {
var hoverRange =
hover > valueRange[1]
? [valueRange[1], hover]
: [hover, valueRange[0]];
var hoverRangeClassNames = getRangeClassNames(
hoverRange,
dateRange,
"".concat(className, "--hover")
);
classes.push.apply(classes, _toConsumableArray$1(hoverRangeClassNames));
}
return classes;
}
function ownKeys$a(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly)
symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread$a(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys$a(Object(source), true).forEach(function (key) {
_defineProperty$a(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(
target,
Object.getOwnPropertyDescriptors(source)
);
} else {
ownKeys$a(Object(source)).forEach(function (key) {
Object.defineProperty(
target,
key,
Object.getOwnPropertyDescriptor(source, key)
);
});
}
}
return target;
}
function _defineProperty$a(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true,
});
} else {
obj[key] = value;
}
return obj;
}
function _extends$b() {
_extends$b =
Object.assign ||
function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends$b.apply(this, arguments);
}
function _objectWithoutProperties$7(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose$7(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key))
continue;
target[key] = source[key];
}
}
return target;
}
function _objectWithoutPropertiesLoose$7(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
function TileGroup(_ref) {
var className = _ref.className,
_ref$count = _ref.count,
count = _ref$count === void 0 ? 3 : _ref$count,
dateTransform = _ref.dateTransform,
dateType = _ref.dateType,
end = _ref.end,
hover = _ref.hover,
offset = _ref.offset,
start = _ref.start,
_ref$step = _ref.step,
step = _ref$step === void 0 ? 1 : _ref$step,
Tile = _ref.tile,
value = _ref.value,
valueType = _ref.valueType,
tileProps = _objectWithoutProperties$7(_ref, [
"className",
"count",
"dateTransform",
"dateType",
"end",
"hover",
"offset",
"start",
"step",
"tile",
"value",
"valueType",
]);
var tiles = [];
for (var point = start; point <= end; point += step) {
var date = dateTransform(point);
tiles.push(
/*#__PURE__*/ React.createElement(
Tile,
_extends$b(
{
key: date.getTime(),
classes: getTileClasses({
value: value,
valueType: valueType,
date: date,
dateType: dateType,
hover: hover,
}),
date: date,
point: point,
},
tileProps
)
)
);
}
return /*#__PURE__*/ React.createElement(
Flex,
{
className: className,
count: count,
offset: offset,
wrap: true,
},
tiles
);
}
TileGroup.propTypes = _objectSpread$a(
_objectSpread$a({}, tileGroupProps),
{},
{
activeStartDate: PropTypes.instanceOf(Date),
count: PropTypes.number,
dateTransform: PropTypes.func.isRequired,
dateType: PropTypes.string,
offset: PropTypes.number,
step: PropTypes.number,
tile: PropTypes.func.isRequired,
}
);
function ownKeys$9(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly)
symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread$9(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys$9(Object(source), true).forEach(function (key) {
_defineProperty$9(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(
target,
Object.getOwnPropertyDescriptors(source)
);
} else {
ownKeys$9(Object(source)).forEach(function (key) {
Object.defineProperty(
target,
key,
Object.getOwnPropertyDescriptor(source, key)
);
});
}
}
return target;
}
function _typeof$1(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof$1 = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof$1 = function _typeof(obj) {
return obj &&
typeof Symbol === "function" &&
obj.constructor === Symbol &&
obj !== Symbol.prototype
? "symbol"
: typeof obj;
};
}
return _typeof$1(obj);
}
function _classCallCheck$1(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties$1(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass$1(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
if (staticProps) _defineProperties$1(Constructor, staticProps);
return Constructor;
}
function _inherits$1(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError(
"Super expression must either be null or a function"
);
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true,
},
});
if (superClass) _setPrototypeOf$1(subClass, superClass);
}
function _setPrototypeOf$1(o, p) {
_setPrototypeOf$1 =
Object.setPrototypeOf ||
function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf$1(o, p);
}
function _createSuper$1(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct$1();
return function _createSuperInternal() {
var Super = _getPrototypeOf$1(Derived),
result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf$1(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn$1(this, result);
};
}
function _possibleConstructorReturn$1(self, call) {
if (call && (_typeof$1(call) === "object" || typeof call === "function")) {
return call;
}
return _assertThisInitialized$1(self);
}
function _assertThisInitialized$1(self) {
if (self === void 0) {
throw new ReferenceError(
"this hasn't been initialised - super() hasn't been called"
);
}
return self;
}
function _isNativeReflectConstruct$1() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Date.prototype.toString.call(
Reflect.construct(Date, [], function () {})
);
return true;
} catch (e) {
return false;
}
}
function _getPrototypeOf$1(o) {
_getPrototypeOf$1 = Object.setPrototypeOf
? Object.getPrototypeOf
: function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf$1(o);
}
function _defineProperty$9(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true,
});
} else {
obj[key] = value;
}
return obj;
}
function getValue$1(nextProps, prop) {
var activeStartDate = nextProps.activeStartDate,
date = nextProps.date,
view = nextProps.view;
return typeof prop === "function"
? prop({
activeStartDate: activeStartDate,
date: date,
view: view,
})
: prop;
}
var Tile = /*#__PURE__*/ (function (_Component) {
_inherits$1(Tile, _Component);
var _super = _createSuper$1(Tile);
function Tile() {
var _this;
_classCallCheck$1(this, Tile);
for (
var _len = arguments.length, args = new Array(_len), _key = 0;
_key < _len;
_key++
) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty$9(_assertThisInitialized$1(_this), "state", {});
return _this;
}
_createClass$1(
Tile,
[
{
key: "render",
value: function render() {
var _this$props = this.props,
activeStartDate = _this$props.activeStartDate,
children = _this$props.children,
classes = _this$props.classes,
date = _this$props.date,
formatAbbr = _this$props.formatAbbr,
locale = _this$props.locale,
maxDate = _this$props.maxDate,
maxDateTransform = _this$props.maxDateTransform,
minDate = _this$props.minDate,
minDateTransform = _this$props.minDateTransform,
onClick = _this$props.onClick,
onMouseOver = _this$props.onMouseOver,
style = _this$props.style,
tileDisabled = _this$props.tileDisabled,
view = _this$props.view;
var _this$state = this.state,
tileClassName = _this$state.tileClassName,
tileContent = _this$state.tileContent;
return /*#__PURE__*/ React.createElement(
"button",
{
className: mergeClassNames(classes, tileClassName),
disabled:
(minDate && minDateTransform(minDate) > date) ||
(maxDate && maxDateTransform(maxDate) < date) ||
(tileDisabled &&
tileDisabled({
activeStartDate: activeStartDate,
date: date,
view: view,
})),
onClick:
onClick &&
function (event) {
return onClick(date, event);
},
onFocus:
onMouseOver &&
function () {
return onMouseOver(date);
},
onMouseOver:
onMouseOver &&
function () {
return onMouseOver(date);
},
style: style,
type: "button",
},
formatAbbr
? /*#__PURE__*/ React.createElement(
"abbr",
{
"aria-label": formatAbbr(locale, date),
},
children
)
: children,
tileContent
);
},
},
],
[
{
key: "getDerivedStateFromProps",
value: function getDerivedStateFromProps(nextProps, prevState) {
var tileClassName = nextProps.tileClassName,
tileContent = nextProps.tileContent;
var nextState = {};
if (tileClassName !== prevState.tileClassNameProps) {
nextState.tileClassName = getValue$1(
nextProps,
tileClassName
);
nextState.tileClassNameProps = tileClassName;
}
if (tileContent !== prevState.tileContentProps) {
nextState.tileContent = getValue$1(
nextProps,
tileContent
);
nextState.tileContentProps = tileContent;
}
return nextState;
},
},
]
);
return Tile;
})(_);
Tile.propTypes = _objectSpread$9(
_objectSpread$9({}, tileProps),
{},
{
children: PropTypes.node.isRequired,
formatAbbr: PropTypes.func,
maxDateTransform: PropTypes.func.isRequired,
minDateTransform: PropTypes.func.isRequired,
}
);
function ownKeys$8(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly)
symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread$8(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys$8(Object(source), true).forEach(function (key) {
_defineProperty$8(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(
target,
Object.getOwnPropertyDescriptors(source)
);
} else {
ownKeys$8(Object(source)).forEach(function (key) {
Object.defineProperty(
target,
key,
Object.getOwnPropertyDescriptor(source, key)
);
});
}
}
return target;
}
function _defineProperty$8(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true,
});
} else {
obj[key] = value;
}
return obj;
}
function _extends$a() {
_extends$a =
Object.assign ||
function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends$a.apply(this, arguments);
}
function _objectWithoutProperties$6(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose$6(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key))
continue;
target[key] = source[key];
}
}
return target;
}
function _objectWithoutPropertiesLoose$6(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
var className$4 = "react-calendar__century-view__decades__decade";
function Decade(_ref) {
var classes = _ref.classes,
_ref$formatYear = _ref.formatYear,
formatYear$1 =
_ref$formatYear === void 0 ? formatYear : _ref$formatYear,
otherProps = _objectWithoutProperties$6(_ref, [
"classes",
"formatYear",
]);
var date = otherProps.date,
locale = otherProps.locale;
return /*#__PURE__*/ React.createElement(
Tile,
_extends$a({}, otherProps, {
classes: [].concat(classes, className$4),
maxDateTransform: getDecadeEnd,
minDateTransform: getDecadeStart,
view: "century",
}),
getDecadeLabel(locale, formatYear$1, date)
);
}
Decade.propTypes = _objectSpread$8(
_objectSpread$8({}, tileProps),
{},
{
formatYear: PropTypes.func,
}
);
function ownKeys$7(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly)
symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread$7(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys$7(Object(source), true).forEach(function (key) {
_defineProperty$7(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(
target,
Object.getOwnPropertyDescriptors(source)
);
} else {
ownKeys$7(Object(source)).forEach(function (key) {
Object.defineProperty(
target,
key,
Object.getOwnPropertyDescriptor(source, key)
);
});
}
}
return target;
}
function _defineProperty$7(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true,
});
} else {
obj[key] = value;
}
return obj;
}
function _extends$9() {
_extends$9 =
Object.assign ||
function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends$9.apply(this, arguments);
}
function Decades(props) {
var activeStartDate = props.activeStartDate;
var start = getBeginOfCenturyYear(activeStartDate);
var end = start + 99;
return /*#__PURE__*/ React.createElement(
TileGroup,
_extends$9({}, props, {
className: "react-calendar__century-view__decades",
dateTransform: getDecadeStart,
dateType: "decade",
end: end,
start: start,
step: 10,
tile: Decade,
})
);
}
Decades.propTypes = _objectSpread$7({}, tileGroupProps);
function CenturyView(props) {
function renderDecades() {
return /*#__PURE__*/ React.createElement(Decades, props);
}
return /*#__PURE__*/ React.createElement(
"div",
{
className: "react-calendar__century-view",
},
renderDecades()
);
}
function ownKeys$6(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly)
symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread$6(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys$6(Object(source), true).forEach(function (key) {
_defineProperty$6(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(
target,
Object.getOwnPropertyDescriptors(source)
);
} else {
ownKeys$6(Object(source)).forEach(function (key) {
Object.defineProperty(
target,
key,
Object.getOwnPropertyDescriptor(source, key)
);
});
}
}
return target;
}
function _defineProperty$6(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true,
});
} else {
obj[key] = value;
}
return obj;
}
function _extends$8() {
_extends$8 =
Object.assign ||
function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends$8.apply(this, arguments);
}
function _objectWithoutProperties$5(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose$5(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key))
continue;
target[key] = source[key];
}
}
return target;
}
function _objectWithoutPropertiesLoose$5(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
var className$3 = "react-calendar__decade-view__years__year";
function Year(_ref) {
var classes = _ref.classes,
_ref$formatYear = _ref.formatYear,
formatYear$1 =
_ref$formatYear === void 0 ? formatYear : _ref$formatYear,
otherProps = _objectWithoutProperties$5(_ref, [
"classes",
"formatYear",
]);
var date = otherProps.date,
locale = otherProps.locale;
return /*#__PURE__*/ React.createElement(
Tile,
_extends$8({}, otherProps, {
classes: [].concat(classes, className$3),
maxDateTransform: getYearEnd,
minDateTransform: getYearStart,
view: "decade",
}),
formatYear$1(locale, date)
);
}
Year.propTypes = _objectSpread$6(
_objectSpread$6({}, tileProps),
{},
{
formatYear: PropTypes.func,
}
);
function ownKeys$5(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly)
symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread$5(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys$5(Object(source), true).forEach(function (key) {
_defineProperty$5(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(
target,
Object.getOwnPropertyDescriptors(source)
);
} else {
ownKeys$5(Object(source)).forEach(function (key) {
Object.defineProperty(
target,
key,
Object.getOwnPropertyDescriptor(source, key)
);
});
}
}
return target;
}
function _defineProperty$5(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true,
});
} else {
obj[key] = value;
}
return obj;
}
function _extends$7() {
_extends$7 =
Object.assign ||
function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends$7.apply(this, arguments);
}
function Years(props) {
var activeStartDate = props.activeStartDate;
var start = getBeginOfDecadeYear(activeStartDate);
var end = start + 9;
return /*#__PURE__*/ React.createElement(
TileGroup,
_extends$7({}, props, {
className: "react-calendar__decade-view__years",
dateTransform: function dateTransform(year) {
var date = new Date();
date.setFullYear(year, 0, 1);
date.setHours(0, 0, 0, 0);
return date;
},
dateType: "year",
end: end,
start: start,
tile: Year,
})
);
}
Years.propTypes = _objectSpread$5({}, tileGroupProps);
function DecadeView(props) {
function renderYears() {
return /*#__PURE__*/ React.createElement(Years, props);
}
return /*#__PURE__*/ React.createElement(
"div",
{
className: "react-calendar__decade-view",
},
renderYears()
);
}
function ownKeys$4(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly)
symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread$4(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys$4(Object(source), true).forEach(function (key) {
_defineProperty$4(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(
target,
Object.getOwnPropertyDescriptors(source)
);
} else {
ownKeys$4(Object(source)).forEach(function (key) {
Object.defineProperty(
target,
key,
Object.getOwnPropertyDescriptor(source, key)
);
});
}
}
return target;
}
function _defineProperty$4(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true,
});
} else {
obj[key] = value;
}
return obj;
}
function _extends$6() {
_extends$6 =
Object.assign ||
function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends$6.apply(this, arguments);
}
function _objectWithoutProperties$4(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose$4(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key))
continue;
target[key] = source[key];
}
}
return target;
}
function _objectWithoutPropertiesLoose$4(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
var className$2 = "react-calendar__year-view__months__month";
function Month(_ref) {
var classes = _ref.classes,
_ref$formatMonth = _ref.formatMonth,
formatMonth$1 =
_ref$formatMonth === void 0 ? formatMonth : _ref$formatMonth,
_ref$formatMonthYear = _ref.formatMonthYear,
formatMonthYear$1 =
_ref$formatMonthYear === void 0
? formatMonthYear
: _ref$formatMonthYear,
otherProps = _objectWithoutProperties$4(_ref, [
"classes",
"formatMonth",
"formatMonthYear",
]);
var date = otherProps.date,
locale = otherProps.locale;
return /*#__PURE__*/ React.createElement(
Tile,
_extends$6({}, otherProps, {
classes: [].concat(classes, className$2),
formatAbbr: formatMonthYear$1,
maxDateTransform: getMonthEnd,
minDateTransform: getMonthStart,
view: "year",
}),
formatMonth$1(locale, date)
);
}
Month.propTypes = _objectSpread$4(
_objectSpread$4({}, tileProps),
{},
{
formatMonth: PropTypes.func,
formatMonthYear: PropTypes.func,
}
);
function ownKeys$3(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly)
symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread$3(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys$3(Object(source), true).forEach(function (key) {
_defineProperty$3(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(
target,
Object.getOwnPropertyDescriptors(source)
);
} else {
ownKeys$3(Object(source)).forEach(function (key) {
Object.defineProperty(
target,
key,
Object.getOwnPropertyDescriptor(source, key)
);
});
}
}
return target;
}
function _defineProperty$3(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true,
});
} else {
obj[key] = value;
}
return obj;
}
function _extends$5() {
_extends$5 =
Object.assign ||
function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends$5.apply(this, arguments);
}
function Months(props) {
var activeStartDate = props.activeStartDate;
var start = 0;
var end = 11;
var year = getYear(activeStartDate);
return /*#__PURE__*/ React.createElement(
TileGroup,
_extends$5({}, props, {
className: "react-calendar__year-view__months",
dateTransform: function dateTransform(monthIndex) {
var date = new Date();
date.setFullYear(year, monthIndex, 1);
date.setHours(0, 0, 0, 0);
return date;
},
dateType: "month",
end: end,
start: start,
tile: Month,
})
);
}
Months.propTypes = _objectSpread$3(
_objectSpread$3({}, tileGroupProps),
{},
{
locale: PropTypes.string,
}
);
function YearView(props) {
function renderMonths() {
return /*#__PURE__*/ React.createElement(Months, props);
}
return /*#__PURE__*/ React.createElement(
"div",
{
className: "react-calendar__year-view",
},
renderMonths()
);
}
function ownKeys$2(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly)
symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread$2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys$2(Object(source), true).forEach(function (key) {
_defineProperty$2(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(
target,
Object.getOwnPropertyDescriptors(source)
);
} else {
ownKeys$2(Object(source)).forEach(function (key) {
Object.defineProperty(
target,
key,
Object.getOwnPropertyDescriptor(source, key)
);
});
}
}
return target;
}
function _defineProperty$2(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true,
});
} else {
obj[key] = value;
}
return obj;
}
function _extends$4() {
_extends$4 =
Object.assign ||
function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends$4.apply(this, arguments);
}
function _objectWithoutProperties$3(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose$3(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key))
continue;
target[key] = source[key];
}
}
return target;
}
function _objectWithoutPropertiesLoose$3(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
var className$1 = "react-calendar__month-view__days__day";
function Day(_ref) {
var _ref$formatDay = _ref.formatDay,
formatDay$1 = _ref$formatDay === void 0 ? formatDay : _ref$formatDay,
_ref$formatLongDate = _ref.formatLongDate,
formatLongDate$1 =
_ref$formatLongDate === void 0
? formatLongDate
: _ref$formatLongDate,
calendarType = _ref.calendarType,
classes = _ref.classes,
currentMonthIndex = _ref.currentMonthIndex,
otherProps = _objectWithoutProperties$3(_ref, [
"formatDay",
"formatLongDate",
"calendarType",
"classes",
"currentMonthIndex",
]);
var date = otherProps.date,
locale = otherProps.locale;
return /*#__PURE__*/ React.createElement(
Tile,
_extends$4({}, otherProps, {
classes: [].concat(
classes,
className$1,
isWeekend(date, calendarType)
? "".concat(className$1, "--weekend")
: null,
date.getMonth() !== currentMonthIndex
? "".concat(className$1, "--neighboringMonth")
: null
),
formatAbbr: formatLongDate$1,
maxDateTransform: getDayEnd,
minDateTransform: getDayStart,
view: "month",
}),
formatDay$1(locale, date)
);
}
Day.propTypes = _objectSpread$2(
_objectSpread$2({}, tileProps),
{},
{
currentMonthIndex: PropTypes.number.isRequired,
formatDay: PropTypes.func,
formatLongDate: PropTypes.func,
}
);
function ownKeys$1(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly)
symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread$1(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys$1(Object(source), true).forEach(function (key) {
_defineProperty$1(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(
target,
Object.getOwnPropertyDescriptors(source)
);
} else {
ownKeys$1(Object(source)).forEach(function (key) {
Object.defineProperty(
target,
key,
Object.getOwnPropertyDescriptor(source, key)
);
});
}
}
return target;
}
function _defineProperty$1(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true,
});
} else {
obj[key] = value;
}
return obj;
}
function _extends$3() {
_extends$3 =
Object.assign ||
function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends$3.apply(this, arguments);
}
function _objectWithoutProperties$2(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose$2(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key))
continue;
target[key] = source[key];
}
}
return target;
}
function _objectWithoutPropertiesLoose$2(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
function Days(props) {
var activeStartDate = props.activeStartDate,
calendarType = props.calendarType;
var showFixedNumberOfWeeks = props.showFixedNumberOfWeeks,
showNeighboringMonth = props.showNeighboringMonth,
otherProps = _objectWithoutProperties$2(props, [
"showFixedNumberOfWeeks",
"showNeighboringMonth",
]);
var year = getYear(activeStartDate);
var monthIndex = getMonth(activeStartDate);
var hasFixedNumberOfWeeks = showFixedNumberOfWeeks || showNeighboringMonth;
var dayOfWeek = getDayOfWeek(activeStartDate, calendarType);
var offset = hasFixedNumberOfWeeks ? 0 : dayOfWeek;
/**
* Defines on which day of the month the grid shall start. If we simply show current
* month, we obviously start on day one, but if showNeighboringMonth is set to
* true, we need to find the beginning of the week the first day of the month is in.
*/
var start = (hasFixedNumberOfWeeks ? -dayOfWeek : 0) + 1;
/**
* Defines on which day of the month the grid shall end. If we simply show current
* month, we need to stop on the last day of the month, but if showNeighboringMonth
* is set to true, we need to find the end of the week the last day of the month is in.
*/
var end = (function () {
if (showFixedNumberOfWeeks) {
// Always show 6 weeks
return start + 6 * 7 - 1;
}
var daysInMonth = getDaysInMonth(activeStartDate);
if (showNeighboringMonth) {
var activeEndDate = new Date();
activeEndDate.setFullYear(year, monthIndex, daysInMonth);
activeEndDate.setHours(0, 0, 0, 0);
var daysUntilEndOfTheWeek =
7 - getDayOfWeek(activeEndDate, calendarType) - 1;
return daysInMonth + daysUntilEndOfTheWeek;
}
return daysInMonth;
})();
return /*#__PURE__*/ React.createElement(
TileGroup,
_extends$3({}, otherProps, {
className: "react-calendar__month-view__days",
count: 7,
currentMonthIndex: monthIndex,
dateTransform: function dateTransform(day) {
var date = new Date();
date.setFullYear(year, monthIndex, day);
date.setHours(0, 0, 0, 0);
return date;
},
dateType: "day",
end: end,
offset: offset,
start: start,
tile: Day,
})
);
}
Days.propTypes = _objectSpread$1(
{
calendarType: isCalendarType.isRequired,
showFixedNumberOfWeeks: PropTypes.bool,
showNeighboringMonth: PropTypes.bool,
},
tileGroupProps
);
var className = "react-calendar__month-view__weekdays";
function Weekdays(props) {
var calendarType = props.calendarType,
_props$formatShortWee = props.formatShortWeekday,
formatShortWeekday$1 =
_props$formatShortWee === void 0
? formatShortWeekday
: _props$formatShortWee,
locale = props.locale,
onMouseLeave = props.onMouseLeave;
var anyDate = new Date();
var beginOfMonth = getMonthStart(anyDate);
var year = getYear(beginOfMonth);
var monthIndex = getMonth(beginOfMonth);
var weekdays = [];
for (var weekday = 1; weekday <= 7; weekday += 1) {
var weekdayDate = new Date(
year,
monthIndex,
weekday - getDayOfWeek(beginOfMonth, calendarType)
);
var abbr = formatWeekday(locale, weekdayDate);
weekdays.push(
/*#__PURE__*/ React.createElement(
"div",
{
key: weekday,
className: "".concat(className, "__weekday"),
},
/*#__PURE__*/ React.createElement(
"abbr",
{
"aria-label": abbr,
title: abbr,
},
formatShortWeekday$1(locale, weekdayDate).replace(".", "")
)
)
);
}
return /*#__PURE__*/ React.createElement(
Flex,
{
className: className,
count: 7,
onFocus: onMouseLeave,
onMouseOver: onMouseLeave,
},
weekdays
);
}
Weekdays.propTypes = {
calendarType: isCalendarType.isRequired,
formatShortWeekday: PropTypes.func,
locale: PropTypes.string,
onMouseLeave: PropTypes.func,
};
function _extends$2() {
_extends$2 =
Object.assign ||
function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends$2.apply(this, arguments);
}
function WeekNumber(_ref) {
var date = _ref.date,
onClickWeekNumber = _ref.onClickWeekNumber,
weekNumber = _ref.weekNumber;
var props = {
className: "react-calendar__tile",
style: {
flexGrow: 1,
},
};
var children = /*#__PURE__*/ React.createElement("span", null, weekNumber);
return onClickWeekNumber
? /*#__PURE__*/ React.createElement(
"button",
_extends$2({}, props, {
onClick: function onClick(event) {
return onClickWeekNumber(weekNumber, date, event);
},
type: "button",
}),
children
)
: /*#__PURE__*/ React.createElement("div", props, children);
}
WeekNumber.propTypes = {
date: PropTypes.instanceOf(Date).isRequired,
onClickWeekNumber: PropTypes.func,
weekNumber: PropTypes.node.isRequired,
};
function WeekNumbers(props) {
var activeStartDate = props.activeStartDate,
calendarType = props.calendarType,
onClickWeekNumber = props.onClickWeekNumber,
onMouseLeave = props.onMouseLeave,
showFixedNumberOfWeeks = props.showFixedNumberOfWeeks;
var numberOfWeeks = (function () {
if (showFixedNumberOfWeeks) {
return 6;
}
var numberOfDays = getDaysInMonth(activeStartDate);
var startWeekday = getDayOfWeek(activeStartDate, calendarType);
var days = numberOfDays - (7 - startWeekday);
return 1 + Math.ceil(days / 7);
})();
var dates = (function () {
var year = getYear(activeStartDate);
var monthIndex = getMonth(activeStartDate);
var day = getDate(activeStartDate);
var result = [];
for (var index = 0; index < numberOfWeeks; index += 1) {
result.push(
getBeginOfWeek(
new Date(year, monthIndex, day + index * 7),
calendarType
)
);
}
return result;
})();
var weekNumbers = dates.map(function (date) {
return getWeekNumber(date, calendarType);
});
return /*#__PURE__*/ React.createElement(
Flex,
{
className: "react-calendar__month-view__weekNumbers",
count: numberOfWeeks,
direction: "column",
onFocus: onMouseLeave,
onMouseOver: onMouseLeave,
style: {
flexBasis: "calc(100% * (1 / 8)",
flexShrink: 0,
},
},
weekNumbers.map(function (weekNumber, weekIndex) {
return /*#__PURE__*/ React.createElement(WeekNumber, {
key: weekNumber,
date: dates[weekIndex],
onClickWeekNumber: onClickWeekNumber,
weekNumber: weekNumber,
});
})
);
}
WeekNumbers.propTypes = {
activeStartDate: PropTypes.instanceOf(Date).isRequired,
calendarType: isCalendarType.isRequired,
onClickWeekNumber: PropTypes.func,
onMouseLeave: PropTypes.func,
showFixedNumberOfWeeks: PropTypes.bool,
};
function _extends$1() {
_extends$1 =
Object.assign ||
function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends$1.apply(this, arguments);
}
function _objectWithoutProperties$1(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose$1(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key))
continue;
target[key] = source[key];
}
}
return target;
}
function _objectWithoutPropertiesLoose$1(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
function getCalendarTypeFromLocale(locale) {
return (
Object.keys(CALENDAR_TYPE_LOCALES).find(function (calendarType) {
return CALENDAR_TYPE_LOCALES[calendarType].includes(locale);
}) || CALENDAR_TYPES.ISO_8601
);
}
function MonthView(props) {
var activeStartDate = props.activeStartDate,
locale = props.locale,
onMouseLeave = props.onMouseLeave,
showFixedNumberOfWeeks = props.showFixedNumberOfWeeks;
var _props$calendarType = props.calendarType,
calendarType =
_props$calendarType === void 0
? getCalendarTypeFromLocale(locale)
: _props$calendarType,
formatShortWeekday = props.formatShortWeekday,
onClickWeekNumber = props.onClickWeekNumber,
showWeekNumbers = props.showWeekNumbers,
childProps = _objectWithoutProperties$1(props, [
"calendarType",
"formatShortWeekday",
"onClickWeekNumber",
"showWeekNumbers",
]);
function renderWeekdays() {
return /*#__PURE__*/ React.createElement(Weekdays, {
calendarType: calendarType,
formatShortWeekday: formatShortWeekday,
locale: locale,
onMouseLeave: onMouseLeave,
});
}
function renderWeekNumbers() {
if (!showWeekNumbers) {
return null;
}
return /*#__PURE__*/ React.createElement(WeekNumbers, {
activeStartDate: activeStartDate,
calendarType: calendarType,
onClickWeekNumber: onClickWeekNumber,
onMouseLeave: onMouseLeave,
showFixedNumberOfWeeks: showFixedNumberOfWeeks,
});
}
function renderDays() {
return /*#__PURE__*/ React.createElement(
Days,
_extends$1(
{
calendarType: calendarType,
},
childProps
)
);
}
var className = "react-calendar__month-view";
return /*#__PURE__*/ React.createElement(
"div",
{
className: mergeClassNames(
className,
showWeekNumbers ? "".concat(className, "--weekNumbers") : ""
),
},
/*#__PURE__*/ React.createElement(
"div",
{
style: {
display: "flex",
alignItems: "flex-end",
},
},
renderWeekNumbers(),
/*#__PURE__*/ React.createElement(
"div",
{
style: {
flexGrow: 1,
width: "100%",
},
},
renderWeekdays(),
renderDays()
)
)
);
}
MonthView.propTypes = {
activeStartDate: PropTypes.instanceOf(Date).isRequired,
calendarType: isCalendarType,
formatShortWeekday: PropTypes.func,
locale: PropTypes.string,
onClickWeekNumber: PropTypes.func,
onMouseLeave: PropTypes.func,
showFixedNumberOfWeeks: PropTypes.bool,
showWeekNumbers: PropTypes.bool,
};
function _extends() {
_extends =
Object.assign ||
function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
function _typeof(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj &&
typeof Symbol === "function" &&
obj.constructor === Symbol &&
obj !== Symbol.prototype
? "symbol"
: typeof obj;
};
}
return _typeof(obj);
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError(
"Super expression must either be null or a function"
);
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true,
},
});
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf =
Object.setPrototypeOf ||
function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _createSuper(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived),
result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
function _possibleConstructorReturn(self, call) {
if (call && (_typeof(call) === "object" || typeof call === "function")) {
return call;
}
return _assertThisInitialized(self);
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError(
"this hasn't been initialised - super() hasn't been called"
);
}
return self;
}
function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Date.prototype.toString.call(
Reflect.construct(Date, [], function () {})
);
return true;
} catch (e) {
return false;
}
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf
? Object.getPrototypeOf
: function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly)
symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(
target,
Object.getOwnPropertyDescriptors(source)
);
} else {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(
target,
key,
Object.getOwnPropertyDescriptor(source, key)
);
});
}
}
return target;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true,
});
} else {
obj[key] = value;
}
return obj;
}
function _objectWithoutProperties(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key))
continue;
target[key] = source[key];
}
}
return target;
}
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
function _toConsumableArray(arr) {
return (
_arrayWithoutHoles(arr) ||
_iterableToArray(arr) ||
_unsupportedIterableToArray(arr) ||
_nonIterableSpread()
);
}
function _nonIterableSpread() {
throw new TypeError(
"Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."
);
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
return _arrayLikeToArray(o, minLen);
}
function _iterableToArray(iter) {
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter))
return Array.from(iter);
}
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) {
arr2[i] = arr[i];
}
return arr2;
}
var defaultMinDate = new Date();
defaultMinDate.setFullYear(1, 0, 1);
defaultMinDate.setHours(0, 0, 0, 0);
var defaultMaxDate = new Date(8.64e15);
var baseClassName = "react-calendar";
var allViews = ["century", "decade", "year", "month"];
var allValueTypes = [].concat(_toConsumableArray(allViews.slice(1)), ["day"]);
function toDate(value) {
if (value instanceof Date) {
return value;
}
return new Date(value);
}
/**
* Returns views array with disallowed values cut off.
*/
function getLimitedViews(minDetail, maxDetail) {
return allViews.slice(
allViews.indexOf(minDetail),
allViews.indexOf(maxDetail) + 1
);
}
/**
* Determines whether a given view is allowed with currently applied settings.
*/
function isViewAllowed(view, minDetail, maxDetail) {
var views = getLimitedViews(minDetail, maxDetail);
return views.indexOf(view) !== -1;
}
/**
* Gets either provided view if allowed by minDetail and maxDetail, or gets
* the default view if not allowed.
*/
function getView(view, minDetail, maxDetail) {
if (isViewAllowed(view, minDetail, maxDetail)) {
return view;
}
return maxDetail;
}
/**
* Returns value type that can be returned with currently applied settings.
*/
function getValueType(maxDetail) {
return allValueTypes[allViews.indexOf(maxDetail)];
}
function getValue(value, index) {
if (!value) {
return null;
}
var rawValue =
Array.isArray(value) && value.length === 2 ? value[index] : value;
if (!rawValue) {
return null;
}
var valueDate = toDate(rawValue);
if (isNaN(valueDate.getTime())) {
throw new Error("Invalid date: ".concat(value));
}
return valueDate;
}
function getDetailValue(_ref, index) {
var value = _ref.value,
minDate = _ref.minDate,
maxDate = _ref.maxDate,
maxDetail = _ref.maxDetail;
var valuePiece = getValue(value, index);
if (!valuePiece) {
return null;
}
var valueType = getValueType(maxDetail);
var detailValueFrom = [getBegin, getEnd][index](valueType, valuePiece);
return between(detailValueFrom, minDate, maxDate);
}
var getDetailValueFrom = function getDetailValueFrom(args) {
return getDetailValue(args, 0);
};
var getDetailValueTo = function getDetailValueTo(args) {
return getDetailValue(args, 1);
};
var getDetailValueArray = function getDetailValueArray(args) {
var value = args.value;
if (Array.isArray(value)) {
return value;
}
return [getDetailValueFrom, getDetailValueTo].map(function (fn) {
return fn(args);
});
};
function getActiveStartDate(props) {
var maxDate = props.maxDate,
maxDetail = props.maxDetail,
minDate = props.minDate,
minDetail = props.minDetail,
value = props.value,
view = props.view;
var rangeType = getView(view, minDetail, maxDetail);
var valueFrom =
getDetailValueFrom({
value: value,
minDate: minDate,
maxDate: maxDate,
maxDetail: maxDetail,
}) || new Date();
return getBegin(rangeType, valueFrom);
}
function getInitialActiveStartDate(props) {
var activeStartDate = props.activeStartDate,
defaultActiveStartDate = props.defaultActiveStartDate,
defaultValue = props.defaultValue,
defaultView = props.defaultView,
maxDetail = props.maxDetail,
minDetail = props.minDetail,
value = props.value,
view = props.view,
otherProps = _objectWithoutProperties(props, [
"activeStartDate",
"defaultActiveStartDate",
"defaultValue",
"defaultView",
"maxDetail",
"minDetail",
"value",
"view",
]);
var rangeType = getView(view, minDetail, maxDetail);
var valueFrom = activeStartDate || defaultActiveStartDate;
if (valueFrom) {
return getBegin(rangeType, valueFrom);
}
return getActiveStartDate(
_objectSpread(
{
maxDetail: maxDetail,
minDetail: minDetail,
value: value || defaultValue,
view: view || defaultView,
},
otherProps
)
);
}
var getIsSingleValue = function getIsSingleValue(value) {
return value && [].concat(value).length === 1;
};
var Calendar = /*#__PURE__*/ (function (_Component) {
_inherits(Calendar, _Component);
var _super = _createSuper(Calendar);
function Calendar() {
var _this;
_classCallCheck(this, Calendar);
for (
var _len = arguments.length, _args = new Array(_len), _key = 0;
_key < _len;
_key++
) {
_args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(_args));
_defineProperty(_assertThisInitialized(_this), "state", {
activeStartDate: _this.props.defaultActiveStartDate,
value: _this.props.defaultValue,
view: _this.props.defaultView,
});
_defineProperty(
_assertThisInitialized(_this),
"setStateAndCallCallbacks",
function (nextState, event, callback) {
var _assertThisInitialize = _assertThisInitialized(_this),
previousActiveStartDate =
_assertThisInitialize.activeStartDate,
previousView = _assertThisInitialize.view;
var _this$props = _this.props,
allowPartialRange = _this$props.allowPartialRange,
onActiveStartDateChange =
_this$props.onActiveStartDateChange,
onChange = _this$props.onChange,
onViewChange = _this$props.onViewChange,
selectRange = _this$props.selectRange;
var prevArgs = {
activeStartDate: previousActiveStartDate,
view: previousView,
};
_this.setState(nextState, function () {
var args = {
activeStartDate:
nextState.activeStartDate || _this.activeStartDate,
value: nextState.value || _this.value,
view: nextState.view || _this.view,
};
function shouldUpdate(key) {
return (
// Key must exist, and…
key in nextState && // …key changed from undefined to defined or the other way around, or…
(_typeof(nextState[key]) !==
_typeof(prevArgs[key]) || // …value changed.
(nextState[key] instanceof Date
? nextState[key].getTime() !==
prevArgs[key].getTime()
: nextState[key] !== prevArgs[key]))
);
}
if (shouldUpdate("activeStartDate")) {
if (onActiveStartDateChange)
onActiveStartDateChange(args);
}
if (shouldUpdate("view")) {
if (onViewChange) onViewChange(args);
}
if (shouldUpdate("value")) {
if (onChange) {
if (selectRange) {
var isSingleValue = getIsSingleValue(
nextState.value
);
if (!isSingleValue) {
onChange(nextState.value, event);
} else if (allowPartialRange) {
onChange([nextState.value], event);
}
} else {
onChange(nextState.value, event);
}
}
}
if (callback) callback(args);
});
}
);
_defineProperty(
_assertThisInitialized(_this),
"setActiveStartDate",
function (activeStartDate) {
_this.setStateAndCallCallbacks({
activeStartDate: activeStartDate,
});
}
);
_defineProperty(
_assertThisInitialized(_this),
"drillDown",
function (nextActiveStartDate, event) {
if (!_this.drillDownAvailable) {
return;
}
_this.onClickTile(nextActiveStartDate, event);
var _assertThisInitialize2 = _assertThisInitialized(_this),
view = _assertThisInitialize2.view,
views = _assertThisInitialize2.views;
var onDrillDown = _this.props.onDrillDown;
var nextView = views[views.indexOf(view) + 1];
_this.setStateAndCallCallbacks(
{
activeStartDate: nextActiveStartDate,
view: nextView,
},
undefined,
onDrillDown
);
}
);
_defineProperty(_assertThisInitialized(_this), "drillUp", function () {
if (!_this.drillUpAvailable) {
return;
}
var _assertThisInitialize3 = _assertThisInitialized(_this),
activeStartDate = _assertThisInitialize3.activeStartDate,
view = _assertThisInitialize3.view,
views = _assertThisInitialize3.views;
var onDrillUp = _this.props.onDrillUp;
var nextView = views[views.indexOf(view) - 1];
var nextActiveStartDate = getBegin(nextView, activeStartDate);
_this.setStateAndCallCallbacks(
{
activeStartDate: nextActiveStartDate,
view: nextView,
},
undefined,
onDrillUp
);
});
_defineProperty(
_assertThisInitialized(_this),
"onChange",
function (value, event) {
var selectRange = _this.props.selectRange;
_this.onClickTile(value, event);
var nextValue;
if (selectRange) {
// Range selection turned on
var _assertThisInitialize4 = _assertThisInitialized(_this),
previousValue = _assertThisInitialize4.value,
valueType = _assertThisInitialize4.valueType;
if (!getIsSingleValue(previousValue)) {
// Value has 0 or 2 elements - either way we're starting a new array
// First value
nextValue = getBegin(valueType, value);
} else {
// Second value
nextValue = getValueRange(
valueType,
previousValue,
value
);
}
} else {
// Range selection turned off
nextValue = _this.getProcessedValue(value);
}
var nextActiveStartDate = getActiveStartDate(
_objectSpread(
_objectSpread({}, _this.props),
{},
{
value: nextValue,
}
)
);
event.persist();
_this.setStateAndCallCallbacks(
{
activeStartDate: nextActiveStartDate,
value: nextValue,
},
event
);
}
);
_defineProperty(
_assertThisInitialized(_this),
"onClickTile",
function (value, event) {
var _assertThisInitialize5 = _assertThisInitialized(_this),
view = _assertThisInitialize5.view;
var _this$props2 = _this.props,
onClickDay = _this$props2.onClickDay,
onClickDecade = _this$props2.onClickDecade,
onClickMonth = _this$props2.onClickMonth,
onClickYear = _this$props2.onClickYear;
var callback = (function () {
switch (view) {
case "century":
return onClickDecade;
case "decade":
return onClickYear;
case "year":
return onClickMonth;
case "month":
return onClickDay;
default:
throw new Error("Invalid view: ".concat(view, "."));
}
})();
if (callback) callback(value, event);
}
);
_defineProperty(
_assertThisInitialized(_this),
"onMouseOver",
function (value) {
_this.setState(function (prevState) {
if (
prevState.hover &&
prevState.hover.getTime() === value.getTime()
) {
return null;
}
return {
hover: value,
};
});
}
);
_defineProperty(
_assertThisInitialized(_this),
"onMouseLeave",
function () {
_this.setState({
hover: null,
});
}
);
return _this;
}
_createClass(Calendar, [
{
key: "getProcessedValue",
/**
* Gets current value in a desired format.
*/
value: function getProcessedValue(value) {
var _this$props3 = this.props,
minDate = _this$props3.minDate,
maxDate = _this$props3.maxDate,
maxDetail = _this$props3.maxDetail,
returnValue = _this$props3.returnValue;
var processFunction = (function () {
switch (returnValue) {
case "start":
return getDetailValueFrom;
case "end":
return getDetailValueTo;
case "range":
return getDetailValueArray;
default:
throw new Error("Invalid returnValue.");
}
})();
return processFunction({
value: value,
minDate: minDate,
maxDate: maxDate,
maxDetail: maxDetail,
});
},
},
{
key: "renderContent",
value: function renderContent(next) {
var currentActiveStartDate = this.activeStartDate,
onMouseOver = this.onMouseOver,
valueType = this.valueType,
value = this.value,
view = this.view;
var _this$props4 = this.props,
calendarType = _this$props4.calendarType,
locale = _this$props4.locale,
maxDate = _this$props4.maxDate,
minDate = _this$props4.minDate,
selectRange = _this$props4.selectRange,
tileClassName = _this$props4.tileClassName,
tileContent = _this$props4.tileContent,
tileDisabled = _this$props4.tileDisabled;
var hover = this.hover;
var activeStartDate = next
? getBeginNext(view, currentActiveStartDate)
: getBegin(view, currentActiveStartDate);
var onClick = this.drillDownAvailable
? this.drillDown
: this.onChange;
var commonProps = {
activeStartDate: activeStartDate,
hover: hover,
locale: locale,
maxDate: maxDate,
minDate: minDate,
onClick: onClick,
onMouseOver: selectRange ? onMouseOver : null,
tileClassName: tileClassName,
tileContent: tileContent,
tileDisabled: tileDisabled,
value: value,
valueType: valueType,
};
switch (view) {
case "century": {
var formatYear = this.props.formatYear;
return /*#__PURE__*/ React.createElement(
CenturyView,
_extends(
{
formatYear: formatYear,
},
commonProps
)
);
}
case "decade": {
var _formatYear = this.props.formatYear;
return /*#__PURE__*/ React.createElement(
DecadeView,
_extends(
{
formatYear: _formatYear,
},
commonProps
)
);
}
case "year": {
var _this$props5 = this.props,
formatMonth = _this$props5.formatMonth,
formatMonthYear = _this$props5.formatMonthYear;
return /*#__PURE__*/ React.createElement(
YearView,
_extends(
{
formatMonth: formatMonth,
formatMonthYear: formatMonthYear,
},
commonProps
)
);
}
case "month": {
var _this$props6 = this.props,
formatDay = _this$props6.formatDay,
formatLongDate = _this$props6.formatLongDate,
formatShortWeekday =
_this$props6.formatShortWeekday,
onClickWeekNumber = _this$props6.onClickWeekNumber,
showDoubleView = _this$props6.showDoubleView,
showFixedNumberOfWeeks =
_this$props6.showFixedNumberOfWeeks,
showNeighboringMonth =
_this$props6.showNeighboringMonth,
showWeekNumbers = _this$props6.showWeekNumbers;
var onMouseLeave = this.onMouseLeave;
return /*#__PURE__*/ React.createElement(
MonthView,
_extends(
{
calendarType: calendarType,
formatDay: formatDay,
formatLongDate: formatLongDate,
formatShortWeekday: formatShortWeekday,
onClickWeekNumber: onClickWeekNumber,
onMouseLeave: selectRange
? onMouseLeave
: null,
showFixedNumberOfWeeks:
showFixedNumberOfWeeks ||
showDoubleView,
showNeighboringMonth: showNeighboringMonth,
showWeekNumbers: showWeekNumbers,
},
commonProps
)
);
}
default:
throw new Error("Invalid view: ".concat(view, "."));
}
},
},
{
key: "renderNavigation",
value: function renderNavigation() {
var showNavigation = this.props.showNavigation;
if (!showNavigation) {
return null;
}
var activeStartDate = this.activeStartDate,
view = this.view,
views = this.views;
var _this$props7 = this.props,
formatMonthYear = _this$props7.formatMonthYear,
formatYear = _this$props7.formatYear,
locale = _this$props7.locale,
maxDate = _this$props7.maxDate,
minDate = _this$props7.minDate,
navigationAriaLabel = _this$props7.navigationAriaLabel,
navigationLabel = _this$props7.navigationLabel,
next2AriaLabel = _this$props7.next2AriaLabel,
next2Label = _this$props7.next2Label,
nextAriaLabel = _this$props7.nextAriaLabel,
nextLabel = _this$props7.nextLabel,
prev2AriaLabel = _this$props7.prev2AriaLabel,
prev2Label = _this$props7.prev2Label,
prevAriaLabel = _this$props7.prevAriaLabel,
prevLabel = _this$props7.prevLabel,
showDoubleView = _this$props7.showDoubleView;
return /*#__PURE__*/ React.createElement(Navigation, {
activeStartDate: activeStartDate,
drillUp: this.drillUp,
formatMonthYear: formatMonthYear,
formatYear: formatYear,
locale: locale,
maxDate: maxDate,
minDate: minDate,
navigationAriaLabel: navigationAriaLabel,
navigationLabel: navigationLabel,
next2AriaLabel: next2AriaLabel,
next2Label: next2Label,
nextAriaLabel: nextAriaLabel,
nextLabel: nextLabel,
prev2AriaLabel: prev2AriaLabel,
prev2Label: prev2Label,
prevAriaLabel: prevAriaLabel,
prevLabel: prevLabel,
setActiveStartDate: this.setActiveStartDate,
showDoubleView: showDoubleView,
view: view,
views: views,
});
},
},
{
key: "render",
value: function render() {
var _this$props8 = this.props,
className = _this$props8.className,
inputRef = _this$props8.inputRef,
selectRange = _this$props8.selectRange,
showDoubleView = _this$props8.showDoubleView;
var onMouseLeave = this.onMouseLeave,
value = this.value;
var valueArray = [].concat(value);
return /*#__PURE__*/ React.createElement(
"div",
{
className: mergeClassNames(
baseClassName,
selectRange &&
valueArray.length === 1 &&
"".concat(baseClassName, "--selectRange"),
showDoubleView &&
"".concat(baseClassName, "--doubleView"),
className
),
ref: inputRef,
},
this.renderNavigation(),
/*#__PURE__*/ React.createElement(
"div",
{
className: "".concat(
baseClassName,
"__viewContainer"
),
onBlur: selectRange ? onMouseLeave : null,
onMouseLeave: selectRange ? onMouseLeave : null,
},
this.renderContent(),
showDoubleView && this.renderContent(true)
)
);
},
},
{
key: "activeStartDate",
get: function get() {
var activeStartDateProps = this.props.activeStartDate;
var activeStartDateState = this.state.activeStartDate;
return (
activeStartDateProps ||
activeStartDateState ||
getInitialActiveStartDate(this.props)
);
},
},
{
key: "value",
get: function get() {
var _this$props9 = this.props,
selectRange = _this$props9.selectRange,
valueProps = _this$props9.value;
var valueState = this.state.value; // In the middle of range selection, use value from state
if (selectRange && getIsSingleValue(valueState)) {
return valueState;
}
return valueProps !== undefined ? valueProps : valueState;
},
},
{
key: "valueType",
get: function get() {
var maxDetail = this.props.maxDetail;
return getValueType(maxDetail);
},
},
{
key: "view",
get: function get() {
var _this$props10 = this.props,
minDetail = _this$props10.minDetail,
maxDetail = _this$props10.maxDetail,
viewProps = _this$props10.view;
var viewState = this.state.view;
return getView(viewProps || viewState, minDetail, maxDetail);
},
},
{
key: "views",
get: function get() {
var _this$props11 = this.props,
minDetail = _this$props11.minDetail,
maxDetail = _this$props11.maxDetail;
return getLimitedViews(minDetail, maxDetail);
},
},
{
key: "hover",
get: function get() {
var selectRange = this.props.selectRange;
var hover = this.state.hover;
return selectRange ? hover : null;
},
},
{
key: "drillDownAvailable",
get: function get() {
var view = this.view,
views = this.views;
return views.indexOf(view) < views.length - 1;
},
},
{
key: "drillUpAvailable",
get: function get() {
var view = this.view,
views = this.views;
return views.indexOf(view) > 0;
},
},
]);
return Calendar;
})(_);
Calendar.defaultProps = {
maxDate: defaultMaxDate,
maxDetail: "month",
minDate: defaultMinDate,
minDetail: "century",
returnValue: "start",
showNavigation: true,
showNeighboringMonth: true,
};
var isActiveStartDate = PropTypes.instanceOf(Date);
var isLooseValue = PropTypes.oneOfType([PropTypes.string, isValue]);
Calendar.propTypes = {
activeStartDate: isActiveStartDate,
allowPartialRange: PropTypes.bool,
calendarType: isCalendarType,
className: isClassName,
defaultActiveStartDate: isActiveStartDate,
defaultValue: isLooseValue,
defaultView: isView,
formatDay: PropTypes.func,
formatLongDate: PropTypes.func,
formatMonth: PropTypes.func,
formatMonthYear: PropTypes.func,
formatShortWeekday: PropTypes.func,
formatYear: PropTypes.func,
inputRef: isRef,
locale: PropTypes.string,
maxDate: isMaxDate,
maxDetail: PropTypes.oneOf(allViews),
minDate: isMinDate,
minDetail: PropTypes.oneOf(allViews),
navigationAriaLabel: PropTypes.string,
navigationLabel: PropTypes.func,
next2AriaLabel: PropTypes.string,
next2Label: PropTypes.node,
nextAriaLabel: PropTypes.string,
nextLabel: PropTypes.node,
onActiveStartDateChange: PropTypes.func,
onChange: PropTypes.func,
onClickDay: PropTypes.func,
onClickDecade: PropTypes.func,
onClickMonth: PropTypes.func,
onClickWeekNumber: PropTypes.func,
onClickYear: PropTypes.func,
onDrillDown: PropTypes.func,
onDrillUp: PropTypes.func,
onViewChange: PropTypes.func,
prev2AriaLabel: PropTypes.string,
prev2Label: PropTypes.node,
prevAriaLabel: PropTypes.string,
prevLabel: PropTypes.node,
returnValue: PropTypes.oneOf(["start", "end", "range"]),
selectRange: PropTypes.bool,
showDoubleView: PropTypes.bool,
showFixedNumberOfWeeks: PropTypes.bool,
showNavigation: PropTypes.bool,
showNeighboringMonth: PropTypes.bool,
showWeekNumbers: PropTypes.bool,
tileClassName: PropTypes.oneOfType([PropTypes.func, isClassName]),
tileContent: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
tileDisabled: PropTypes.func,
value: isLooseValue,
view: isView,
};
style("/assets/Calendar.4739c73f.css");
function CompatDemo() {
const [value, onChange] = l$2(new Date());
return m$1`<${Calendar} onChange=${onChange} showWeekNumbers value=${value}/>`;
}
export default CompatDemo;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/wmr/archive-1/chunks/.compat.2f7d9500/output.js | JavaScript | import {
_,
l as l$1,
v as v$1,
d as d$1,
A as A$2,
a as l$2,
p as p$1,
y as y$1,
h as h$1,
b as s,
c as _$1,
e as d$2,
f as A$3,
F as F$1,
T as T$1,
D as D$1,
g as p$2,
B as B$1,
S as S$1,
q as q$2,
s as style,
m as m$1,
} from "../index.f66dda46.js";
function S(
n, t
) {
for (var e in t) n[e] = t[e];
return n;
}
function C(
n, t
) {
for (var e in n) if ("__source" !== e && !(e in t)) return !0;
for (var r in t) if ("__source" !== r && n[r] !== t[r]) return !0;
return !1;
}
function E(
n
) {
this.props = n;
}
function g$1(
n, t
) {
function e(
n
) {
var e = this.props.ref,
r = e == n.ref;
return (
!r && e && (e.call
? e(
null
)
: (e.current = null)),
t
? !t(
this.props,
n
) || !r
: C(
this.props,
n
)
);
}
function r(
t
) {
return (this.shouldComponentUpdate = e), v$1(
n,
t
);
}
return (
(r.displayName = "Memo(" + (n.displayName || n.name) + ")"),
(r.prototype.isReactComponent = !0),
(r.__f = !0),
r
);
}
((E.prototype = new _(
)).isPureReactComponent = !0),
(E.prototype.shouldComponentUpdate = function (
n, t
) {
return C(
this.props,
n
) || C(
this.state,
t
);
});
var w$1 = l$1.__b;
l$1.__b = function (
n
) {
n.type && n.type.__f && n.ref && ((n.props.ref = n.ref), (n.ref = null)),
w$1 && w$1(
n
);
};
var R =
("undefined" != typeof Symbol &&
Symbol.for &&
Symbol.for(
"react.forward_ref"
)) ||
3911;
function x$1(
n
) {
function t(
t, e
) {
var r = S(
{
},
t
);
return (
delete r.ref,
n(
r,
(e = t.ref || e) && ("object" != typeof e || "current" in e)
? e
: null
)
);
}
return (
(t.$$typeof = R),
(t.render = t),
(t.prototype.isReactComponent = t.__f = !0),
(t.displayName = "ForwardRef(" + (n.displayName || n.name) + ")"),
t
);
}
var N = function (
n, t
) {
return null == n
? null
: A$2(
A$2(
n
).map(
t
)
);
},
k$1 = {
map: N,
forEach: N,
count: function (
n
) {
return n
? A$2(
n
).length
: 0;
},
only: function (
n
) {
var t = A$2(
n
);
if (1 !== t.length) throw "Children.only";
return t[0];
},
toArray: A$2,
},
A$1 = l$1.__e;
l$1.__e = function (
n, t, e
) {
if (n.then)
for (var r, u = t; (u = u.__); )
if ((r = u.__c) && r.__c)
return (
null == t.__e && ((t.__e = e.__e), (t.__k = e.__k)),
r.__c(
n,
t
)
);
A$1(
n,
t,
e
);
};
var O = l$1.unmount;
function L(
) {
(this.__u = 0), (this.t = null), (this.__b = null);
}
function U(
n
) {
var t = n.__.__c;
return t && t.__e && t.__e(
n
);
}
function F(
n
) {
var t, e, r;
function u(
u
) {
if (
(t ||
(t = n(
)).then(
function (
n
) {
e = n.default || n;
},
function (
n
) {
r = n;
}
),
r)
)
throw r;
if (!e) throw t;
return v$1(
e,
u
);
}
return (u.displayName = "Lazy"), (u.__f = !0), u;
}
function M(
) {
(this.u = null), (this.o = null);
}
(l$1.unmount = function (
n
) {
var t = n.__c;
t && t.__R && t.__R(
), t && !0 === n.__h && (n.type = null), O && O(
n
);
}),
((L.prototype = new _(
)).__c = function (
n, t
) {
var e = t.__c,
r = this;
null == r.t && (r.t = []), r.t.push(
e
);
var u = U(
r.__v
),
o = !1,
i = function (
) {
o || ((o = !0), (e.__R = null), u
? u(
l
)
: l(
));
};
e.__R = i;
var l = function (
) {
if (!--r.__u) {
if (r.state.__e) {
var n = r.state.__e;
r.__v.__k[0] = (function n(
t, e, r
) {
return (
t &&
((t.__v = null),
(t.__k =
t.__k &&
t.__k.map(
function (
t
) {
return n(
t,
e,
r
);
}
)),
t.__c &&
t.__c.__P === e &&
(t.__e && r.insertBefore(
t.__e,
t.__d
),
(t.__c.__e = !0),
(t.__c.__P = r))),
t
);
})(
n,
n.__c.__P,
n.__c.__O
);
}
var t;
for (r.setState(
{
__e: (r.__b = null),
}
); (t = r.t.pop(
)); )
t.forceUpdate(
);
}
},
f = !0 === t.__h;
r.__u++ || f || r.setState(
{
__e: (r.__b = r.__v.__k[0]),
}
),
n.then(
i,
i
);
}),
(L.prototype.componentWillUnmount = function (
) {
this.t = [];
}),
(L.prototype.render = function (
n, t
) {
if (this.__b) {
if (this.__v.__k) {
var e = document.createElement(
"div"
),
r = this.__v.__k[0].__c;
this.__v.__k[0] = (function n(
t, e, r
) {
return (
t &&
(t.__c &&
t.__c.__H &&
(t.__c.__H.__.forEach(
function (
n
) {
"function" == typeof n.__c && n.__c(
);
}
),
(t.__c.__H = null)),
null != (t = S(
{
},
t
)).__c &&
(t.__c.__P === r && (t.__c.__P = e),
(t.__c = null)),
(t.__k =
t.__k &&
t.__k.map(
function (
t
) {
return n(
t,
e,
r
);
}
))),
t
);
})(
this.__b,
e, (
r.__O = r.__P)
);
}
this.__b = null;
}
var u = t.__e && v$1(
d$1,
null,
n.fallback
);
return (
u && (u.__h = null), [v$1(
d$1,
null,
t.__e ? null : n.children
), u,]
);
});
var T = function (
n, t, e
) {
if (
(++e[1] === e[0] && n.o.delete(
t
),
n.props.revealOrder && ("t" !== n.props.revealOrder[0] || !n.o.size))
)
for (e = n.u; e; ) {
for (; e.length > 3; ) e.pop(
)(
);
if (e[1] < e[0]) break;
n.u = e = e[2];
}
};
function D(
n
) {
return (
(this.getChildContext = function (
) {
return n.context;
}),
n.children
);
}
function I(
n
) {
var t = this,
e = n.i;
(t.componentWillUnmount = function (
) {
S$1(
null,
t.l
), (t.l = null), (t.i = null);
}),
t.i && t.i !== e && t.componentWillUnmount(
),
n.__v
? (t.l ||
((t.i = e),
(t.l = {
nodeType: 1,
parentNode: e,
childNodes: [],
appendChild: function (
n
) {
this.childNodes.push(
n
), t.i.appendChild(
n
);
},
insertBefore: function (
n, e
) {
this.childNodes.push(
n
), t.i.appendChild(
n
);
},
removeChild: function (
n
) {
this.childNodes.splice(
this.childNodes.indexOf(
n
) >>> 1,
1
),
t.i.removeChild(
n
);
},
})),
S$1(
v$1(
D,
{
context: t.context,
},
n.__v
),
t.l
))
: t.l && t.componentWillUnmount(
);
}
function W(
n, t
) {
return v$1(
I,
{
__v: n,
i: t,
}
);
}
((M.prototype = new _(
)).__e = function (
n
) {
var t = this,
e = U(
t.__v
),
r = t.o.get(
n
);
return (
r[0]++,
function (
u
) {
var o = function (
) {
t.props.revealOrder
? (r.push(
u
), T(
t,
n,
r
))
: u(
);
};
e
? e(
o
)
: o(
);
}
);
}),
(M.prototype.render = function (
n
) {
(this.u = null), (this.o = new Map(
));
var t = A$2(
n.children
);
n.revealOrder && "b" === n.revealOrder[0] && t.reverse(
);
for (var e = t.length; e--; )
this.o.set(
t[e], (
this.u = [1, 0, this.u,])
);
return n.children;
}),
(M.prototype.componentDidUpdate = M.prototype.componentDidMount =
function (
) {
var n = this;
this.o.forEach(
function (
t, e
) {
T(
n,
e,
t
);
}
);
});
var j =
("undefined" != typeof Symbol &&
Symbol.for &&
Symbol.for(
"react.element"
)) ||
60103,
P =
/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|fill|flood|font|glyph(?!R)|horiz|marker(?!H|W|U)|overline|paint|stop|strikethrough|stroke|text(?!L)|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,
V = function (
n
) {
return (
"undefined" != typeof Symbol && "symbol" == typeof Symbol(
)
? /fil|che|rad/i
: /fil|che|ra/i
).test(
n
);
};
function z$1(
n, t, e
) {
return (
null == t.__k && (t.textContent = ""),
S$1(
n,
t
),
"function" == typeof e && e(
),
n ? n.__c : null
);
}
function B(
n, t, e
) {
return q$2(
n,
t
), "function" == typeof e && e(
), n ? n.__c : null;
}
(_.prototype.isReactComponent = {
}),
[
"componentWillMount",
"componentWillReceiveProps",
"componentWillUpdate",
].forEach(
function (
n
) {
Object.defineProperty(
_.prototype,
n,
{
configurable: !0,
get: function (
) {
return this["UNSAFE_" + n];
},
set: function (
t
) {
Object.defineProperty(
this,
n,
{
configurable: !0,
writable: !0,
value: t,
}
);
},
}
);
}
);
var H = l$1.event;
function Z(
) {}
function Y(
) {
return this.cancelBubble;
}
function $(
) {
return this.defaultPrevented;
}
l$1.event = function (
n
) {
return (
H && (n = H(
n
)),
(n.persist = Z),
(n.isPropagationStopped = Y),
(n.isDefaultPrevented = $),
(n.nativeEvent = n)
);
};
var q$1,
G = {
configurable: !0,
get: function (
) {
return this.class;
},
},
J = l$1.vnode;
l$1.vnode = function (
n
) {
var t = n.type,
e = n.props,
r = e;
if ("string" == typeof t) {
for (var u in ((r = {
}), e)) {
var o = e[u];
("value" === u && "defaultValue" in e && null == o) ||
("defaultValue" === u && "value" in e && null == e.value
? (u = "value")
: "download" === u && !0 === o
? (o = "")
: /ondoubleclick/i.test(
u
)
? (u = "ondblclick")
: /^onchange(textarea|input)/i.test(
u + t
) && !V(
e.type
)
? (u = "oninput")
: /^on(Ani|Tra|Tou|BeforeInp)/.test(
u
)
? (u = u.toLowerCase(
))
: P.test(
u
)
? (u = u.replace(
/[A-Z0-9]/,
"-$&"
).toLowerCase(
))
: null === o && (o = void 0),
(r[u] = o));
}
"select" == t &&
r.multiple &&
Array.isArray(
r.value
) &&
(r.value = A$2(
e.children
).forEach(
function (
n
) {
n.props.selected = -1 != r.value.indexOf(
n.props.value
);
}
)),
"select" == t &&
null != r.defaultValue &&
(r.value = A$2(
e.children
).forEach(
function (
n
) {
n.props.selected = r.multiple
? -1 != r.defaultValue.indexOf(
n.props.value
)
: r.defaultValue == n.props.value;
}
)),
(n.props = r);
}
t &&
e.class != e.className &&
((G.enumerable = "className" in e),
null != e.className && (r.class = e.className),
Object.defineProperty(
r,
"className",
G
)),
(n.$$typeof = j),
J && J(
n
);
};
var K = l$1.__r;
l$1.__r = function (
n
) {
K && K(
n
), (q$1 = n.__c);
};
var Q = {
ReactCurrentDispatcher: {
current: {
readContext: function (
n
) {
return q$1.__n[n.__c].props.value;
},
},
},
};
function nn(
n
) {
return v$1.bind(
null,
n
);
}
function tn(
n
) {
return !!n && n.$$typeof === j;
}
function en(
n
) {
return tn(
n
)
? B$1.apply(
null,
arguments
)
: n;
}
function rn(
n
) {
return !!n.__k && (S$1(
null,
n
), !0);
}
function un(
n
) {
return (n && (n.base || (1 === n.nodeType && n))) || null;
}
var on = function (
n, t
) {
return n(
t
);
},
ln = function (
n, t
) {
return n(
t
);
};
const React = {
useState: l$2,
useReducer: p$1,
useEffect: y$1,
useLayoutEffect: h$1,
useRef: s,
useImperativeHandle: _$1,
useMemo: d$2,
useCallback: A$3,
useContext: F$1,
useDebugValue: T$1,
version: "17.0.2",
Children: k$1,
render: z$1,
hydrate: B,
unmountComponentAtNode: rn,
createPortal: W,
createElement: v$1,
createContext: D$1,
createFactory: nn,
cloneElement: en,
createRef: p$2,
Fragment: d$1,
isValidElement: tn,
findDOMNode: un,
Component: _,
PureComponent: E,
memo: g$1,
forwardRef: x$1,
flushSync: ln,
unstable_batchedUpdates: on,
StrictMode: d$1,
Suspense: L,
SuspenseList: M,
lazy: F,
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: Q,
};
var module$7 = {
exports: {
},
},
exports = module$7.exports,
b = "function" == typeof Symbol && Symbol.for,
c = b
? Symbol.for(
"react.element"
)
: 60103,
d = b
? Symbol.for(
"react.portal"
)
: 60106,
e = b
? Symbol.for(
"react.fragment"
)
: 60107,
f = b
? Symbol.for(
"react.strict_mode"
)
: 60108,
g = b
? Symbol.for(
"react.profiler"
)
: 60114,
h = b
? Symbol.for(
"react.provider"
)
: 60109,
k = b
? Symbol.for(
"react.context"
)
: 60110,
l = b
? Symbol.for(
"react.async_mode"
)
: 60111,
m = b
? Symbol.for(
"react.concurrent_mode"
)
: 60111,
n = b
? Symbol.for(
"react.forward_ref"
)
: 60112,
p = b
? Symbol.for(
"react.suspense"
)
: 60113,
q = b
? Symbol.for(
"react.suspense_list"
)
: 60120,
r = b
? Symbol.for(
"react.memo"
)
: 60115,
t = b
? Symbol.for(
"react.lazy"
)
: 60116,
v = b
? Symbol.for(
"react.block"
)
: 60121,
w = b
? Symbol.for(
"react.fundamental"
)
: 60117,
x = b
? Symbol.for(
"react.responder"
)
: 60118,
y = b
? Symbol.for(
"react.scope"
)
: 60119;
function z(
a
) {
if ("object" == typeof a && null !== a) {
var u = a.$$typeof;
switch (u) {
case c:
switch ((a = a.type)) {
case l:
case m:
case e:
case g:
case f:
case p:
return a;
default:
switch ((a = a && a.$$typeof)) {
case k:
case n:
case t:
case r:
case h:
return a;
default:
return u;
}
}
case d:
return u;
}
}
}
function A(
a
) {
return z(
a
) === m;
}
(exports.AsyncMode = l),
(exports.ConcurrentMode = m),
(exports.ContextConsumer = k),
(exports.ContextProvider = h),
(exports.Element = c),
(exports.ForwardRef = n),
(exports.Fragment = e),
(exports.Lazy = t),
(exports.Memo = r),
(exports.Portal = d),
(exports.Profiler = g),
(exports.StrictMode = f),
(exports.Suspense = p),
(exports.isAsyncMode = function (
a
) {
return A(
a
) || z(
a
) === l;
}),
(exports.isConcurrentMode = A),
(exports.isContextConsumer = function (
a
) {
return z(
a
) === k;
}),
(exports.isContextProvider = function (
a
) {
return z(
a
) === h;
}),
(exports.isElement = function (
a
) {
return "object" == typeof a && null !== a && a.$$typeof === c;
}),
(exports.isForwardRef = function (
a
) {
return z(
a
) === n;
}),
(exports.isFragment = function (
a
) {
return z(
a
) === e;
}),
(exports.isLazy = function (
a
) {
return z(
a
) === t;
}),
(exports.isMemo = function (
a
) {
return z(
a
) === r;
}),
(exports.isPortal = function (
a
) {
return z(
a
) === d;
}),
(exports.isProfiler = function (
a
) {
return z(
a
) === g;
}),
(exports.isStrictMode = function (
a
) {
return z(
a
) === f;
}),
(exports.isSuspense = function (
a
) {
return z(
a
) === p;
}),
(exports.isValidElementType = function (
a
) {
return (
"string" == typeof a ||
"function" == typeof a ||
a === e ||
a === m ||
a === g ||
a === f ||
a === p ||
a === q ||
("object" == typeof a &&
null !== a &&
(a.$$typeof === t ||
a.$$typeof === r ||
a.$$typeof === h ||
a.$$typeof === k ||
a.$$typeof === n ||
a.$$typeof === w ||
a.$$typeof === x ||
a.$$typeof === y ||
a.$$typeof === v))
);
}),
(exports.typeOf = z);
const reactIs_production_min = module$7.exports,
$cjs$_cjs_react_is_production_min_js = Object.freeze(
{
__proto__: null,
default: reactIs_production_min,
}
);
function $$cjs_default$$$3(
m, i
) {
for (i in m) if ("default" != i) return m;
return m.default || m;
}
var module$6 = {
exports: {
},
};
module$6.exports = $$cjs_default$$$3(
$cjs$_cjs_react_is_production_min_js
);
const index$1 = module$6.exports,
$cjs$react_is = Object.freeze(
{
__proto__: null,
default: index$1,
}
);
var module$5 = {
exports: {
},
},
getOwnPropertySymbols = Object.getOwnPropertySymbols,
hasOwnProperty = Object.prototype.hasOwnProperty,
propIsEnumerable = Object.prototype.propertyIsEnumerable;
function toObject(
val
) {
if (null == val)
throw new TypeError(
"Object.assign cannot be called with null or undefined"
);
return Object(
val
);
}
function shouldUseNative(
) {
try {
if (!Object.assign) return !1;
var test1 = new String(
"abc"
);
if (((test1[5] = "de"), "5" === Object.getOwnPropertyNames(
test1
)[0]))
return !1;
for (var test2 = {
}, i = 0; i < 10; i++)
test2["_" + String.fromCharCode(
i
)] = i;
if (
"0123456789" !==
Object.getOwnPropertyNames(
test2
)
.map(
function (
n
) {
return test2[n];
}
)
.join(
""
)
)
return !1;
var test3 = {
};
return (
"abcdefghijklmnopqrst".split(
""
).forEach(
function (
letter
) {
test3[letter] = letter;
}
),
"abcdefghijklmnopqrst" ===
Object.keys(
Object.assign(
{
},
test3
)
).join(
""
)
);
} catch (err) {
return !1;
}
}
module$5.exports = shouldUseNative(
)
? Object.assign
: function (
target, source
) {
for (
var from, symbols, to = toObject(
target
), s = 1;
s < arguments.length;
s++
) {
for (var key in (from = Object(
arguments[s]
)))
hasOwnProperty.call(
from,
key
) && (to[key] = from[key]);
if (getOwnPropertySymbols) {
symbols = getOwnPropertySymbols(
from
);
for (var i = 0; i < symbols.length; i++)
propIsEnumerable.call(
from,
symbols[i]
) &&
(to[symbols[i]] = from[symbols[i]]);
}
}
return to;
};
const index = module$5.exports,
$cjs$object_assign = Object.freeze(
{
__proto__: null,
default: index,
}
);
var module$4 = {
exports: {
},
},
ReactPropTypesSecret$1 = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
module$4.exports = ReactPropTypesSecret$1;
const ReactPropTypesSecret$2 = module$4.exports,
$cjs$_lib_ReactPropTypesSecret = Object.freeze(
{
__proto__: null,
default: ReactPropTypesSecret$2,
}
);
var module$3 = {
exports: {
},
};
function checkPropTypes(
typeSpecs, values, location, componentName, getStack
) {}
(checkPropTypes.resetWarningCache = function (
) {}),
(module$3.exports = checkPropTypes);
const checkPropTypes$1 = module$3.exports,
$cjs$_checkPropTypes = Object.freeze(
{
__proto__: null,
default: checkPropTypes$1,
}
);
function $$cjs_default$$$2(
m, i
) {
for (i in m) if ("default" != i) return m;
return m.default || m;
}
function $$cjs_default$$$1(
m, i
) {
for (i in m) if ("default" != i) return m;
return m.default || m;
}
$$cjs_default$$$2(
$cjs$react_is
),
$$cjs_default$$$2(
$cjs$object_assign
),
$$cjs_default$$$2(
$cjs$_lib_ReactPropTypesSecret
),
$$cjs_default$$$2(
$cjs$_checkPropTypes
),
Function.call.bind(
Object.prototype.hasOwnProperty
);
var module$2 = {
exports: {
},
},
ReactPropTypesSecret = $$cjs_default$$$1(
$cjs$_lib_ReactPropTypesSecret
);
function emptyFunction(
) {}
function emptyFunctionWithReset(
) {}
(emptyFunctionWithReset.resetWarningCache = emptyFunction),
(module$2.exports = function (
) {
function shim(
props,
propName,
componentName,
location,
propFullName,
secret
) {
if (secret !== ReactPropTypesSecret) {
var err = 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 ((err.name = "Invariant Violation"), err);
}
}
function getShim(
) {
return shim;
}
shim.isRequired = shim;
var ReactPropTypes = {
array: shim,
bool: shim,
func: shim,
number: shim,
object: shim,
string: shim,
symbol: shim,
any: shim,
arrayOf: getShim,
element: shim,
elementType: shim,
instanceOf: getShim,
node: shim,
objectOf: getShim,
oneOf: getShim,
oneOfType: getShim,
shape: getShim,
exact: getShim,
checkPropTypes: emptyFunctionWithReset,
resetWarningCache: emptyFunction,
};
return (ReactPropTypes.PropTypes = ReactPropTypes), ReactPropTypes;
});
const factoryWithThrowingShims = module$2.exports,
$cjs$_factoryWithThrowingShims = Object.freeze(
{
__proto__: null,
default: factoryWithThrowingShims,
}
);
function $$cjs_default$$(
m, i
) {
for (i in m) if ("default" != i) return m;
return m.default || m;
}
var module$1 = {
exports: {
},
};
module$1.exports = $$cjs_default$$(
$cjs$_factoryWithThrowingShims
)(
);
const PropTypes = module$1.exports;
function mergeClassNames(
) {
return Array.prototype.slice
.call(
arguments
)
.reduce(
function (
classList, arg
) {
return "string" == typeof arg || Array.isArray(
arg
)
? classList.concat(
arg
)
: classList;
},
[]
)
.filter(
Boolean
)
.join(
" "
);
}
var module = {
exports: {
},
},
FUNC_ERROR_TEXT = "Expected a function",
INFINITY = 1 / 0,
MAX_INTEGER = 17976931348623157e292,
NAN = NaN,
symbolTag = "[object Symbol]",
reTrim = /^\s+|\s+$/g,
reIsBadHex = /^[-+]0x[0-9a-f]+$/i,
reIsBinary = /^0b[01]+$/i,
reIsOctal = /^0o[0-7]+$/i,
freeParseInt = parseInt,
objectProto = Object.prototype,
objectToString = objectProto.toString;
function before(
n, func
) {
var result;
if ("function" != typeof func) throw new TypeError(
FUNC_ERROR_TEXT
);
return (
(n = toInteger(
n
)),
function (
) {
return (
--n > 0 && (result = func.apply(
this,
arguments
)),
n <= 1 && (func = void 0),
result
);
}
);
}
function once(
func
) {
return before(
2,
func
);
}
function isObject(
value
) {
var type = typeof value;
return !!value && ("object" == type || "function" == type);
}
function isObjectLike(
value
) {
return !!value && "object" == typeof value;
}
function isSymbol(
value
) {
return (
"symbol" == typeof value ||
(isObjectLike(
value
) && objectToString.call(
value
) == symbolTag)
);
}
function toFinite(
value
) {
return value
? (value = toNumber(
value
)) === INFINITY || value === -INFINITY
? (value < 0 ? -1 : 1) * MAX_INTEGER
: value == value
? value
: 0
: 0 === value
? value
: 0;
}
function toInteger(
value
) {
var result = toFinite(
value
),
remainder = result % 1;
return result == result ? (remainder ? result - remainder : result) : 0;
}
function toNumber(
value
) {
if ("number" == typeof value) return value;
if (isSymbol(
value
)) return NAN;
if (isObject(
value
)) {
var other =
"function" == typeof value.valueOf
? value.valueOf(
)
: value;
value = isObject(
other
)
? other + ""
: other;
}
if ("string" != typeof value) return 0 === value ? value : +value;
value = value.replace(
reTrim,
""
);
var isBinary = reIsBinary.test(
value
);
return isBinary || reIsOctal.test(
value
)
? freeParseInt(
value.slice(
2
),
isBinary ? 2 : 8
)
: reIsBadHex.test(
value
)
? NAN
: +value;
}
module.exports = once;
const once$1 = module.exports;
function filterDuplicates(
arr
) {
return arr.filter(
function (
el, index, self
) {
return self.indexOf(
el
) === index;
}
);
}
function fixLowercaseProperties(
arr
) {
return arr.map(
function (
el
) {
if (!el || -1 === el.indexOf(
"-"
) || el.toLowerCase(
) !== el) return el;
var splitEl = el.split(
"-"
);
return "".concat(
splitEl[0],
"-"
).concat(
splitEl[1].toUpperCase(
)
);
}
);
}
function getUserLocalesInternal(
) {
var languageList = [];
return (
"undefined" != typeof window &&
(window.navigator.languages &&
(languageList = languageList.concat(
window.navigator.languages
)),
window.navigator.language &&
languageList.push(
window.navigator.language
),
window.navigator.userLanguage &&
languageList.push(
window.navigator.userLanguage
),
window.navigator.browserLanguage &&
languageList.push(
window.navigator.browserLanguage
),
window.navigator.systemLanguage &&
languageList.push(
window.navigator.systemLanguage
)),
languageList.push(
"en-US"
),
fixLowercaseProperties(
filterDuplicates(
languageList
)
)
);
}
var getUserLocales = once$1(
getUserLocalesInternal
);
function getUserLocaleInternal(
) {
return getUserLocales(
)[0];
}
var getUserLocale = once$1(
getUserLocaleInternal
);
function makeGetEdgeOfNeighbor(
getPeriod, getEdgeOfPeriod, defaultOffset
) {
return function (
date
) {
var offset =
arguments.length > 1 && void 0 !== arguments[1]
? arguments[1]
: defaultOffset,
previousPeriod = getPeriod(
date
) + offset;
return getEdgeOfPeriod(
previousPeriod
);
};
}
function makeGetEnd(
getBeginOfNextPeriod
) {
return function (
date
) {
return new Date(
getBeginOfNextPeriod(
date
).getTime(
) - 1
);
};
}
function makeGetRange(
functions
) {
return function (
date
) {
return functions.map(
function (
fn
) {
return fn(
date
);
}
);
};
}
function getYear(
date
) {
if (date instanceof Date) return date.getFullYear(
);
if ("number" == typeof date) return date;
var year = parseInt(
date,
10
);
if ("string" == typeof date && !isNaN(
year
)) return year;
throw new Error(
"Failed to get year from date: ".concat(
date,
"."
)
);
}
function getMonth(
date
) {
if (date instanceof Date) return date.getMonth(
);
throw new Error(
"Failed to get month from date: ".concat(
date,
"."
)
);
}
function getDate(
date
) {
if (date instanceof Date) return date.getDate(
);
throw new Error(
"Failed to get year from date: ".concat(
date,
"."
)
);
}
function getCenturyStart(
date
) {
var year = getYear(
date
),
centuryStartYear = year + ((1 - year) % 100),
centuryStartDate = new Date(
);
return (
centuryStartDate.setFullYear(
centuryStartYear,
0,
1
),
centuryStartDate.setHours(
0,
0,
0,
0
),
centuryStartDate
);
}
var getPreviousCenturyStart = makeGetEdgeOfNeighbor(
getYear,
getCenturyStart,
-100
),
getNextCenturyStart = makeGetEdgeOfNeighbor(
getYear,
getCenturyStart,
100
),
getCenturyEnd = makeGetEnd(
getNextCenturyStart
),
getPreviousCenturyEnd = makeGetEdgeOfNeighbor(
getYear,
getCenturyEnd,
-100
),
getCenturyRange = makeGetRange(
[getCenturyStart, getCenturyEnd,]
);
function getDecadeStart(
date
) {
var year = getYear(
date
),
decadeStartYear = year + ((1 - year) % 10),
decadeStartDate = new Date(
);
return (
decadeStartDate.setFullYear(
decadeStartYear,
0,
1
),
decadeStartDate.setHours(
0,
0,
0,
0
),
decadeStartDate
);
}
var getPreviousDecadeStart = makeGetEdgeOfNeighbor(
getYear,
getDecadeStart,
-10
),
getNextDecadeStart = makeGetEdgeOfNeighbor(
getYear,
getDecadeStart,
10
),
getDecadeEnd = makeGetEnd(
getNextDecadeStart
),
getPreviousDecadeEnd = makeGetEdgeOfNeighbor(
getYear,
getDecadeEnd,
-10
),
getDecadeRange = makeGetRange(
[getDecadeStart, getDecadeEnd,]
);
function getYearStart(
date
) {
var year = getYear(
date
),
yearStartDate = new Date(
);
return (
yearStartDate.setFullYear(
year,
0,
1
),
yearStartDate.setHours(
0,
0,
0,
0
),
yearStartDate
);
}
var getPreviousYearStart = makeGetEdgeOfNeighbor(
getYear,
getYearStart,
-1
),
getNextYearStart = makeGetEdgeOfNeighbor(
getYear,
getYearStart,
1
),
getYearEnd = makeGetEnd(
getNextYearStart
),
getPreviousYearEnd = makeGetEdgeOfNeighbor(
getYear,
getYearEnd,
-1
),
getYearRange = makeGetRange(
[getYearStart, getYearEnd,]
);
function makeGetEdgeOfNeighborMonth(
getEdgeOfPeriod, defaultOffset
) {
return function (
date
) {
var offset =
arguments.length > 1 && void 0 !== arguments[1]
? arguments[1]
: defaultOffset,
year = getYear(
date
),
month = getMonth(
date
) + offset,
previousPeriod = new Date(
);
return (
previousPeriod.setFullYear(
year,
month,
1
),
previousPeriod.setHours(
0,
0,
0,
0
),
getEdgeOfPeriod(
previousPeriod
)
);
};
}
function getMonthStart(
date
) {
var year = getYear(
date
),
month = getMonth(
date
),
monthStartDate = new Date(
);
return (
monthStartDate.setFullYear(
year,
month,
1
),
monthStartDate.setHours(
0,
0,
0,
0
),
monthStartDate
);
}
var getPreviousMonthStart = makeGetEdgeOfNeighborMonth(
getMonthStart,
-1
),
getNextMonthStart = makeGetEdgeOfNeighborMonth(
getMonthStart,
1
),
getMonthEnd = makeGetEnd(
getNextMonthStart
),
getPreviousMonthEnd = makeGetEdgeOfNeighborMonth(
getMonthEnd,
-1
),
getMonthRange = makeGetRange(
[getMonthStart, getMonthEnd,]
);
function makeGetEdgeOfNeighborDay(
getEdgeOfPeriod, defaultOffset
) {
return function (
date
) {
var offset =
arguments.length > 1 && void 0 !== arguments[1]
? arguments[1]
: defaultOffset,
year = getYear(
date
),
month = getMonth(
date
),
day = getDate(
date
) + offset,
previousPeriod = new Date(
);
return (
previousPeriod.setFullYear(
year,
month,
day
),
previousPeriod.setHours(
0,
0,
0,
0
),
getEdgeOfPeriod(
previousPeriod
)
);
};
}
function getDayStart(
date
) {
var year = getYear(
date
),
month = getMonth(
date
),
day = getDate(
date
),
dayStartDate = new Date(
);
return (
dayStartDate.setFullYear(
year,
month,
day
),
dayStartDate.setHours(
0,
0,
0,
0
),
dayStartDate
);
}
var _CALENDAR_TYPE_LOCALE,
getNextDayStart = makeGetEdgeOfNeighborDay(
getDayStart,
1
),
getDayEnd = makeGetEnd(
getNextDayStart
),
getDayRange = makeGetRange(
[getDayStart, getDayEnd,]
);
function getDaysInMonth(
date
) {
return getDate(
getMonthEnd(
date
)
);
}
function _toConsumableArray$2(
arr
) {
return (
_array_without_holes$2(
arr
) ||
_iterableToArray$2(
arr
) ||
_unsupported_iterable_to_array$2(
arr
) ||
_nonIterableSpread$2(
)
);
}
function _nonIterableSpread$2(
) {
throw new TypeError(
"Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."
);
}
function _unsupported_iterable_to_array$2(
o, minLen
) {
if (o) {
if ("string" == typeof o) return _array_like_to_array$2(
o,
minLen
);
var n = Object.prototype.toString.call(
o
).slice(
8,
-1
);
return (
"Object" === n && o.constructor && (n = o.constructor.name),
"Map" === n || "Set" === n
? Array.from(
o
)
: "Arguments" === n ||
/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(
n
)
? _array_like_to_array$2(
o,
minLen
)
: void 0
);
}
}
function _iterableToArray$2(
iter
) {
if ("undefined" != typeof Symbol && Symbol.iterator in Object(
iter
))
return Array.from(
iter
);
}
function _array_without_holes$2(
arr
) {
if (Array.isArray(
arr
)) return _array_like_to_array$2(
arr
);
}
function _array_like_to_array$2(
arr, len
) {
(null == len || len > arr.length) && (len = arr.length);
for (var i = 0, arr2 = new Array(
len
); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _define_property$c(
obj, key, value
) {
return (
key in obj
? Object.defineProperty(
obj,
key,
{
value: value,
enumerable: !0,
configurable: !0,
writable: !0,
}
)
: (obj[key] = value),
obj
);
}
var CALENDAR_TYPES = {
ARABIC: "Arabic",
HEBREW: "Hebrew",
ISO_8601: "ISO 8601",
US: "US",
},
CALENDAR_TYPE_LOCALES =
(_define_property$c(
(_CALENDAR_TYPE_LOCALE = {
}),
CALENDAR_TYPES.US,
[
"en-CA",
"en-US",
"es-AR",
"es-BO",
"es-CL",
"es-CO",
"es-CR",
"es-DO",
"es-EC",
"es-GT",
"es-HN",
"es-MX",
"es-NI",
"es-PA",
"es-PE",
"es-PR",
"es-SV",
"es-VE",
"pt-BR",
]
),
_define_property$c(
_CALENDAR_TYPE_LOCALE,
CALENDAR_TYPES.ARABIC,
[
"ar",
"ar-AE",
"ar-BH",
"ar-DZ",
"ar-EG",
"ar-IQ",
"ar-JO",
"ar-KW",
"ar-LY",
"ar-OM",
"ar-QA",
"ar-SA",
"ar-SD",
"ar-SY",
"ar-YE",
"dv",
"dv-MV",
"ps",
"ps-AR",
]
),
_define_property$c(
_CALENDAR_TYPE_LOCALE,
CALENDAR_TYPES.HEBREW,
[
"he",
"he-IL",
]
),
_CALENDAR_TYPE_LOCALE),
WEEKDAYS = _toConsumableArray$2(
Array(
7
)
).map(
function (
el, index
) {
return index;
}
);
function getFormatter(
options
) {
return function (
locale, date
) {
return date.toLocaleString(
locale || getUserLocale(
),
options
);
};
}
function toSafeHour(
date
) {
var safeDate = new Date(
date
);
return new Date(
safeDate.setHours(
12
)
);
}
function getSafeFormatter(
options
) {
return function (
locale, date
) {
return getFormatter(
options
)(
locale,
toSafeHour(
date
)
);
};
}
var formatDayOptions = {
day: "numeric",
},
formatLongDateOptions = {
day: "numeric",
month: "long",
year: "numeric",
},
formatMonthOptions = {
month: "long",
},
formatMonthYearOptions = {
month: "long",
year: "numeric",
},
formatShortWeekdayOptions = {
weekday: "short",
},
formatWeekdayOptions = {
weekday: "long",
},
formatYearOptions = {
year: "numeric",
},
formatDay = getSafeFormatter(
formatDayOptions
),
formatLongDate = getSafeFormatter(
formatLongDateOptions
),
formatMonth = getSafeFormatter(
formatMonthOptions
),
formatMonthYear = getSafeFormatter(
formatMonthYearOptions
),
formatShortWeekday = getSafeFormatter(
formatShortWeekdayOptions
),
formatWeekday = getSafeFormatter(
formatWeekdayOptions
),
formatYear = getSafeFormatter(
formatYearOptions
),
SUNDAY = WEEKDAYS[0],
FRIDAY = WEEKDAYS[5],
SATURDAY = WEEKDAYS[6];
function getDayOfWeek(
date
) {
var calendarType =
arguments.length > 1 && void 0 !== arguments[1]
? arguments[1]
: CALENDAR_TYPES.ISO_8601,
weekday = date.getDay(
);
switch (calendarType) {
case CALENDAR_TYPES.ISO_8601:
return (weekday + 6) % 7;
case CALENDAR_TYPES.ARABIC:
return (weekday + 1) % 7;
case CALENDAR_TYPES.HEBREW:
case CALENDAR_TYPES.US:
return weekday;
default:
throw new Error(
"Unsupported calendar type."
);
}
}
function getBeginOfCenturyYear(
date
) {
return getYear(
getCenturyStart(
date
)
);
}
function getBeginOfDecadeYear(
date
) {
return getYear(
getDecadeStart(
date
)
);
}
function getBeginOfWeek(
date
) {
var calendarType =
arguments.length > 1 && void 0 !== arguments[1]
? arguments[1]
: CALENDAR_TYPES.ISO_8601,
year = getYear(
date
),
monthIndex = getMonth(
date
),
day = date.getDate(
) - getDayOfWeek(
date,
calendarType
);
return new Date(
year,
monthIndex,
day
);
}
function getWeekNumber(
date
) {
var beginOfFirstWeek,
calendarType =
arguments.length > 1 && void 0 !== arguments[1]
? arguments[1]
: CALENDAR_TYPES.ISO_8601,
calendarTypeForWeekNumber =
calendarType === CALENDAR_TYPES.US
? CALENDAR_TYPES.US
: CALENDAR_TYPES.ISO_8601,
beginOfWeek = getBeginOfWeek(
date,
calendarTypeForWeekNumber
),
year = getYear(
date
) + 1;
do {
(beginOfFirstWeek = getBeginOfWeek(
new Date(
year,
0,
calendarTypeForWeekNumber === CALENDAR_TYPES.ISO_8601 ? 4 : 1
),
calendarTypeForWeekNumber
)),
(year -= 1);
} while (date - beginOfFirstWeek < 0);
return Math.round(
(beginOfWeek - beginOfFirstWeek) / 6048e5
) + 1;
}
function getBegin(
rangeType, date
) {
switch (rangeType) {
case "century":
return getCenturyStart(
date
);
case "decade":
return getDecadeStart(
date
);
case "year":
return getYearStart(
date
);
case "month":
return getMonthStart(
date
);
case "day":
return getDayStart(
date
);
default:
throw new Error(
"Invalid rangeType: ".concat(
rangeType
)
);
}
}
function getBeginPrevious(
rangeType, date
) {
switch (rangeType) {
case "century":
return getPreviousCenturyStart(
date
);
case "decade":
return getPreviousDecadeStart(
date
);
case "year":
return getPreviousYearStart(
date
);
case "month":
return getPreviousMonthStart(
date
);
default:
throw new Error(
"Invalid rangeType: ".concat(
rangeType
)
);
}
}
function getBeginNext(
rangeType, date
) {
switch (rangeType) {
case "century":
return getNextCenturyStart(
date
);
case "decade":
return getNextDecadeStart(
date
);
case "year":
return getNextYearStart(
date
);
case "month":
return getNextMonthStart(
date
);
default:
throw new Error(
"Invalid rangeType: ".concat(
rangeType
)
);
}
}
var getBeginPrevious2 = function (
rangeType, date
) {
switch (rangeType) {
case "decade":
return getPreviousDecadeStart(
date,
-100
);
case "year":
return getPreviousYearStart(
date,
-10
);
case "month":
return getPreviousMonthStart(
date,
-12
);
default:
throw new Error(
"Invalid rangeType: ".concat(
rangeType
)
);
}
},
getBeginNext2 = function (
rangeType, date
) {
switch (rangeType) {
case "decade":
return getNextDecadeStart(
date,
100
);
case "year":
return getNextYearStart(
date,
10
);
case "month":
return getNextMonthStart(
date,
12
);
default:
throw new Error(
"Invalid rangeType: ".concat(
rangeType
)
);
}
};
function getEnd(
rangeType, date
) {
switch (rangeType) {
case "century":
return getCenturyEnd(
date
);
case "decade":
return getDecadeEnd(
date
);
case "year":
return getYearEnd(
date
);
case "month":
return getMonthEnd(
date
);
case "day":
return getDayEnd(
date
);
default:
throw new Error(
"Invalid rangeType: ".concat(
rangeType
)
);
}
}
function getEndPrevious(
rangeType, date
) {
switch (rangeType) {
case "century":
return getPreviousCenturyEnd(
date
);
case "decade":
return getPreviousDecadeEnd(
date
);
case "year":
return getPreviousYearEnd(
date
);
case "month":
return getPreviousMonthEnd(
date
);
default:
throw new Error(
"Invalid rangeType: ".concat(
rangeType
)
);
}
}
var getEndPrevious2 = function (
rangeType, date
) {
switch (rangeType) {
case "decade":
return getPreviousDecadeEnd(
date,
-100
);
case "year":
return getPreviousYearEnd(
date,
-10
);
case "month":
return getPreviousMonthEnd(
date,
-12
);
default:
throw new Error(
"Invalid rangeType: ".concat(
rangeType
)
);
}
};
function getRange(
rangeType, date
) {
switch (rangeType) {
case "century":
return getCenturyRange(
date
);
case "decade":
return getDecadeRange(
date
);
case "year":
return getYearRange(
date
);
case "month":
return getMonthRange(
date
);
case "day":
return getDayRange(
date
);
default:
throw new Error(
"Invalid rangeType: ".concat(
rangeType
)
);
}
}
function getValueRange(
rangeType, date1, date2
) {
var rawNextValue = [date1, date2,].sort(
function (
a, b
) {
return a - b;
}
);
return [
getBegin(
rangeType,
rawNextValue[0]
),
getEnd(
rangeType,
rawNextValue[1]
),
];
}
function toYearLabel(
locale
) {
var formatYear$1 =
arguments.length > 1 && void 0 !== arguments[1]
? arguments[1]
: formatYear,
dates = arguments.length > 2 ? arguments[2] : void 0;
return dates
.map(
function (
date
) {
return formatYear$1(
locale,
date
);
}
)
.join(
" – "
);
}
function getCenturyLabel(
locale, formatYear, date
) {
return toYearLabel(
locale,
formatYear,
getCenturyRange(
date
)
);
}
function getDecadeLabel(
locale, formatYear, date
) {
return toYearLabel(
locale,
formatYear,
getDecadeRange(
date
)
);
}
function isWeekend(
date
) {
var calendarType =
arguments.length > 1 && void 0 !== arguments[1]
? arguments[1]
: CALENDAR_TYPES.ISO_8601,
weekday = date.getDay(
);
switch (calendarType) {
case CALENDAR_TYPES.ARABIC:
case CALENDAR_TYPES.HEBREW:
return weekday === FRIDAY || weekday === SATURDAY;
case CALENDAR_TYPES.ISO_8601:
case CALENDAR_TYPES.US:
return weekday === SATURDAY || weekday === SUNDAY;
default:
throw new Error(
"Unsupported calendar type."
);
}
}
function _typeof$2(
obj
) {
return (_typeof$2 =
"function" == typeof Symbol && "symbol" == typeof Symbol.iterator
? function (
obj
) {
return typeof obj;
}
: function (
obj
) {
return obj &&
"function" == typeof Symbol &&
obj.constructor === Symbol &&
obj !== Symbol.prototype
? "symbol"
: typeof obj;
})(
obj
);
}
var calendarTypes = Object.values(
CALENDAR_TYPES
),
allViews$1 = ["century", "decade", "year", "month",],
isCalendarType = PropTypes.oneOf(
calendarTypes
),
isClassName = PropTypes.oneOfType(
[
PropTypes.string,
PropTypes.arrayOf(
PropTypes.string
),
]
),
isMinDate = function (
props, propName, componentName
) {
var minDate = props[propName];
if (!minDate) return null;
if (!(minDate instanceof Date))
return new Error(
"Invalid prop `"
.concat(
propName,
"` of type `"
)
.concat(
_typeof$2(
minDate
),
"` supplied to `"
)
.concat(
componentName,
"`, expected instance of `Date`."
)
);
var maxDate = props.maxDate;
return maxDate && minDate > maxDate
? new Error(
"Invalid prop `"
.concat(
propName,
"` of type `"
)
.concat(
_typeof$2(
minDate
),
"` supplied to `"
)
.concat(
componentName,
"`, minDate cannot be larger than maxDate."
)
)
: null;
},
isMaxDate = function (
props, propName, componentName
) {
var maxDate = props[propName];
if (!maxDate) return null;
if (!(maxDate instanceof Date))
return new Error(
"Invalid prop `"
.concat(
propName,
"` of type `"
)
.concat(
_typeof$2(
maxDate
),
"` supplied to `"
)
.concat(
componentName,
"`, expected instance of `Date`."
)
);
var minDate = props.minDate;
return minDate && maxDate < minDate
? new Error(
"Invalid prop `"
.concat(
propName,
"` of type `"
)
.concat(
_typeof$2(
maxDate
),
"` supplied to `"
)
.concat(
componentName,
"`, maxDate cannot be smaller than minDate."
)
)
: null;
},
isRef = PropTypes.oneOfType(
[
PropTypes.func,
PropTypes.shape(
{
current: PropTypes.any,
}
),
]
),
isValue = PropTypes.oneOfType(
[
PropTypes.instanceOf(
Date
),
PropTypes.arrayOf(
PropTypes.instanceOf(
Date
)
),
]
),
isViews = PropTypes.arrayOf(
PropTypes.oneOf(
allViews$1
)
),
isView = function (
props, propName, componentName
) {
var view = props[propName],
allowedViews = props.views || allViews$1;
return void 0 !== view && -1 === allowedViews.indexOf(
view
)
? new Error(
"Invalid prop `"
.concat(
propName,
"` of value `"
)
.concat(
view,
"` supplied to `"
)
.concat(
componentName,
"`, expected one of ["
)
.concat(
allowedViews
.map(
function (
a
) {
return '"'.concat(
a,
'"'
);
}
)
.join(
", "
),
"]."
)
)
: null;
};
isView.isRequired = function (
props, propName, componentName
) {
var view = props[propName];
return view
? isView(
props,
propName,
componentName
)
: new Error(
"The prop `"
.concat(
propName,
"` is marked as required in `"
)
.concat(
componentName,
"`, but its value is `"
)
.concat(
view,
"`."
)
);
};
var tileGroupProps = {
activeStartDate: PropTypes.instanceOf(
Date
).isRequired,
hover: PropTypes.instanceOf(
Date
),
locale: PropTypes.string,
maxDate: isMaxDate,
minDate: isMinDate,
onClick: PropTypes.func,
onMouseOver: PropTypes.func,
tileClassName: PropTypes.oneOfType(
[PropTypes.func, isClassName,]
),
tileContent: PropTypes.oneOfType(
[PropTypes.func, PropTypes.node,]
),
value: isValue,
valueType: PropTypes.string,
},
tileProps = {
activeStartDate: PropTypes.instanceOf(
Date
).isRequired,
classes: PropTypes.arrayOf(
PropTypes.string
).isRequired,
date: PropTypes.instanceOf(
Date
).isRequired,
locale: PropTypes.string,
maxDate: isMaxDate,
minDate: isMinDate,
onClick: PropTypes.func,
onMouseOver: PropTypes.func,
style: PropTypes.objectOf(
PropTypes.oneOfType(
[PropTypes.string, PropTypes.number,]
)
),
tileClassName: PropTypes.oneOfType(
[PropTypes.func, isClassName,]
),
tileContent: PropTypes.oneOfType(
[PropTypes.func, PropTypes.node,]
),
tileDisabled: PropTypes.func,
},
className$5 = "react-calendar__navigation";
function Navigation(
_ref
) {
var labelClassName,
activeStartDate = _ref.activeStartDate,
drillUp = _ref.drillUp,
_ref$formatMonthYear = _ref.formatMonthYear,
formatMonthYear$1 =
void 0 === _ref$formatMonthYear
? formatMonthYear
: _ref$formatMonthYear,
_ref$formatYear = _ref.formatYear,
formatYear$1 =
void 0 === _ref$formatYear ? formatYear : _ref$formatYear,
locale = _ref.locale,
maxDate = _ref.maxDate,
minDate = _ref.minDate,
_ref$navigationAriaLa = _ref.navigationAriaLabel,
navigationAriaLabel =
void 0 === _ref$navigationAriaLa ? "" : _ref$navigationAriaLa,
navigationLabel = _ref.navigationLabel,
_ref$next2AriaLabel = _ref.next2AriaLabel,
next2AriaLabel =
void 0 === _ref$next2AriaLabel ? "" : _ref$next2AriaLabel,
_ref$next2Label = _ref.next2Label,
next2Label = void 0 === _ref$next2Label ? "»" : _ref$next2Label,
_ref$nextAriaLabel = _ref.nextAriaLabel,
nextAriaLabel = void 0 === _ref$nextAriaLabel ? "" : _ref$nextAriaLabel,
_ref$nextLabel = _ref.nextLabel,
nextLabel = void 0 === _ref$nextLabel ? "›" : _ref$nextLabel,
_ref$prev2AriaLabel = _ref.prev2AriaLabel,
prev2AriaLabel =
void 0 === _ref$prev2AriaLabel ? "" : _ref$prev2AriaLabel,
_ref$prev2Label = _ref.prev2Label,
prev2Label = void 0 === _ref$prev2Label ? "«" : _ref$prev2Label,
_ref$prevAriaLabel = _ref.prevAriaLabel,
prevAriaLabel = void 0 === _ref$prevAriaLabel ? "" : _ref$prevAriaLabel,
_ref$prevLabel = _ref.prevLabel,
prevLabel = void 0 === _ref$prevLabel ? "‹" : _ref$prevLabel,
setActiveStartDate = _ref.setActiveStartDate,
showDoubleView = _ref.showDoubleView,
view = _ref.view,
drillUpAvailable = _ref.views.indexOf(
view
) > 0,
shouldShowPrevNext2Buttons = "century" !== view,
previousActiveStartDate = getBeginPrevious(
view,
activeStartDate
),
previousActiveStartDate2 =
shouldShowPrevNext2Buttons &&
getBeginPrevious2(
view,
activeStartDate
),
nextActiveStartDate = getBeginNext(
view,
activeStartDate
),
nextActiveStartDate2 =
shouldShowPrevNext2Buttons && getBeginNext2(
view,
activeStartDate
),
prevButtonDisabled = (function (
) {
if (previousActiveStartDate.getFullYear(
) < 0) return !0;
var previousActiveEndDate = getEndPrevious(
view,
activeStartDate
);
return minDate && minDate >= previousActiveEndDate;
})(
),
prev2ButtonDisabled =
shouldShowPrevNext2Buttons &&
(function (
) {
if (previousActiveStartDate2.getFullYear(
) < 0) return !0;
var previousActiveEndDate = getEndPrevious2(
view,
activeStartDate
);
return minDate && minDate >= previousActiveEndDate;
})(
),
nextButtonDisabled = maxDate && maxDate <= nextActiveStartDate,
next2ButtonDisabled =
shouldShowPrevNext2Buttons &&
maxDate &&
maxDate <= nextActiveStartDate2;
function renderLabel(
date
) {
var label = (function (
) {
switch (view) {
case "century":
return getCenturyLabel(
locale,
formatYear$1,
date
);
case "decade":
return getDecadeLabel(
locale,
formatYear$1,
date
);
case "year":
return formatYear$1(
locale,
date
);
case "month":
return formatMonthYear$1(
locale,
date
);
default:
throw new Error(
"Invalid view: ".concat(
view,
"."
)
);
}
})(
);
return navigationLabel
? navigationLabel(
{
date: date,
label: label,
locale: locale || getUserLocale(
),
view: view,
}
)
: label;
}
return React.createElement(
"div",
{
className: className$5,
style: {
display: "flex",
},
},
null !== prev2Label &&
shouldShowPrevNext2Buttons &&
React.createElement(
"button",
{
"aria-label": prev2AriaLabel,
className: ""
.concat(
className$5,
"__arrow "
)
.concat(
className$5,
"__prev2-button"
),
disabled: prev2ButtonDisabled,
onClick: function (
) {
setActiveStartDate(
previousActiveStartDate2
);
},
type: "button",
},
prev2Label
),
null !== prevLabel &&
React.createElement(
"button",
{
"aria-label": prevAriaLabel,
className: ""
.concat(
className$5,
"__arrow "
)
.concat(
className$5,
"__prev-button"
),
disabled: prevButtonDisabled,
onClick: function (
) {
setActiveStartDate(
previousActiveStartDate
);
},
type: "button",
},
prevLabel
),
((labelClassName = "".concat(
className$5,
"__label"
)),
React.createElement(
"button",
{
"aria-label": navigationAriaLabel,
className: labelClassName,
disabled: !drillUpAvailable,
onClick: drillUp,
style: {
flexGrow: 1,
},
type: "button",
},
React.createElement(
"span",
{
className: ""
.concat(
labelClassName,
"__labelText "
)
.concat(
labelClassName,
"__labelText--from"
),
},
renderLabel(
activeStartDate
)
),
showDoubleView &&
React.createElement(
React.Fragment,
null,
React.createElement(
"span",
{
className: "".concat(
labelClassName,
"__divider"
),
},
" ",
"–",
" "
),
React.createElement(
"span",
{
className: ""
.concat(
labelClassName,
"__labelText "
)
.concat(
labelClassName,
"__labelText--to"
),
},
renderLabel(
nextActiveStartDate
)
)
)
)),
null !== nextLabel &&
React.createElement(
"button",
{
"aria-label": nextAriaLabel,
className: ""
.concat(
className$5,
"__arrow "
)
.concat(
className$5,
"__next-button"
),
disabled: nextButtonDisabled,
onClick: function (
) {
setActiveStartDate(
nextActiveStartDate
);
},
type: "button",
},
nextLabel
),
null !== next2Label &&
shouldShowPrevNext2Buttons &&
React.createElement(
"button",
{
"aria-label": next2AriaLabel,
className: ""
.concat(
className$5,
"__arrow "
)
.concat(
className$5,
"__next2-button"
),
disabled: next2ButtonDisabled,
onClick: function (
) {
setActiveStartDate(
nextActiveStartDate2
);
},
type: "button",
},
next2Label
)
);
}
function _extends$c(
) {
return (_extends$c =
Object.assign ||
function (
target
) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source)
Object.prototype.hasOwnProperty.call(
source,
key
) &&
(target[key] = source[key]);
}
return target;
}).apply(
this,
arguments
);
}
function ownKeys$b(
object, enumerableOnly
) {
var keys = Object.keys(
object
);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(
object
);
enumerableOnly &&
(symbols = symbols.filter(
function (
sym
) {
return Object.getOwnPropertyDescriptor(
object,
sym
).enumerable;
}
)),
keys.push.apply(
keys,
symbols
);
}
return keys;
}
function _object_spread$b(
target
) {
for (var i = 1; i < arguments.length; i++) {
var source = null != arguments[i]
? arguments[i]
: {
};
i % 2
? ownKeys$b(
Object(
source
),
!0
).forEach(
function (
key
) {
_define_property$b(
target,
key,
source[key]
);
}
)
: Object.getOwnPropertyDescriptors
? Object.defineProperties(
target,
Object.getOwnPropertyDescriptors(
source
)
)
: ownKeys$b(
Object(
source
)
).forEach(
function (
key
) {
Object.defineProperty(
target,
key,
Object.getOwnPropertyDescriptor(
source,
key
)
);
}
);
}
return target;
}
function _define_property$b(
obj, key, value
) {
return (
key in obj
? Object.defineProperty(
obj,
key,
{
value: value,
enumerable: !0,
configurable: !0,
writable: !0,
}
)
: (obj[key] = value),
obj
);
}
function _object_without_properties$8(
source, excluded
) {
if (null == source) return {
};
var key,
i,
target = _object_without_properties_loose$8(
source,
excluded
);
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(
source
);
for (i = 0; i < sourceSymbolKeys.length; i++)
(key = sourceSymbolKeys[i]),
excluded.indexOf(
key
) >= 0 ||
(Object.prototype.propertyIsEnumerable.call(
source,
key
) &&
(target[key] = source[key]));
}
return target;
}
function _object_without_properties_loose$8(
source, excluded
) {
if (null == source) return {
};
var key,
i,
target = {
},
sourceKeys = Object.keys(
source
);
for (i = 0; i < sourceKeys.length; i++)
(key = sourceKeys[i]),
excluded.indexOf(
key
) >= 0 || (target[key] = source[key]);
return target;
}
function toPercent(
num
) {
return "".concat(
num,
"%"
);
}
function Flex(
_ref
) {
var children = _ref.children,
className = _ref.className,
direction = _ref.direction,
count = _ref.count,
offset = _ref.offset,
style = _ref.style,
wrap = _ref.wrap,
otherProps = _object_without_properties$8(
_ref,
[
"children",
"className",
"direction",
"count",
"offset",
"style",
"wrap",
]
);
return React.createElement(
"div",
_extends$c(
{
className: className,
style: _object_spread$b(
{
display: "flex",
flexDirection: direction,
flexWrap: wrap ? "wrap" : "no-wrap",
},
style
),
},
otherProps
),
React.Children.map(
children,
function (
child, index
) {
return React.cloneElement(
child,
_object_spread$b(
_object_spread$b(
{
},
child.props
),
{
},
{
style: {
flexBasis: toPercent(
100 / count
),
maxWidth: toPercent(
100 / count
),
overflow: "hidden",
marginLeft:
offset && 0 === index
? toPercent(
(100 * offset) / count
)
: null,
},
}
)
);
}
)
);
}
function _toConsumableArray$1(
arr
) {
return (
_array_without_holes$1(
arr
) ||
_iterableToArray$1(
arr
) ||
_unsupported_iterable_to_array$1(
arr
) ||
_nonIterableSpread$1(
)
);
}
function _nonIterableSpread$1(
) {
throw new TypeError(
"Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."
);
}
function _unsupported_iterable_to_array$1(
o, minLen
) {
if (o) {
if ("string" == typeof o) return _array_like_to_array$1(
o,
minLen
);
var n = Object.prototype.toString.call(
o
).slice(
8,
-1
);
return (
"Object" === n && o.constructor && (n = o.constructor.name),
"Map" === n || "Set" === n
? Array.from(
o
)
: "Arguments" === n ||
/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(
n
)
? _array_like_to_array$1(
o,
minLen
)
: void 0
);
}
}
function _iterableToArray$1(
iter
) {
if ("undefined" != typeof Symbol && Symbol.iterator in Object(
iter
))
return Array.from(
iter
);
}
function _array_without_holes$1(
arr
) {
if (Array.isArray(
arr
)) return _array_like_to_array$1(
arr
);
}
function _array_like_to_array$1(
arr, len
) {
(null == len || len > arr.length) && (len = arr.length);
for (var i = 0, arr2 = new Array(
len
); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function between(
value, min, max
) {
return min && min > value ? min : max && max < value ? max : value;
}
function isValueWithinRange(
value, range
) {
return range[0] <= value && range[1] >= value;
}
function isRangeWithinRange(
greaterRange, smallerRange
) {
return (
greaterRange[0] <= smallerRange[0] && greaterRange[1] >= smallerRange[1]
);
}
function doRangesOverlap(
range1, range2
) {
return (
isValueWithinRange(
range1[0],
range2
) ||
isValueWithinRange(
range1[1],
range2
)
);
}
function getRangeClassNames(
valueRange, dateRange, baseClassName
) {
var classes = [];
if (doRangesOverlap(
dateRange,
valueRange
)) {
classes.push(
baseClassName
);
var isRangeStart = isValueWithinRange(
valueRange[0],
dateRange
),
isRangeEnd = isValueWithinRange(
valueRange[1],
dateRange
);
isRangeStart && classes.push(
"".concat(
baseClassName,
"Start"
)
),
isRangeEnd && classes.push(
"".concat(
baseClassName,
"End"
)
),
isRangeStart &&
isRangeEnd &&
classes.push(
"".concat(
baseClassName,
"BothEnds"
)
);
}
return classes;
}
function getTileClasses(
) {
var _ref =
arguments.length > 0 && void 0 !== arguments[0]
? arguments[0]
: {
},
value = _ref.value,
valueType = _ref.valueType,
date = _ref.date,
dateType = _ref.dateType,
hover = _ref.hover,
className = "react-calendar__tile",
classes = [className,];
if (!date) return classes;
if (!Array.isArray(
date
) && !dateType)
throw new Error(
"getTileClasses(): Unable to get tile activity classes because one or more required arguments were not passed."
);
var now = new Date(
),
dateRange = Array.isArray(
date
)
? date
: getRange(
dateType,
date
);
if (
(isValueWithinRange(
now,
dateRange
) &&
classes.push(
"".concat(
className,
"--now"
)
),
!value)
)
return classes;
if (!Array.isArray(
value
) && !valueType)
throw new Error(
"getTileClasses(): Unable to get tile activity classes because one or more required arguments were not passed."
);
var valueRange = Array.isArray(
value
)
? value
: getRange(
valueType,
value
);
isRangeWithinRange(
valueRange,
dateRange
)
? classes.push(
"".concat(
className,
"--active"
)
)
: doRangesOverlap(
valueRange,
dateRange
) &&
classes.push(
"".concat(
className,
"--hasActive"
)
);
var valueRangeClassNames = getRangeClassNames(
valueRange,
dateRange,
"".concat(
className,
"--range"
)
);
if (
(classes.push.apply(
classes,
_toConsumableArray$1(
valueRangeClassNames
)
),
hover)
) {
var hoverRange =
hover > valueRange[1]
? [valueRange[1], hover,]
: [hover, valueRange[0],],
hoverRangeClassNames = getRangeClassNames(
hoverRange,
dateRange,
"".concat(
className,
"--hover"
)
);
classes.push.apply(
classes,
_toConsumableArray$1(
hoverRangeClassNames
)
);
}
return classes;
}
function ownKeys$a(
object, enumerableOnly
) {
var keys = Object.keys(
object
);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(
object
);
enumerableOnly &&
(symbols = symbols.filter(
function (
sym
) {
return Object.getOwnPropertyDescriptor(
object,
sym
).enumerable;
}
)),
keys.push.apply(
keys,
symbols
);
}
return keys;
}
function _object_spread$a(
target
) {
for (var i = 1; i < arguments.length; i++) {
var source = null != arguments[i]
? arguments[i]
: {
};
i % 2
? ownKeys$a(
Object(
source
),
!0
).forEach(
function (
key
) {
_define_property$a(
target,
key,
source[key]
);
}
)
: Object.getOwnPropertyDescriptors
? Object.defineProperties(
target,
Object.getOwnPropertyDescriptors(
source
)
)
: ownKeys$a(
Object(
source
)
).forEach(
function (
key
) {
Object.defineProperty(
target,
key,
Object.getOwnPropertyDescriptor(
source,
key
)
);
}
);
}
return target;
}
function _define_property$a(
obj, key, value
) {
return (
key in obj
? Object.defineProperty(
obj,
key,
{
value: value,
enumerable: !0,
configurable: !0,
writable: !0,
}
)
: (obj[key] = value),
obj
);
}
function _extends$b(
) {
return (_extends$b =
Object.assign ||
function (
target
) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source)
Object.prototype.hasOwnProperty.call(
source,
key
) &&
(target[key] = source[key]);
}
return target;
}).apply(
this,
arguments
);
}
function _object_without_properties$7(
source, excluded
) {
if (null == source) return {
};
var key,
i,
target = _object_without_properties_loose$7(
source,
excluded
);
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(
source
);
for (i = 0; i < sourceSymbolKeys.length; i++)
(key = sourceSymbolKeys[i]),
excluded.indexOf(
key
) >= 0 ||
(Object.prototype.propertyIsEnumerable.call(
source,
key
) &&
(target[key] = source[key]));
}
return target;
}
function _object_without_properties_loose$7(
source, excluded
) {
if (null == source) return {
};
var key,
i,
target = {
},
sourceKeys = Object.keys(
source
);
for (i = 0; i < sourceKeys.length; i++)
(key = sourceKeys[i]),
excluded.indexOf(
key
) >= 0 || (target[key] = source[key]);
return target;
}
function TileGroup(
_ref
) {
for (
var className = _ref.className,
_ref$count = _ref.count,
count = void 0 === _ref$count ? 3 : _ref$count,
dateTransform = _ref.dateTransform,
dateType = _ref.dateType,
end = _ref.end,
hover = _ref.hover,
offset = _ref.offset,
start = _ref.start,
_ref$step = _ref.step,
step = void 0 === _ref$step ? 1 : _ref$step,
Tile = _ref.tile,
value = _ref.value,
valueType = _ref.valueType,
tileProps = _object_without_properties$7(
_ref,
[
"className",
"count",
"dateTransform",
"dateType",
"end",
"hover",
"offset",
"start",
"step",
"tile",
"value",
"valueType",
]
),
tiles = [],
point = start;
point <= end;
point += step
) {
var date = dateTransform(
point
);
tiles.push(
React.createElement(
Tile,
_extends$b(
{
key: date.getTime(
),
classes: getTileClasses(
{
value: value,
valueType: valueType,
date: date,
dateType: dateType,
hover: hover,
}
),
date: date,
point: point,
},
tileProps
)
)
);
}
return React.createElement(
Flex,
{
className: className,
count: count,
offset: offset,
wrap: !0,
},
tiles
);
}
function ownKeys$9(
object, enumerableOnly
) {
var keys = Object.keys(
object
);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(
object
);
enumerableOnly &&
(symbols = symbols.filter(
function (
sym
) {
return Object.getOwnPropertyDescriptor(
object,
sym
).enumerable;
}
)),
keys.push.apply(
keys,
symbols
);
}
return keys;
}
function _object_spread$9(
target
) {
for (var i = 1; i < arguments.length; i++) {
var source = null != arguments[i]
? arguments[i]
: {
};
i % 2
? ownKeys$9(
Object(
source
),
!0
).forEach(
function (
key
) {
_define_property$9(
target,
key,
source[key]
);
}
)
: Object.getOwnPropertyDescriptors
? Object.defineProperties(
target,
Object.getOwnPropertyDescriptors(
source
)
)
: ownKeys$9(
Object(
source
)
).forEach(
function (
key
) {
Object.defineProperty(
target,
key,
Object.getOwnPropertyDescriptor(
source,
key
)
);
}
);
}
return target;
}
function _typeof$1(
obj
) {
return (_typeof$1 =
"function" == typeof Symbol && "symbol" == typeof Symbol.iterator
? function (
obj
) {
return typeof obj;
}
: function (
obj
) {
return obj &&
"function" == typeof Symbol &&
obj.constructor === Symbol &&
obj !== Symbol.prototype
? "symbol"
: typeof obj;
})(
obj
);
}
function _class_call_check$1(
instance, Constructor
) {
if (!(instance instanceof Constructor))
throw new TypeError(
"Cannot call a class as a function"
);
}
function _defineProperties$1(
target, props
) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
(descriptor.enumerable = descriptor.enumerable || !1),
(descriptor.configurable = !0),
"value" in descriptor && (descriptor.writable = !0),
Object.defineProperty(
target,
descriptor.key,
descriptor
);
}
}
function _create_class$1(
Constructor, protoProps, staticProps
) {
return (
protoProps && _defineProperties$1(
Constructor.prototype,
protoProps
),
staticProps && _defineProperties$1(
Constructor,
staticProps
),
Constructor
);
}
function _inherits$1(
subClass, superClass
) {
if ("function" != typeof superClass && null !== superClass)
throw new TypeError(
"Super expression must either be null or a function"
);
(subClass.prototype = Object.create(
superClass && superClass.prototype,
{
constructor: {
value: subClass,
writable: !0,
configurable: !0,
},
}
)),
superClass && _set_prototype_of$1(
subClass,
superClass
);
}
function _set_prototype_of$1(
o, p
) {
return (_set_prototype_of$1 =
Object.setPrototypeOf ||
function (
o, p
) {
return (o.__proto__ = p), o;
})(
o,
p
);
}
function _create_super$1(
Derived
) {
var hasNativeReflectConstruct = _is_native_reflect_construct$1(
);
return function (
) {
var result,
Super = _get_prototype_of$1(
Derived
);
if (hasNativeReflectConstruct) {
var NewTarget = _get_prototype_of$1(
this
).constructor;
result = Reflect.construct(
Super,
arguments,
NewTarget
);
} else result = Super.apply(
this,
arguments
);
return _possible_constructor_return$1(
this,
result
);
};
}
function _possible_constructor_return$1(
self, call
) {
return !call || ("object" !== _typeof$1(
call
) && "function" != typeof call)
? _assert_this_initialized$1(
self
)
: call;
}
function _assert_this_initialized$1(
self
) {
if (void 0 === self)
throw new ReferenceError(
"this hasn't been initialised - super() hasn't been called"
);
return self;
}
function _is_native_reflect_construct$1(
) {
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ("function" == typeof Proxy) return !0;
try {
return (
Date.prototype.toString.call(
Reflect.construct(
Date,
[],
function (
) {}
)
),
!0
);
} catch (e) {
return !1;
}
}
function _get_prototype_of$1(
o
) {
return (_get_prototype_of$1 = Object.setPrototypeOf
? Object.getPrototypeOf
: function (
o
) {
return o.__proto__ || Object.getPrototypeOf(
o
);
})(
o
);
}
function _define_property$9(
obj, key, value
) {
return (
key in obj
? Object.defineProperty(
obj,
key,
{
value: value,
enumerable: !0,
configurable: !0,
writable: !0,
}
)
: (obj[key] = value),
obj
);
}
function getValue$1(
nextProps, prop
) {
var activeStartDate = nextProps.activeStartDate,
date = nextProps.date,
view = nextProps.view;
return "function" == typeof prop
? prop(
{
activeStartDate: activeStartDate,
date: date,
view: view,
}
)
: prop;
}
(Navigation.propTypes = {
activeStartDate: PropTypes.instanceOf(
Date
).isRequired,
drillUp: PropTypes.func.isRequired,
formatMonthYear: PropTypes.func,
formatYear: PropTypes.func,
locale: PropTypes.string,
maxDate: PropTypes.instanceOf(
Date
),
minDate: PropTypes.instanceOf(
Date
),
navigationAriaLabel: PropTypes.string,
navigationLabel: PropTypes.func,
next2AriaLabel: PropTypes.string,
next2Label: PropTypes.node,
nextAriaLabel: PropTypes.string,
nextLabel: PropTypes.node,
prev2AriaLabel: PropTypes.string,
prev2Label: PropTypes.node,
prevAriaLabel: PropTypes.string,
prevLabel: PropTypes.node,
setActiveStartDate: PropTypes.func.isRequired,
showDoubleView: PropTypes.bool,
view: isView.isRequired,
views: isViews.isRequired,
}),
(Flex.propTypes = {
children: PropTypes.node,
className: PropTypes.string,
count: PropTypes.number.isRequired,
direction: PropTypes.string,
offset: PropTypes.number,
style: PropTypes.objectOf(
PropTypes.oneOfType(
[PropTypes.string, PropTypes.number,]
)
),
wrap: PropTypes.bool,
}),
(TileGroup.propTypes = _object_spread$a(
_object_spread$a(
{
},
tileGroupProps
),
{
},
{
activeStartDate: PropTypes.instanceOf(
Date
),
count: PropTypes.number,
dateTransform: PropTypes.func.isRequired,
dateType: PropTypes.string,
offset: PropTypes.number,
step: PropTypes.number,
tile: PropTypes.func.isRequired,
}
));
var Tile = (function (
_Component
) {
_inherits$1(
Tile,
_
);
var _super = _create_super$1(
Tile
);
function Tile(
) {
var _this;
_class_call_check$1(
this,
Tile
);
for (
var _len = arguments.length, args = new Array(
_len
), _key = 0;
_key < _len;
_key++
)
args[_key] = arguments[_key];
return (
_define_property$9(
_assert_this_initialized$1(
(_this = _super.call.apply(
_super,
[this,].concat(
args
)
))
),
"state",
{
}
),
_this
);
}
return (
_create_class$1(
Tile,
[
{
key: "render",
value: function (
) {
var _this$props = this.props,
activeStartDate = _this$props.activeStartDate,
children = _this$props.children,
classes = _this$props.classes,
date = _this$props.date,
formatAbbr = _this$props.formatAbbr,
locale = _this$props.locale,
maxDate = _this$props.maxDate,
maxDateTransform = _this$props.maxDateTransform,
minDate = _this$props.minDate,
minDateTransform = _this$props.minDateTransform,
onClick = _this$props.onClick,
onMouseOver = _this$props.onMouseOver,
style = _this$props.style,
tileDisabled = _this$props.tileDisabled,
view = _this$props.view,
_this$state = this.state,
tileClassName = _this$state.tileClassName,
tileContent = _this$state.tileContent;
return React.createElement(
"button",
{
className: mergeClassNames(
classes,
tileClassName
),
disabled:
(minDate &&
minDateTransform(
minDate
) > date) ||
(maxDate &&
maxDateTransform(
maxDate
) < date) ||
(tileDisabled &&
tileDisabled(
{
activeStartDate: activeStartDate,
date: date,
view: view,
}
)),
onClick:
onClick &&
function (
event
) {
return onClick(
date,
event
);
},
onFocus:
onMouseOver &&
function (
) {
return onMouseOver(
date
);
},
onMouseOver:
onMouseOver &&
function (
) {
return onMouseOver(
date
);
},
style: style,
type: "button",
},
formatAbbr
? React.createElement(
"abbr",
{
"aria-label": formatAbbr(
locale,
date
),
},
children
)
: children,
tileContent
);
},
},
],
[
{
key: "getDerivedStateFromProps",
value: function (
nextProps, prevState
) {
var tileClassName = nextProps.tileClassName,
tileContent = nextProps.tileContent,
nextState = {
};
return (
tileClassName !== prevState.tileClassNameProps &&
((nextState.tileClassName = getValue$1(
nextProps,
tileClassName
)),
(nextState.tileClassNameProps = tileClassName)),
tileContent !== prevState.tileContentProps &&
((nextState.tileContent = getValue$1(
nextProps,
tileContent
)),
(nextState.tileContentProps = tileContent)),
nextState
);
},
},
]
),
Tile
);
})(
);
function ownKeys$8(
object, enumerableOnly
) {
var keys = Object.keys(
object
);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(
object
);
enumerableOnly &&
(symbols = symbols.filter(
function (
sym
) {
return Object.getOwnPropertyDescriptor(
object,
sym
).enumerable;
}
)),
keys.push.apply(
keys,
symbols
);
}
return keys;
}
function _object_spread$8(
target
) {
for (var i = 1; i < arguments.length; i++) {
var source = null != arguments[i]
? arguments[i]
: {
};
i % 2
? ownKeys$8(
Object(
source
),
!0
).forEach(
function (
key
) {
_define_property$8(
target,
key,
source[key]
);
}
)
: Object.getOwnPropertyDescriptors
? Object.defineProperties(
target,
Object.getOwnPropertyDescriptors(
source
)
)
: ownKeys$8(
Object(
source
)
).forEach(
function (
key
) {
Object.defineProperty(
target,
key,
Object.getOwnPropertyDescriptor(
source,
key
)
);
}
);
}
return target;
}
function _define_property$8(
obj, key, value
) {
return (
key in obj
? Object.defineProperty(
obj,
key,
{
value: value,
enumerable: !0,
configurable: !0,
writable: !0,
}
)
: (obj[key] = value),
obj
);
}
function _extends$a(
) {
return (_extends$a =
Object.assign ||
function (
target
) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source)
Object.prototype.hasOwnProperty.call(
source,
key
) &&
(target[key] = source[key]);
}
return target;
}).apply(
this,
arguments
);
}
function _object_without_properties$6(
source, excluded
) {
if (null == source) return {
};
var key,
i,
target = _object_without_properties_loose$6(
source,
excluded
);
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(
source
);
for (i = 0; i < sourceSymbolKeys.length; i++)
(key = sourceSymbolKeys[i]),
excluded.indexOf(
key
) >= 0 ||
(Object.prototype.propertyIsEnumerable.call(
source,
key
) &&
(target[key] = source[key]));
}
return target;
}
function _object_without_properties_loose$6(
source, excluded
) {
if (null == source) return {
};
var key,
i,
target = {
},
sourceKeys = Object.keys(
source
);
for (i = 0; i < sourceKeys.length; i++)
(key = sourceKeys[i]),
excluded.indexOf(
key
) >= 0 || (target[key] = source[key]);
return target;
}
Tile.propTypes = _object_spread$9(
_object_spread$9(
{
},
tileProps
),
{
},
{
children: PropTypes.node.isRequired,
formatAbbr: PropTypes.func,
maxDateTransform: PropTypes.func.isRequired,
minDateTransform: PropTypes.func.isRequired,
}
);
var className$4 = "react-calendar__century-view__decades__decade";
function Decade(
_ref
) {
var classes = _ref.classes,
_ref$formatYear = _ref.formatYear,
formatYear$1 =
void 0 === _ref$formatYear ? formatYear : _ref$formatYear,
otherProps = _object_without_properties$6(
_ref,
[
"classes",
"formatYear",
]
),
date = otherProps.date,
locale = otherProps.locale;
return React.createElement(
Tile,
_extends$a(
{
},
otherProps,
{
classes: [].concat(
classes,
className$4
),
maxDateTransform: getDecadeEnd,
minDateTransform: getDecadeStart,
view: "century",
}
),
getDecadeLabel(
locale,
formatYear$1,
date
)
);
}
function ownKeys$7(
object, enumerableOnly
) {
var keys = Object.keys(
object
);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(
object
);
enumerableOnly &&
(symbols = symbols.filter(
function (
sym
) {
return Object.getOwnPropertyDescriptor(
object,
sym
).enumerable;
}
)),
keys.push.apply(
keys,
symbols
);
}
return keys;
}
function _object_spread$7(
target
) {
for (var i = 1; i < arguments.length; i++) {
var source = null != arguments[i]
? arguments[i]
: {
};
i % 2
? ownKeys$7(
Object(
source
),
!0
).forEach(
function (
key
) {
_define_property$7(
target,
key,
source[key]
);
}
)
: Object.getOwnPropertyDescriptors
? Object.defineProperties(
target,
Object.getOwnPropertyDescriptors(
source
)
)
: ownKeys$7(
Object(
source
)
).forEach(
function (
key
) {
Object.defineProperty(
target,
key,
Object.getOwnPropertyDescriptor(
source,
key
)
);
}
);
}
return target;
}
function _define_property$7(
obj, key, value
) {
return (
key in obj
? Object.defineProperty(
obj,
key,
{
value: value,
enumerable: !0,
configurable: !0,
writable: !0,
}
)
: (obj[key] = value),
obj
);
}
function _extends$9(
) {
return (_extends$9 =
Object.assign ||
function (
target
) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source)
Object.prototype.hasOwnProperty.call(
source,
key
) &&
(target[key] = source[key]);
}
return target;
}).apply(
this,
arguments
);
}
function Decades(
props
) {
var start = getBeginOfCenturyYear(
props.activeStartDate
),
end = start + 99;
return React.createElement(
TileGroup,
_extends$9(
{
},
props,
{
className: "react-calendar__century-view__decades",
dateTransform: getDecadeStart,
dateType: "decade",
end: end,
start: start,
step: 10,
tile: Decade,
}
)
);
}
function CenturyView(
props
) {
return React.createElement(
"div",
{
className: "react-calendar__century-view",
},
React.createElement(
Decades,
props
)
);
}
function ownKeys$6(
object, enumerableOnly
) {
var keys = Object.keys(
object
);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(
object
);
enumerableOnly &&
(symbols = symbols.filter(
function (
sym
) {
return Object.getOwnPropertyDescriptor(
object,
sym
).enumerable;
}
)),
keys.push.apply(
keys,
symbols
);
}
return keys;
}
function _object_spread$6(
target
) {
for (var i = 1; i < arguments.length; i++) {
var source = null != arguments[i]
? arguments[i]
: {
};
i % 2
? ownKeys$6(
Object(
source
),
!0
).forEach(
function (
key
) {
_define_property$6(
target,
key,
source[key]
);
}
)
: Object.getOwnPropertyDescriptors
? Object.defineProperties(
target,
Object.getOwnPropertyDescriptors(
source
)
)
: ownKeys$6(
Object(
source
)
).forEach(
function (
key
) {
Object.defineProperty(
target,
key,
Object.getOwnPropertyDescriptor(
source,
key
)
);
}
);
}
return target;
}
function _define_property$6(
obj, key, value
) {
return (
key in obj
? Object.defineProperty(
obj,
key,
{
value: value,
enumerable: !0,
configurable: !0,
writable: !0,
}
)
: (obj[key] = value),
obj
);
}
function _extends$8(
) {
return (_extends$8 =
Object.assign ||
function (
target
) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source)
Object.prototype.hasOwnProperty.call(
source,
key
) &&
(target[key] = source[key]);
}
return target;
}).apply(
this,
arguments
);
}
function _object_without_properties$5(
source, excluded
) {
if (null == source) return {
};
var key,
i,
target = _object_without_properties_loose$5(
source,
excluded
);
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(
source
);
for (i = 0; i < sourceSymbolKeys.length; i++)
(key = sourceSymbolKeys[i]),
excluded.indexOf(
key
) >= 0 ||
(Object.prototype.propertyIsEnumerable.call(
source,
key
) &&
(target[key] = source[key]));
}
return target;
}
function _object_without_properties_loose$5(
source, excluded
) {
if (null == source) return {
};
var key,
i,
target = {
},
sourceKeys = Object.keys(
source
);
for (i = 0; i < sourceKeys.length; i++)
(key = sourceKeys[i]),
excluded.indexOf(
key
) >= 0 || (target[key] = source[key]);
return target;
}
(Decade.propTypes = _object_spread$8(
_object_spread$8(
{
},
tileProps
),
{
},
{
formatYear: PropTypes.func,
}
)),
(Decades.propTypes = _object_spread$7(
{
},
tileGroupProps
));
var className$3 = "react-calendar__decade-view__years__year";
function Year(
_ref
) {
var classes = _ref.classes,
_ref$formatYear = _ref.formatYear,
formatYear$1 =
void 0 === _ref$formatYear ? formatYear : _ref$formatYear,
otherProps = _object_without_properties$5(
_ref,
[
"classes",
"formatYear",
]
),
date = otherProps.date,
locale = otherProps.locale;
return React.createElement(
Tile,
_extends$8(
{
},
otherProps,
{
classes: [].concat(
classes,
className$3
),
maxDateTransform: getYearEnd,
minDateTransform: getYearStart,
view: "decade",
}
),
formatYear$1(
locale,
date
)
);
}
function ownKeys$5(
object, enumerableOnly
) {
var keys = Object.keys(
object
);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(
object
);
enumerableOnly &&
(symbols = symbols.filter(
function (
sym
) {
return Object.getOwnPropertyDescriptor(
object,
sym
).enumerable;
}
)),
keys.push.apply(
keys,
symbols
);
}
return keys;
}
function _object_spread$5(
target
) {
for (var i = 1; i < arguments.length; i++) {
var source = null != arguments[i]
? arguments[i]
: {
};
i % 2
? ownKeys$5(
Object(
source
),
!0
).forEach(
function (
key
) {
_define_property$5(
target,
key,
source[key]
);
}
)
: Object.getOwnPropertyDescriptors
? Object.defineProperties(
target,
Object.getOwnPropertyDescriptors(
source
)
)
: ownKeys$5(
Object(
source
)
).forEach(
function (
key
) {
Object.defineProperty(
target,
key,
Object.getOwnPropertyDescriptor(
source,
key
)
);
}
);
}
return target;
}
function _define_property$5(
obj, key, value
) {
return (
key in obj
? Object.defineProperty(
obj,
key,
{
value: value,
enumerable: !0,
configurable: !0,
writable: !0,
}
)
: (obj[key] = value),
obj
);
}
function _extends$7(
) {
return (_extends$7 =
Object.assign ||
function (
target
) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source)
Object.prototype.hasOwnProperty.call(
source,
key
) &&
(target[key] = source[key]);
}
return target;
}).apply(
this,
arguments
);
}
function Years(
props
) {
var start = getBeginOfDecadeYear(
props.activeStartDate
),
end = start + 9;
return React.createElement(
TileGroup,
_extends$7(
{
},
props,
{
className: "react-calendar__decade-view__years",
dateTransform: function (
year
) {
var date = new Date(
);
return (
date.setFullYear(
year,
0,
1
),
date.setHours(
0,
0,
0,
0
),
date
);
},
dateType: "year",
end: end,
start: start,
tile: Year,
}
)
);
}
function DecadeView(
props
) {
return React.createElement(
"div",
{
className: "react-calendar__decade-view",
},
React.createElement(
Years,
props
)
);
}
function ownKeys$4(
object, enumerableOnly
) {
var keys = Object.keys(
object
);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(
object
);
enumerableOnly &&
(symbols = symbols.filter(
function (
sym
) {
return Object.getOwnPropertyDescriptor(
object,
sym
).enumerable;
}
)),
keys.push.apply(
keys,
symbols
);
}
return keys;
}
function _object_spread$4(
target
) {
for (var i = 1; i < arguments.length; i++) {
var source = null != arguments[i]
? arguments[i]
: {
};
i % 2
? ownKeys$4(
Object(
source
),
!0
).forEach(
function (
key
) {
_define_property$4(
target,
key,
source[key]
);
}
)
: Object.getOwnPropertyDescriptors
? Object.defineProperties(
target,
Object.getOwnPropertyDescriptors(
source
)
)
: ownKeys$4(
Object(
source
)
).forEach(
function (
key
) {
Object.defineProperty(
target,
key,
Object.getOwnPropertyDescriptor(
source,
key
)
);
}
);
}
return target;
}
function _define_property$4(
obj, key, value
) {
return (
key in obj
? Object.defineProperty(
obj,
key,
{
value: value,
enumerable: !0,
configurable: !0,
writable: !0,
}
)
: (obj[key] = value),
obj
);
}
function _extends$6(
) {
return (_extends$6 =
Object.assign ||
function (
target
) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source)
Object.prototype.hasOwnProperty.call(
source,
key
) &&
(target[key] = source[key]);
}
return target;
}).apply(
this,
arguments
);
}
function _object_without_properties$4(
source, excluded
) {
if (null == source) return {
};
var key,
i,
target = _object_without_properties_loose$4(
source,
excluded
);
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(
source
);
for (i = 0; i < sourceSymbolKeys.length; i++)
(key = sourceSymbolKeys[i]),
excluded.indexOf(
key
) >= 0 ||
(Object.prototype.propertyIsEnumerable.call(
source,
key
) &&
(target[key] = source[key]));
}
return target;
}
function _object_without_properties_loose$4(
source, excluded
) {
if (null == source) return {
};
var key,
i,
target = {
},
sourceKeys = Object.keys(
source
);
for (i = 0; i < sourceKeys.length; i++)
(key = sourceKeys[i]),
excluded.indexOf(
key
) >= 0 || (target[key] = source[key]);
return target;
}
(Year.propTypes = _object_spread$6(
_object_spread$6(
{
},
tileProps
),
{
},
{
formatYear: PropTypes.func,
}
)),
(Years.propTypes = _object_spread$5(
{
},
tileGroupProps
));
var className$2 = "react-calendar__year-view__months__month";
function Month(
_ref
) {
var classes = _ref.classes,
_ref$formatMonth = _ref.formatMonth,
formatMonth$1 =
void 0 === _ref$formatMonth ? formatMonth : _ref$formatMonth,
_ref$formatMonthYear = _ref.formatMonthYear,
formatMonthYear$1 =
void 0 === _ref$formatMonthYear
? formatMonthYear
: _ref$formatMonthYear,
otherProps = _object_without_properties$4(
_ref,
[
"classes",
"formatMonth",
"formatMonthYear",
]
),
date = otherProps.date,
locale = otherProps.locale;
return React.createElement(
Tile,
_extends$6(
{
},
otherProps,
{
classes: [].concat(
classes,
className$2
),
formatAbbr: formatMonthYear$1,
maxDateTransform: getMonthEnd,
minDateTransform: getMonthStart,
view: "year",
}
),
formatMonth$1(
locale,
date
)
);
}
function ownKeys$3(
object, enumerableOnly
) {
var keys = Object.keys(
object
);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(
object
);
enumerableOnly &&
(symbols = symbols.filter(
function (
sym
) {
return Object.getOwnPropertyDescriptor(
object,
sym
).enumerable;
}
)),
keys.push.apply(
keys,
symbols
);
}
return keys;
}
function _object_spread$3(
target
) {
for (var i = 1; i < arguments.length; i++) {
var source = null != arguments[i]
? arguments[i]
: {
};
i % 2
? ownKeys$3(
Object(
source
),
!0
).forEach(
function (
key
) {
_define_property$3(
target,
key,
source[key]
);
}
)
: Object.getOwnPropertyDescriptors
? Object.defineProperties(
target,
Object.getOwnPropertyDescriptors(
source
)
)
: ownKeys$3(
Object(
source
)
).forEach(
function (
key
) {
Object.defineProperty(
target,
key,
Object.getOwnPropertyDescriptor(
source,
key
)
);
}
);
}
return target;
}
function _define_property$3(
obj, key, value
) {
return (
key in obj
? Object.defineProperty(
obj,
key,
{
value: value,
enumerable: !0,
configurable: !0,
writable: !0,
}
)
: (obj[key] = value),
obj
);
}
function _extends$5(
) {
return (_extends$5 =
Object.assign ||
function (
target
) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source)
Object.prototype.hasOwnProperty.call(
source,
key
) &&
(target[key] = source[key]);
}
return target;
}).apply(
this,
arguments
);
}
function Months(
props
) {
var year = getYear(
props.activeStartDate
);
return React.createElement(
TileGroup,
_extends$5(
{
},
props,
{
className: "react-calendar__year-view__months",
dateTransform: function (
monthIndex
) {
var date = new Date(
);
return (
date.setFullYear(
year,
monthIndex,
1
),
date.setHours(
0,
0,
0,
0
),
date
);
},
dateType: "month",
end: 11,
start: 0,
tile: Month,
}
)
);
}
function YearView(
props
) {
return React.createElement(
"div",
{
className: "react-calendar__year-view",
},
React.createElement(
Months,
props
)
);
}
function ownKeys$2(
object, enumerableOnly
) {
var keys = Object.keys(
object
);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(
object
);
enumerableOnly &&
(symbols = symbols.filter(
function (
sym
) {
return Object.getOwnPropertyDescriptor(
object,
sym
).enumerable;
}
)),
keys.push.apply(
keys,
symbols
);
}
return keys;
}
function _object_spread$2(
target
) {
for (var i = 1; i < arguments.length; i++) {
var source = null != arguments[i]
? arguments[i]
: {
};
i % 2
? ownKeys$2(
Object(
source
),
!0
).forEach(
function (
key
) {
_define_property$2(
target,
key,
source[key]
);
}
)
: Object.getOwnPropertyDescriptors
? Object.defineProperties(
target,
Object.getOwnPropertyDescriptors(
source
)
)
: ownKeys$2(
Object(
source
)
).forEach(
function (
key
) {
Object.defineProperty(
target,
key,
Object.getOwnPropertyDescriptor(
source,
key
)
);
}
);
}
return target;
}
function _define_property$2(
obj, key, value
) {
return (
key in obj
? Object.defineProperty(
obj,
key,
{
value: value,
enumerable: !0,
configurable: !0,
writable: !0,
}
)
: (obj[key] = value),
obj
);
}
function _extends$4(
) {
return (_extends$4 =
Object.assign ||
function (
target
) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source)
Object.prototype.hasOwnProperty.call(
source,
key
) &&
(target[key] = source[key]);
}
return target;
}).apply(
this,
arguments
);
}
function _object_without_properties$3(
source, excluded
) {
if (null == source) return {
};
var key,
i,
target = _object_without_properties_loose$3(
source,
excluded
);
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(
source
);
for (i = 0; i < sourceSymbolKeys.length; i++)
(key = sourceSymbolKeys[i]),
excluded.indexOf(
key
) >= 0 ||
(Object.prototype.propertyIsEnumerable.call(
source,
key
) &&
(target[key] = source[key]));
}
return target;
}
function _object_without_properties_loose$3(
source, excluded
) {
if (null == source) return {
};
var key,
i,
target = {
},
sourceKeys = Object.keys(
source
);
for (i = 0; i < sourceKeys.length; i++)
(key = sourceKeys[i]),
excluded.indexOf(
key
) >= 0 || (target[key] = source[key]);
return target;
}
(Month.propTypes = _object_spread$4(
_object_spread$4(
{
},
tileProps
),
{
},
{
formatMonth: PropTypes.func,
formatMonthYear: PropTypes.func,
}
)),
(Months.propTypes = _object_spread$3(
_object_spread$3(
{
},
tileGroupProps
),
{
},
{
locale: PropTypes.string,
}
));
var className$1 = "react-calendar__month-view__days__day";
function Day(
_ref
) {
var _ref$formatDay = _ref.formatDay,
formatDay$1 = void 0 === _ref$formatDay ? formatDay : _ref$formatDay,
_ref$formatLongDate = _ref.formatLongDate,
formatLongDate$1 =
void 0 === _ref$formatLongDate
? formatLongDate
: _ref$formatLongDate,
calendarType = _ref.calendarType,
classes = _ref.classes,
currentMonthIndex = _ref.currentMonthIndex,
otherProps = _object_without_properties$3(
_ref,
[
"formatDay",
"formatLongDate",
"calendarType",
"classes",
"currentMonthIndex",
]
),
date = otherProps.date,
locale = otherProps.locale;
return React.createElement(
Tile,
_extends$4(
{
},
otherProps,
{
classes: [].concat(
classes,
className$1,
isWeekend(
date,
calendarType
)
? "".concat(
className$1,
"--weekend"
)
: null,
date.getMonth(
) !== currentMonthIndex
? "".concat(
className$1,
"--neighboringMonth"
)
: null
),
formatAbbr: formatLongDate$1,
maxDateTransform: getDayEnd,
minDateTransform: getDayStart,
view: "month",
}
),
formatDay$1(
locale,
date
)
);
}
function ownKeys$1(
object, enumerableOnly
) {
var keys = Object.keys(
object
);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(
object
);
enumerableOnly &&
(symbols = symbols.filter(
function (
sym
) {
return Object.getOwnPropertyDescriptor(
object,
sym
).enumerable;
}
)),
keys.push.apply(
keys,
symbols
);
}
return keys;
}
function _object_spread$1(
target
) {
for (var i = 1; i < arguments.length; i++) {
var source = null != arguments[i]
? arguments[i]
: {
};
i % 2
? ownKeys$1(
Object(
source
),
!0
).forEach(
function (
key
) {
_define_property$1(
target,
key,
source[key]
);
}
)
: Object.getOwnPropertyDescriptors
? Object.defineProperties(
target,
Object.getOwnPropertyDescriptors(
source
)
)
: ownKeys$1(
Object(
source
)
).forEach(
function (
key
) {
Object.defineProperty(
target,
key,
Object.getOwnPropertyDescriptor(
source,
key
)
);
}
);
}
return target;
}
function _define_property$1(
obj, key, value
) {
return (
key in obj
? Object.defineProperty(
obj,
key,
{
value: value,
enumerable: !0,
configurable: !0,
writable: !0,
}
)
: (obj[key] = value),
obj
);
}
function _extends$3(
) {
return (_extends$3 =
Object.assign ||
function (
target
) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source)
Object.prototype.hasOwnProperty.call(
source,
key
) &&
(target[key] = source[key]);
}
return target;
}).apply(
this,
arguments
);
}
function _object_without_properties$2(
source, excluded
) {
if (null == source) return {
};
var key,
i,
target = _object_without_properties_loose$2(
source,
excluded
);
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(
source
);
for (i = 0; i < sourceSymbolKeys.length; i++)
(key = sourceSymbolKeys[i]),
excluded.indexOf(
key
) >= 0 ||
(Object.prototype.propertyIsEnumerable.call(
source,
key
) &&
(target[key] = source[key]));
}
return target;
}
function _object_without_properties_loose$2(
source, excluded
) {
if (null == source) return {
};
var key,
i,
target = {
},
sourceKeys = Object.keys(
source
);
for (i = 0; i < sourceKeys.length; i++)
(key = sourceKeys[i]),
excluded.indexOf(
key
) >= 0 || (target[key] = source[key]);
return target;
}
function Days(
props
) {
var activeStartDate = props.activeStartDate,
calendarType = props.calendarType,
showFixedNumberOfWeeks = props.showFixedNumberOfWeeks,
showNeighboringMonth = props.showNeighboringMonth,
otherProps = _object_without_properties$2(
props,
[
"showFixedNumberOfWeeks",
"showNeighboringMonth",
]
),
year = getYear(
activeStartDate
),
monthIndex = getMonth(
activeStartDate
),
hasFixedNumberOfWeeks = showFixedNumberOfWeeks || showNeighboringMonth,
dayOfWeek = getDayOfWeek(
activeStartDate,
calendarType
),
offset = hasFixedNumberOfWeeks ? 0 : dayOfWeek,
start = 1 + (hasFixedNumberOfWeeks ? -dayOfWeek : 0),
end = (function (
) {
if (showFixedNumberOfWeeks) return start + 42 - 1;
var daysInMonth = getDaysInMonth(
activeStartDate
);
if (showNeighboringMonth) {
var activeEndDate = new Date(
);
return (
activeEndDate.setFullYear(
year,
monthIndex,
daysInMonth
),
activeEndDate.setHours(
0,
0,
0,
0
),
daysInMonth +
(7 - getDayOfWeek(
activeEndDate,
calendarType
) - 1)
);
}
return daysInMonth;
})(
);
return React.createElement(
TileGroup,
_extends$3(
{
},
otherProps,
{
className: "react-calendar__month-view__days",
count: 7,
currentMonthIndex: monthIndex,
dateTransform: function (
day
) {
var date = new Date(
);
return (
date.setFullYear(
year,
monthIndex,
day
),
date.setHours(
0,
0,
0,
0
),
date
);
},
dateType: "day",
end: end,
offset: offset,
start: start,
tile: Day,
}
)
);
}
(Day.propTypes = _object_spread$2(
_object_spread$2(
{
},
tileProps
),
{
},
{
currentMonthIndex: PropTypes.number.isRequired,
formatDay: PropTypes.func,
formatLongDate: PropTypes.func,
}
)),
(Days.propTypes = _object_spread$1(
{
calendarType: isCalendarType.isRequired,
showFixedNumberOfWeeks: PropTypes.bool,
showNeighboringMonth: PropTypes.bool,
},
tileGroupProps
));
var className = "react-calendar__month-view__weekdays";
function Weekdays(
props
) {
for (
var calendarType = props.calendarType,
_props$formatShortWee = props.formatShortWeekday,
formatShortWeekday$1 =
void 0 === _props$formatShortWee
? formatShortWeekday
: _props$formatShortWee,
locale = props.locale,
onMouseLeave = props.onMouseLeave,
beginOfMonth = getMonthStart(
new Date(
)
),
year = getYear(
beginOfMonth
),
monthIndex = getMonth(
beginOfMonth
),
weekdays = [],
weekday = 1;
weekday <= 7;
weekday += 1
) {
var weekdayDate = new Date(
year,
monthIndex,
weekday - getDayOfWeek(
beginOfMonth,
calendarType
)
),
abbr = formatWeekday(
locale,
weekdayDate
);
weekdays.push(
React.createElement(
"div",
{
key: weekday,
className: "".concat(
className,
"__weekday"
),
},
React.createElement(
"abbr",
{
"aria-label": abbr,
title: abbr,
},
formatShortWeekday$1(
locale,
weekdayDate
).replace(
".",
""
)
)
)
);
}
return React.createElement(
Flex,
{
className: className,
count: 7,
onFocus: onMouseLeave,
onMouseOver: onMouseLeave,
},
weekdays
);
}
function _extends$2(
) {
return (_extends$2 =
Object.assign ||
function (
target
) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source)
Object.prototype.hasOwnProperty.call(
source,
key
) &&
(target[key] = source[key]);
}
return target;
}).apply(
this,
arguments
);
}
function WeekNumber(
_ref
) {
var date = _ref.date,
onClickWeekNumber = _ref.onClickWeekNumber,
weekNumber = _ref.weekNumber,
props = {
className: "react-calendar__tile",
style: {
flexGrow: 1,
},
},
children = React.createElement(
"span",
null,
weekNumber
);
return onClickWeekNumber
? React.createElement(
"button",
_extends$2(
{
},
props,
{
onClick: function (
event
) {
return onClickWeekNumber(
weekNumber,
date,
event
);
},
type: "button",
}
),
children
)
: React.createElement(
"div",
props,
children
);
}
function WeekNumbers(
props
) {
var activeStartDate = props.activeStartDate,
calendarType = props.calendarType,
onClickWeekNumber = props.onClickWeekNumber,
onMouseLeave = props.onMouseLeave,
showFixedNumberOfWeeks = props.showFixedNumberOfWeeks,
numberOfWeeks = (function (
) {
if (showFixedNumberOfWeeks) return 6;
var days =
getDaysInMonth(
activeStartDate
) -
(7 - getDayOfWeek(
activeStartDate,
calendarType
));
return 1 + Math.ceil(
days / 7
);
})(
),
dates = (function (
) {
for (
var year = getYear(
activeStartDate
),
monthIndex = getMonth(
activeStartDate
),
day = getDate(
activeStartDate
),
result = [],
index = 0;
index < numberOfWeeks;
index += 1
)
result.push(
getBeginOfWeek(
new Date(
year,
monthIndex,
day + 7 * index
),
calendarType
)
);
return result;
})(
),
weekNumbers = dates.map(
function (
date
) {
return getWeekNumber(
date,
calendarType
);
}
);
return React.createElement(
Flex,
{
className: "react-calendar__month-view__weekNumbers",
count: numberOfWeeks,
direction: "column",
onFocus: onMouseLeave,
onMouseOver: onMouseLeave,
style: {
flexBasis: "calc(100% * (1 / 8)",
flexShrink: 0,
},
},
weekNumbers.map(
function (
weekNumber, weekIndex
) {
return React.createElement(
WeekNumber,
{
key: weekNumber,
date: dates[weekIndex],
onClickWeekNumber: onClickWeekNumber,
weekNumber: weekNumber,
}
);
}
)
);
}
function _extends$1(
) {
return (_extends$1 =
Object.assign ||
function (
target
) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source)
Object.prototype.hasOwnProperty.call(
source,
key
) &&
(target[key] = source[key]);
}
return target;
}).apply(
this,
arguments
);
}
function _object_without_properties$1(
source, excluded
) {
if (null == source) return {
};
var key,
i,
target = _object_without_properties_loose$1(
source,
excluded
);
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(
source
);
for (i = 0; i < sourceSymbolKeys.length; i++)
(key = sourceSymbolKeys[i]),
excluded.indexOf(
key
) >= 0 ||
(Object.prototype.propertyIsEnumerable.call(
source,
key
) &&
(target[key] = source[key]));
}
return target;
}
function _object_without_properties_loose$1(
source, excluded
) {
if (null == source) return {
};
var key,
i,
target = {
},
sourceKeys = Object.keys(
source
);
for (i = 0; i < sourceKeys.length; i++)
(key = sourceKeys[i]),
excluded.indexOf(
key
) >= 0 || (target[key] = source[key]);
return target;
}
function getCalendarTypeFromLocale(
locale
) {
return (
Object.keys(
CALENDAR_TYPE_LOCALES
).find(
function (
calendarType
) {
return CALENDAR_TYPE_LOCALES[calendarType].includes(
locale
);
}
) || CALENDAR_TYPES.ISO_8601
);
}
function MonthView(
props
) {
var activeStartDate = props.activeStartDate,
locale = props.locale,
onMouseLeave = props.onMouseLeave,
showFixedNumberOfWeeks = props.showFixedNumberOfWeeks,
_props$calendarType = props.calendarType,
calendarType =
void 0 === _props$calendarType
? getCalendarTypeFromLocale(
locale
)
: _props$calendarType,
formatShortWeekday = props.formatShortWeekday,
onClickWeekNumber = props.onClickWeekNumber,
showWeekNumbers = props.showWeekNumbers,
childProps = _object_without_properties$1(
props,
[
"calendarType",
"formatShortWeekday",
"onClickWeekNumber",
"showWeekNumbers",
]
);
return React.createElement(
"div",
{
className: mergeClassNames(
"react-calendar__month-view",
showWeekNumbers
? "".concat(
"react-calendar__month-view",
"--weekNumbers"
)
: ""
),
},
React.createElement(
"div",
{
style: {
display: "flex",
alignItems: "flex-end",
},
},
showWeekNumbers
? React.createElement(
WeekNumbers,
{
activeStartDate: activeStartDate,
calendarType: calendarType,
onClickWeekNumber: onClickWeekNumber,
onMouseLeave: onMouseLeave,
showFixedNumberOfWeeks: showFixedNumberOfWeeks,
}
)
: null,
React.createElement(
"div",
{
style: {
flexGrow: 1,
width: "100%",
},
},
React.createElement(
Weekdays,
{
calendarType: calendarType,
formatShortWeekday: formatShortWeekday,
locale: locale,
onMouseLeave: onMouseLeave,
}
),
React.createElement(
Days,
_extends$1(
{
calendarType: calendarType,
},
childProps
)
)
)
)
);
}
function _extends(
) {
return (_extends =
Object.assign ||
function (
target
) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source)
Object.prototype.hasOwnProperty.call(
source,
key
) &&
(target[key] = source[key]);
}
return target;
}).apply(
this,
arguments
);
}
function _typeof(
obj
) {
return (_typeof =
"function" == typeof Symbol && "symbol" == typeof Symbol.iterator
? function (
obj
) {
return typeof obj;
}
: function (
obj
) {
return obj &&
"function" == typeof Symbol &&
obj.constructor === Symbol &&
obj !== Symbol.prototype
? "symbol"
: typeof obj;
})(
obj
);
}
function _class_call_check(
instance, Constructor
) {
if (!(instance instanceof Constructor))
throw new TypeError(
"Cannot call a class as a function"
);
}
function _defineProperties(
target, props
) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
(descriptor.enumerable = descriptor.enumerable || !1),
(descriptor.configurable = !0),
"value" in descriptor && (descriptor.writable = !0),
Object.defineProperty(
target,
descriptor.key,
descriptor
);
}
}
function _create_class(
Constructor, protoProps, staticProps
) {
return (
protoProps && _defineProperties(
Constructor.prototype,
protoProps
),
staticProps && _defineProperties(
Constructor,
staticProps
),
Constructor
);
}
function _inherits(
subClass, superClass
) {
if ("function" != typeof superClass && null !== superClass)
throw new TypeError(
"Super expression must either be null or a function"
);
(subClass.prototype = Object.create(
superClass && superClass.prototype,
{
constructor: {
value: subClass,
writable: !0,
configurable: !0,
},
}
)),
superClass && _set_prototype_of(
subClass,
superClass
);
}
function _set_prototype_of(
o, p
) {
return (_set_prototype_of =
Object.setPrototypeOf ||
function (
o, p
) {
return (o.__proto__ = p), o;
})(
o,
p
);
}
function _create_super(
Derived
) {
var hasNativeReflectConstruct = _is_native_reflect_construct(
);
return function (
) {
var result,
Super = _get_prototype_of(
Derived
);
if (hasNativeReflectConstruct) {
var NewTarget = _get_prototype_of(
this
).constructor;
result = Reflect.construct(
Super,
arguments,
NewTarget
);
} else result = Super.apply(
this,
arguments
);
return _possible_constructor_return(
this,
result
);
};
}
function _possible_constructor_return(
self, call
) {
return !call || ("object" !== _typeof(
call
) && "function" != typeof call)
? _assert_this_initialized(
self
)
: call;
}
function _assert_this_initialized(
self
) {
if (void 0 === self)
throw new ReferenceError(
"this hasn't been initialised - super() hasn't been called"
);
return self;
}
function _is_native_reflect_construct(
) {
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ("function" == typeof Proxy) return !0;
try {
return (
Date.prototype.toString.call(
Reflect.construct(
Date,
[],
function (
) {}
)
),
!0
);
} catch (e) {
return !1;
}
}
function _get_prototype_of(
o
) {
return (_get_prototype_of = Object.setPrototypeOf
? Object.getPrototypeOf
: function (
o
) {
return o.__proto__ || Object.getPrototypeOf(
o
);
})(
o
);
}
function ownKeys(
object, enumerableOnly
) {
var keys = Object.keys(
object
);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(
object
);
enumerableOnly &&
(symbols = symbols.filter(
function (
sym
) {
return Object.getOwnPropertyDescriptor(
object,
sym
).enumerable;
}
)),
keys.push.apply(
keys,
symbols
);
}
return keys;
}
function _object_spread(
target
) {
for (var i = 1; i < arguments.length; i++) {
var source = null != arguments[i]
? arguments[i]
: {
};
i % 2
? ownKeys(
Object(
source
),
!0
).forEach(
function (
key
) {
_define_property(
target,
key,
source[key]
);
}
)
: Object.getOwnPropertyDescriptors
? Object.defineProperties(
target,
Object.getOwnPropertyDescriptors(
source
)
)
: ownKeys(
Object(
source
)
).forEach(
function (
key
) {
Object.defineProperty(
target,
key,
Object.getOwnPropertyDescriptor(
source,
key
)
);
}
);
}
return target;
}
function _define_property(
obj, key, value
) {
return (
key in obj
? Object.defineProperty(
obj,
key,
{
value: value,
enumerable: !0,
configurable: !0,
writable: !0,
}
)
: (obj[key] = value),
obj
);
}
function _object_without_properties(
source, excluded
) {
if (null == source) return {
};
var key,
i,
target = _object_without_properties_loose(
source,
excluded
);
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(
source
);
for (i = 0; i < sourceSymbolKeys.length; i++)
(key = sourceSymbolKeys[i]),
excluded.indexOf(
key
) >= 0 ||
(Object.prototype.propertyIsEnumerable.call(
source,
key
) &&
(target[key] = source[key]));
}
return target;
}
function _object_without_properties_loose(
source, excluded
) {
if (null == source) return {
};
var key,
i,
target = {
},
sourceKeys = Object.keys(
source
);
for (i = 0; i < sourceKeys.length; i++)
(key = sourceKeys[i]),
excluded.indexOf(
key
) >= 0 || (target[key] = source[key]);
return target;
}
function _to_consumable_array(
arr
) {
return (
_array_without_holes(
arr
) ||
_iterableToArray(
arr
) ||
_unsupported_iterable_to_array(
arr
) ||
_nonIterableSpread(
)
);
}
function _nonIterableSpread(
) {
throw new TypeError(
"Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."
);
}
function _unsupported_iterable_to_array(
o, minLen
) {
if (o) {
if ("string" == typeof o) return _array_like_to_array(
o,
minLen
);
var n = Object.prototype.toString.call(
o
).slice(
8,
-1
);
return (
"Object" === n && o.constructor && (n = o.constructor.name),
"Map" === n || "Set" === n
? Array.from(
o
)
: "Arguments" === n ||
/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(
n
)
? _array_like_to_array(
o,
minLen
)
: void 0
);
}
}
function _iterableToArray(
iter
) {
if ("undefined" != typeof Symbol && Symbol.iterator in Object(
iter
))
return Array.from(
iter
);
}
function _array_without_holes(
arr
) {
if (Array.isArray(
arr
)) return _array_like_to_array(
arr
);
}
function _array_like_to_array(
arr, len
) {
(null == len || len > arr.length) && (len = arr.length);
for (var i = 0, arr2 = new Array(
len
); i < len; i++) arr2[i] = arr[i];
return arr2;
}
(Weekdays.propTypes = {
calendarType: isCalendarType.isRequired,
formatShortWeekday: PropTypes.func,
locale: PropTypes.string,
onMouseLeave: PropTypes.func,
}),
(WeekNumber.propTypes = {
date: PropTypes.instanceOf(
Date
).isRequired,
onClickWeekNumber: PropTypes.func,
weekNumber: PropTypes.node.isRequired,
}),
(WeekNumbers.propTypes = {
activeStartDate: PropTypes.instanceOf(
Date
).isRequired,
calendarType: isCalendarType.isRequired,
onClickWeekNumber: PropTypes.func,
onMouseLeave: PropTypes.func,
showFixedNumberOfWeeks: PropTypes.bool,
}),
(MonthView.propTypes = {
activeStartDate: PropTypes.instanceOf(
Date
).isRequired,
calendarType: isCalendarType,
formatShortWeekday: PropTypes.func,
locale: PropTypes.string,
onClickWeekNumber: PropTypes.func,
onMouseLeave: PropTypes.func,
showFixedNumberOfWeeks: PropTypes.bool,
showWeekNumbers: PropTypes.bool,
});
var defaultMinDate = new Date(
);
defaultMinDate.setFullYear(
1,
0,
1
), defaultMinDate.setHours(
0,
0,
0,
0
);
var defaultMaxDate = new Date(
864e13
),
baseClassName = "react-calendar",
allViews = ["century", "decade", "year", "month",],
allValueTypes = [].concat(
_to_consumable_array(
allViews.slice(
1
)
),
["day",]
);
function toDate(
value
) {
return value instanceof Date
? value
: new Date(
value
);
}
function getLimitedViews(
minDetail, maxDetail
) {
return allViews.slice(
allViews.indexOf(
minDetail
),
allViews.indexOf(
maxDetail
) + 1
);
}
function isViewAllowed(
view, minDetail, maxDetail
) {
return -1 !== getLimitedViews(
minDetail,
maxDetail
).indexOf(
view
);
}
function getView(
view, minDetail, maxDetail
) {
return isViewAllowed(
view,
minDetail,
maxDetail
)
? view
: maxDetail;
}
function getValueType(
maxDetail
) {
return allValueTypes[allViews.indexOf(
maxDetail
)];
}
function getValue(
value, index
) {
if (!value) return null;
var rawValue =
Array.isArray(
value
) && 2 === value.length
? value[index]
: value;
if (!rawValue) return null;
var valueDate = toDate(
rawValue
);
if (isNaN(
valueDate.getTime(
)
))
throw new Error(
"Invalid date: ".concat(
value
)
);
return valueDate;
}
function getDetailValue(
_ref, index
) {
var value = _ref.value,
minDate = _ref.minDate,
maxDate = _ref.maxDate,
maxDetail = _ref.maxDetail,
valuePiece = getValue(
value,
index
);
if (!valuePiece) return null;
var valueType = getValueType(
maxDetail
);
return between(
[getBegin, getEnd,][index](
valueType,
valuePiece
),
minDate,
maxDate
);
}
var getDetailValueFrom = function (
args
) {
return getDetailValue(
args,
0
);
},
getDetailValueTo = function (
args
) {
return getDetailValue(
args,
1
);
},
getDetailValueArray = function (
args
) {
var value = args.value;
return Array.isArray(
value
)
? value
: [getDetailValueFrom, getDetailValueTo,].map(
function (
fn
) {
return fn(
args
);
}
);
};
function getActiveStartDate(
props
) {
var maxDate = props.maxDate,
maxDetail = props.maxDetail,
minDate = props.minDate,
minDetail = props.minDetail,
value = props.value;
return getBegin(
getView(
props.view,
minDetail,
maxDetail
),
getDetailValueFrom(
{
value: value,
minDate: minDate,
maxDate: maxDate,
maxDetail: maxDetail,
}
) || new Date(
)
);
}
function getInitialActiveStartDate(
props
) {
var activeStartDate = props.activeStartDate,
defaultActiveStartDate = props.defaultActiveStartDate,
defaultValue = props.defaultValue,
defaultView = props.defaultView,
maxDetail = props.maxDetail,
minDetail = props.minDetail,
value = props.value,
view = props.view,
otherProps = _object_without_properties(
props,
[
"activeStartDate",
"defaultActiveStartDate",
"defaultValue",
"defaultView",
"maxDetail",
"minDetail",
"value",
"view",
]
),
rangeType = getView(
view,
minDetail,
maxDetail
),
valueFrom = activeStartDate || defaultActiveStartDate;
return valueFrom
? getBegin(
rangeType,
valueFrom
)
: getActiveStartDate(
_object_spread(
{
maxDetail: maxDetail,
minDetail: minDetail,
value: value || defaultValue,
view: view || defaultView,
},
otherProps
)
);
}
var getIsSingleValue = function (
value
) {
return value && 1 === [].concat(
value
).length;
},
Calendar = (function (
_Component
) {
_inherits(
Calendar,
_
);
var _super = _create_super(
Calendar
);
function Calendar(
) {
var _this;
_class_call_check(
this,
Calendar
);
for (
var _len = arguments.length, _args = new Array(
_len
), _key = 0;
_key < _len;
_key++
)
_args[_key] = arguments[_key];
return (
_define_property(
_assert_this_initialized(
(_this = _super.call.apply(
_super,
[this,].concat(
_args
)
))
),
"state",
{
activeStartDate: _this.props.defaultActiveStartDate,
value: _this.props.defaultValue,
view: _this.props.defaultView,
}
),
_define_property(
_assert_this_initialized(
_this
),
"setStateAndCallCallbacks",
function (
nextState, event, callback
) {
var _assertThisInitialize =
_assert_this_initialized(
_this
),
previousActiveStartDate =
_assertThisInitialize.activeStartDate,
previousView = _assertThisInitialize.view,
_this$props = _this.props,
allowPartialRange = _this$props.allowPartialRange,
onActiveStartDateChange =
_this$props.onActiveStartDateChange,
onChange = _this$props.onChange,
onViewChange = _this$props.onViewChange,
selectRange = _this$props.selectRange,
prevArgs = {
activeStartDate: previousActiveStartDate,
view: previousView,
};
_this.setState(
nextState,
function (
) {
var args = {
activeStartDate:
nextState.activeStartDate ||
_this.activeStartDate,
value: nextState.value || _this.value,
view: nextState.view || _this.view,
};
function shouldUpdate(
key
) {
return (
key in nextState &&
(_typeof(
nextState[key]
) !==
_typeof(
prevArgs[key]
) ||
(nextState[key] instanceof Date
? nextState[key].getTime(
) !==
prevArgs[key].getTime(
)
: nextState[key] !== prevArgs[key]))
);
}
(shouldUpdate(
"activeStartDate"
) &&
onActiveStartDateChange &&
onActiveStartDateChange(
args
),
shouldUpdate(
"view"
) &&
onViewChange &&
onViewChange(
args
),
shouldUpdate(
"value"
)) &&
onChange &&
(selectRange &&
getIsSingleValue(
nextState.value
)
? allowPartialRange &&
onChange(
[nextState.value,],
event
)
: onChange(
nextState.value,
event
));
callback && callback(
args
);
}
);
}
),
_define_property(
_assert_this_initialized(
_this
),
"setActiveStartDate",
function (
activeStartDate
) {
_this.setStateAndCallCallbacks(
{
activeStartDate: activeStartDate,
}
);
}
),
_define_property(
_assert_this_initialized(
_this
),
"drillDown",
function (
nextActiveStartDate, event
) {
if (_this.drillDownAvailable) {
_this.onClickTile(
nextActiveStartDate,
event
);
var _assertThisInitialize2 =
_assert_this_initialized(
_this
),
view = _assertThisInitialize2.view,
views = _assertThisInitialize2.views,
onDrillDown = _this.props.onDrillDown,
nextView = views[views.indexOf(
view
) + 1];
_this.setStateAndCallCallbacks(
{
activeStartDate: nextActiveStartDate,
view: nextView,
},
void 0,
onDrillDown
);
}
}
),
_define_property(
_assert_this_initialized(
_this
),
"drillUp",
function (
) {
if (_this.drillUpAvailable) {
var _assertThisInitialize3 =
_assert_this_initialized(
_this
),
activeStartDate =
_assertThisInitialize3.activeStartDate,
view = _assertThisInitialize3.view,
views = _assertThisInitialize3.views,
onDrillUp = _this.props.onDrillUp,
nextView = views[views.indexOf(
view
) - 1],
nextActiveStartDate = getBegin(
nextView,
activeStartDate
);
_this.setStateAndCallCallbacks(
{
activeStartDate: nextActiveStartDate,
view: nextView,
},
void 0,
onDrillUp
);
}
}
),
_define_property(
_assert_this_initialized(
_this
),
"onChange",
function (
value, event
) {
var nextValue,
selectRange = _this.props.selectRange;
if ((_this.onClickTile(
value,
event
), selectRange)) {
var _assertThisInitialize4 =
_assert_this_initialized(
_this
),
previousValue = _assertThisInitialize4.value,
valueType = _assertThisInitialize4.valueType;
nextValue = getIsSingleValue(
previousValue
)
? getValueRange(
valueType,
previousValue,
value
)
: getBegin(
valueType,
value
);
} else nextValue = _this.getProcessedValue(
value
);
var nextActiveStartDate = getActiveStartDate(
_object_spread(
_object_spread(
{
},
_this.props
),
{
},
{
value: nextValue,
}
)
);
event.persist(
),
_this.setStateAndCallCallbacks(
{
activeStartDate: nextActiveStartDate,
value: nextValue,
},
event
);
}
),
_define_property(
_assert_this_initialized(
_this
),
"onClickTile",
function (
value, event
) {
var view = _assert_this_initialized(
_this
).view,
_this$props2 = _this.props,
onClickDay = _this$props2.onClickDay,
onClickDecade = _this$props2.onClickDecade,
onClickMonth = _this$props2.onClickMonth,
onClickYear = _this$props2.onClickYear,
callback = (function (
) {
switch (view) {
case "century":
return onClickDecade;
case "decade":
return onClickYear;
case "year":
return onClickMonth;
case "month":
return onClickDay;
default:
throw new Error(
"Invalid view: ".concat(
view,
"."
)
);
}
})(
);
callback && callback(
value,
event
);
}
),
_define_property(
_assert_this_initialized(
_this
),
"onMouseOver",
function (
value
) {
_this.setState(
function (
prevState
) {
return prevState.hover &&
prevState.hover.getTime(
) === value.getTime(
)
? null
: {
hover: value,
};
}
);
}
),
_define_property(
_assert_this_initialized(
_this
),
"onMouseLeave",
function (
) {
_this.setState(
{
hover: null,
}
);
}
),
_this
);
}
return (
_create_class(
Calendar,
[
{
key: "getProcessedValue",
value: function (
value
) {
var _this$props3 = this.props,
minDate = _this$props3.minDate,
maxDate = _this$props3.maxDate,
maxDetail = _this$props3.maxDetail,
returnValue = _this$props3.returnValue;
return (function (
) {
switch (returnValue) {
case "start":
return getDetailValueFrom;
case "end":
return getDetailValueTo;
case "range":
return getDetailValueArray;
default:
throw new Error(
"Invalid returnValue."
);
}
})(
)(
{
value: value,
minDate: minDate,
maxDate: maxDate,
maxDetail: maxDetail,
}
);
},
},
{
key: "renderContent",
value: function (
next
) {
var currentActiveStartDate = this.activeStartDate,
onMouseOver = this.onMouseOver,
valueType = this.valueType,
value = this.value,
view = this.view,
_this$props4 = this.props,
calendarType = _this$props4.calendarType,
locale = _this$props4.locale,
maxDate = _this$props4.maxDate,
minDate = _this$props4.minDate,
selectRange = _this$props4.selectRange,
tileClassName = _this$props4.tileClassName,
tileContent = _this$props4.tileContent,
tileDisabled = _this$props4.tileDisabled,
hover = this.hover,
commonProps = {
activeStartDate: next
? getBeginNext(
view,
currentActiveStartDate
)
: getBegin(
view,
currentActiveStartDate
),
hover: hover,
locale: locale,
maxDate: maxDate,
minDate: minDate,
onClick: this.drillDownAvailable
? this.drillDown
: this.onChange,
onMouseOver: selectRange ? onMouseOver : null,
tileClassName: tileClassName,
tileContent: tileContent,
tileDisabled: tileDisabled,
value: value,
valueType: valueType,
};
switch (view) {
case "century":
var formatYear = this.props.formatYear;
return React.createElement(
CenturyView,
_extends(
{
formatYear: formatYear,
},
commonProps
)
);
case "decade":
var _formatYear = this.props.formatYear;
return React.createElement(
DecadeView,
_extends(
{
formatYear: _formatYear,
},
commonProps
)
);
case "year":
var _this$props5 = this.props,
formatMonth = _this$props5.formatMonth,
formatMonthYear =
_this$props5.formatMonthYear;
return React.createElement(
YearView,
_extends(
{
formatMonth: formatMonth,
formatMonthYear: formatMonthYear,
},
commonProps
)
);
case "month":
var _this$props6 = this.props,
formatDay = _this$props6.formatDay,
formatLongDate =
_this$props6.formatLongDate,
formatShortWeekday =
_this$props6.formatShortWeekday,
onClickWeekNumber =
_this$props6.onClickWeekNumber,
showDoubleView =
_this$props6.showDoubleView,
showFixedNumberOfWeeks =
_this$props6.showFixedNumberOfWeeks,
showNeighboringMonth =
_this$props6.showNeighboringMonth,
showWeekNumbers =
_this$props6.showWeekNumbers,
onMouseLeave = this.onMouseLeave;
return React.createElement(
MonthView,
_extends(
{
calendarType: calendarType,
formatDay: formatDay,
formatLongDate: formatLongDate,
formatShortWeekday:
formatShortWeekday,
onClickWeekNumber:
onClickWeekNumber,
onMouseLeave: selectRange
? onMouseLeave
: null,
showFixedNumberOfWeeks:
showFixedNumberOfWeeks ||
showDoubleView,
showNeighboringMonth:
showNeighboringMonth,
showWeekNumbers: showWeekNumbers,
},
commonProps
)
);
default:
throw new Error(
"Invalid view: ".concat(
view,
"."
)
);
}
},
},
{
key: "renderNavigation",
value: function (
) {
if (!this.props.showNavigation) return null;
var activeStartDate = this.activeStartDate,
view = this.view,
views = this.views,
_this$props7 = this.props,
formatMonthYear = _this$props7.formatMonthYear,
formatYear = _this$props7.formatYear,
locale = _this$props7.locale,
maxDate = _this$props7.maxDate,
minDate = _this$props7.minDate,
navigationAriaLabel =
_this$props7.navigationAriaLabel,
navigationLabel = _this$props7.navigationLabel,
next2AriaLabel = _this$props7.next2AriaLabel,
next2Label = _this$props7.next2Label,
nextAriaLabel = _this$props7.nextAriaLabel,
nextLabel = _this$props7.nextLabel,
prev2AriaLabel = _this$props7.prev2AriaLabel,
prev2Label = _this$props7.prev2Label,
prevAriaLabel = _this$props7.prevAriaLabel,
prevLabel = _this$props7.prevLabel,
showDoubleView = _this$props7.showDoubleView;
return React.createElement(
Navigation,
{
activeStartDate: activeStartDate,
drillUp: this.drillUp,
formatMonthYear: formatMonthYear,
formatYear: formatYear,
locale: locale,
maxDate: maxDate,
minDate: minDate,
navigationAriaLabel: navigationAriaLabel,
navigationLabel: navigationLabel,
next2AriaLabel: next2AriaLabel,
next2Label: next2Label,
nextAriaLabel: nextAriaLabel,
nextLabel: nextLabel,
prev2AriaLabel: prev2AriaLabel,
prev2Label: prev2Label,
prevAriaLabel: prevAriaLabel,
prevLabel: prevLabel,
setActiveStartDate: this.setActiveStartDate,
showDoubleView: showDoubleView,
view: view,
views: views,
}
);
},
},
{
key: "render",
value: function (
) {
var _this$props8 = this.props,
className = _this$props8.className,
inputRef = _this$props8.inputRef,
selectRange = _this$props8.selectRange,
showDoubleView = _this$props8.showDoubleView,
onMouseLeave = this.onMouseLeave,
value = this.value,
valueArray = [].concat(
value
);
return React.createElement(
"div",
{
className: mergeClassNames(
baseClassName,
selectRange &&
1 === valueArray.length &&
"".concat(
baseClassName,
"--selectRange"
),
showDoubleView &&
"".concat(
baseClassName,
"--doubleView"
),
className
),
ref: inputRef,
},
this.renderNavigation(
),
React.createElement(
"div",
{
className: "".concat(
baseClassName,
"__viewContainer"
),
onBlur: selectRange ? onMouseLeave : null,
onMouseLeave: selectRange
? onMouseLeave
: null,
},
this.renderContent(
),
showDoubleView && this.renderContent(
!0
)
)
);
},
},
{
key: "activeStartDate",
get: function (
) {
var activeStartDateProps = this.props.activeStartDate,
activeStartDateState = this.state.activeStartDate;
return (
activeStartDateProps ||
activeStartDateState ||
getInitialActiveStartDate(
this.props
)
);
},
},
{
key: "value",
get: function (
) {
var _this$props9 = this.props,
selectRange = _this$props9.selectRange,
valueProps = _this$props9.value,
valueState = this.state.value;
return selectRange && getIsSingleValue(
valueState
)
? valueState
: void 0 !== valueProps
? valueProps
: valueState;
},
},
{
key: "valueType",
get: function (
) {
return getValueType(
this.props.maxDetail
);
},
},
{
key: "view",
get: function (
) {
var _this$props10 = this.props,
minDetail = _this$props10.minDetail,
maxDetail = _this$props10.maxDetail,
viewProps = _this$props10.view,
viewState = this.state.view;
return getView(
viewProps || viewState,
minDetail,
maxDetail
);
},
},
{
key: "views",
get: function (
) {
var _this$props11 = this.props;
return getLimitedViews(
_this$props11.minDetail,
_this$props11.maxDetail
);
},
},
{
key: "hover",
get: function (
) {
var selectRange = this.props.selectRange,
hover = this.state.hover;
return selectRange ? hover : null;
},
},
{
key: "drillDownAvailable",
get: function (
) {
var view = this.view,
views = this.views;
return views.indexOf(
view
) < views.length - 1;
},
},
{
key: "drillUpAvailable",
get: function (
) {
var view = this.view;
return this.views.indexOf(
view
) > 0;
},
},
]
),
Calendar
);
})(
);
Calendar.defaultProps = {
maxDate: defaultMaxDate,
maxDetail: "month",
minDate: defaultMinDate,
minDetail: "century",
returnValue: "start",
showNavigation: !0,
showNeighboringMonth: !0,
};
var isActiveStartDate = PropTypes.instanceOf(
Date
),
isLooseValue = PropTypes.oneOfType(
[PropTypes.string, isValue,]
);
function CompatDemo(
) {
const [value, onChange,] = l$2(
new Date(
)
);
return m$1`<${Calendar} onChange=${onChange} showWeekNumbers value=${value}/>`;
}
(Calendar.propTypes = {
activeStartDate: isActiveStartDate,
allowPartialRange: PropTypes.bool,
calendarType: isCalendarType,
className: isClassName,
defaultActiveStartDate: isActiveStartDate,
defaultValue: isLooseValue,
defaultView: isView,
formatDay: PropTypes.func,
formatLongDate: PropTypes.func,
formatMonth: PropTypes.func,
formatMonthYear: PropTypes.func,
formatShortWeekday: PropTypes.func,
formatYear: PropTypes.func,
inputRef: isRef,
locale: PropTypes.string,
maxDate: isMaxDate,
maxDetail: PropTypes.oneOf(
allViews
),
minDate: isMinDate,
minDetail: PropTypes.oneOf(
allViews
),
navigationAriaLabel: PropTypes.string,
navigationLabel: PropTypes.func,
next2AriaLabel: PropTypes.string,
next2Label: PropTypes.node,
nextAriaLabel: PropTypes.string,
nextLabel: PropTypes.node,
onActiveStartDateChange: PropTypes.func,
onChange: PropTypes.func,
onClickDay: PropTypes.func,
onClickDecade: PropTypes.func,
onClickMonth: PropTypes.func,
onClickWeekNumber: PropTypes.func,
onClickYear: PropTypes.func,
onDrillDown: PropTypes.func,
onDrillUp: PropTypes.func,
onViewChange: PropTypes.func,
prev2AriaLabel: PropTypes.string,
prev2Label: PropTypes.node,
prevAriaLabel: PropTypes.string,
prevLabel: PropTypes.node,
returnValue: PropTypes.oneOf(
["start", "end", "range",]
),
selectRange: PropTypes.bool,
showDoubleView: PropTypes.bool,
showFixedNumberOfWeeks: PropTypes.bool,
showNavigation: PropTypes.bool,
showNeighboringMonth: PropTypes.bool,
showWeekNumbers: PropTypes.bool,
tileClassName: PropTypes.oneOfType(
[PropTypes.func, isClassName,]
),
tileContent: PropTypes.oneOfType(
[PropTypes.func, PropTypes.node,]
),
tileDisabled: PropTypes.func,
value: isLooseValue,
view: isView,
}),
style(
"/assets/Calendar.4739c73f.css"
);
export default CompatDemo;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/wmr/archive-1/chunks/.prerender.daa73035/input.js | JavaScript | import { l as l$1, d as d$1, v as v$1, B } from "../index.f66dda46.js";
var r = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i,
n = /[&<>"]/;
function o(e) {
var t = String(e);
return n.test(t)
? t
.replace(/&/g, "&")
.replace(/</g, "<")
.replace(/>/g, ">")
.replace(/"/g, """)
: t;
}
var a = function (e, t) {
return String(e).replace(/(\n+)/g, "$1" + (t || "\t"));
},
i = function (e, t, r) {
return (
String(e).length > (t || 40) ||
(!r && -1 !== String(e).indexOf("\n")) ||
-1 !== String(e).indexOf("<")
);
},
l = {};
function s(e) {
var t = "";
for (var n in e) {
var o = e[n];
null != o &&
"" !== o &&
(t && (t += " "),
(t +=
"-" == n[0]
? n
: l[n] ||
(l[n] = n.replace(/([A-Z])/g, "-$1").toLowerCase())),
(t += ": "),
(t += o),
"number" == typeof o && !1 === r.test(n) && (t += "px"),
(t += ";"));
}
return t || void 0;
}
function f(e, t) {
for (var r in t) e[r] = t[r];
return e;
}
function u(e, t) {
return (
Array.isArray(t) ? t.reduce(u, e) : null != t && !1 !== t && e.push(t),
e
);
}
var c = {
shallow: !0,
},
p = [],
_ =
/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,
v = /[\s\n\\/='"\0<>]/,
d = function () {};
m.render = m;
var g = function (e, t) {
return m(e, t, c);
},
h = [];
function m(t, r, n) {
(r = r || {}), (n = n || {});
var o = l$1.__s;
l$1.__s = !0;
var a = x(t, r, n);
return l$1.__c && l$1.__c(t, h), (h.length = 0), (l$1.__s = o), a;
}
function x(r, n, l, c, g, h) {
if (null == r || "boolean" == typeof r) return "";
if ("object" != typeof r) return o(r);
var m = l.pretty,
y = m && "string" == typeof m ? m : "\t";
if (Array.isArray(r)) {
for (var b = "", S = 0; S < r.length; S++)
m && S > 0 && (b += "\n"), (b += x(r[S], n, l, c, g, h));
return b;
}
var w,
k = r.type,
O = r.props,
C = !1;
if ("function" == typeof k) {
if (((C = !0), !l.shallow || (!c && !1 !== l.renderRootComponent))) {
if (k === d$1) {
var A = [];
return (
u(A, r.props.children),
x(A, n, l, !1 !== l.shallowHighOrder, g, h)
);
}
var H,
j = (r.__c = {
__v: r,
context: n,
props: r.props,
setState: d,
forceUpdate: d,
__h: [],
});
if (
(l$1.__b && l$1.__b(r),
l$1.__r && l$1.__r(r),
k.prototype && "function" == typeof k.prototype.render)
) {
var F = k.contextType,
M = F && n[F.__c],
T = null != F ? (M ? M.props.value : F.__) : n;
((j = r.__c = new k(O, T)).__v = r),
(j._dirty = j.__d = !0),
(j.props = O),
null == j.state && (j.state = {}),
null == j._nextState &&
null == j.__s &&
(j._nextState = j.__s = j.state),
(j.context = T),
k.getDerivedStateFromProps
? (j.state = f(
f({}, j.state),
k.getDerivedStateFromProps(j.props, j.state)
))
: j.componentWillMount &&
(j.componentWillMount(),
(j.state =
j._nextState !== j.state
? j._nextState
: j.__s !== j.state
? j.__s
: j.state)),
(H = j.render(j.props, j.state, j.context));
} else {
var $ = k.contextType,
L = $ && n[$.__c];
H = k.call(
r.__c,
O,
null != $ ? (L ? L.props.value : $.__) : n
);
}
return (
j.getChildContext && (n = f(f({}, n), j.getChildContext())),
l$1.diffed && l$1.diffed(r),
x(H, n, l, !1 !== l.shallowHighOrder, g, h)
);
}
k =
(w = k).displayName ||
(w !== Function && w.name) ||
(function (e) {
var t = (Function.prototype.toString
.call(e)
.match(/^\s*function\s+([^( ]+)/) || "")[1];
if (!t) {
for (var r = -1, n = p.length; n--; )
if (p[n] === e) {
r = n;
break;
}
r < 0 && (r = p.push(e) - 1), (t = "UnnamedComponent" + r);
}
return t;
})(w);
}
var E,
D,
N = "<" + k;
if (O) {
var P = Object.keys(O);
l && !0 === l.sortAttributes && P.sort();
for (var R = 0; R < P.length; R++) {
var U = P[R],
W = O[U];
if ("children" !== U) {
if (
!v.test(U) &&
((l && l.allAttributes) ||
("key" !== U &&
"ref" !== U &&
"__self" !== U &&
"__source" !== U &&
"defaultValue" !== U))
) {
if ("className" === U) {
if (O.class) continue;
U = "class";
} else
g &&
U.match(/^xlink:?./) &&
(U = U.toLowerCase().replace(/^xlink:?/, "xlink:"));
if ("htmlFor" === U) {
if (O.for) continue;
U = "for";
}
"style" === U && W && "object" == typeof W && (W = s(W)),
"a" === U[0] &&
"r" === U[1] &&
"boolean" == typeof W &&
(W = String(W));
var q = l.attributeHook && l.attributeHook(U, W, n, l, C);
if (q || "" === q) N += q;
else if ("dangerouslySetInnerHTML" === U) D = W && W.__html;
else if ("textarea" === k && "value" === U) E = W;
else if (
(W || 0 === W || "" === W) &&
"function" != typeof W
) {
if (
!((!0 !== W && "" !== W) || ((W = U), l && l.xml))
) {
N += " " + U;
continue;
}
if ("value" === U) {
if ("select" === k) {
h = W;
continue;
}
"option" === k && h == W && (N += " selected");
}
N += " " + U + '="' + o(W) + '"';
}
}
} else E = W;
}
}
if (m) {
var z = N.replace(/\n\s*/, " ");
z === N || ~z.indexOf("\n")
? m && ~N.indexOf("\n") && (N += "\n")
: (N = z);
}
if (((N += ">"), v.test(k)))
throw new Error(k + " is not a valid HTML tag name in " + N);
var I,
V = _.test(k) || (l.voidElements && l.voidElements.test(k)),
Z = [];
if (D) m && i(D) && (D = "\n" + y + a(D, y)), (N += D);
else if (null != E && u((I = []), E).length) {
for (var B = m && ~N.indexOf("\n"), G = !1, J = 0; J < I.length; J++) {
var K = I[J];
if (null != K && !1 !== K) {
var Q = x(
K,
n,
l,
!0,
"svg" === k || ("foreignObject" !== k && g),
h
);
if ((m && !B && i(Q) && (B = !0), Q))
if (m) {
var X = Q.length > 0 && "<" != Q[0];
G && X ? (Z[Z.length - 1] += Q) : Z.push(Q), (G = X);
} else Z.push(Q);
}
}
if (m && B) for (var Y = Z.length; Y--; ) Z[Y] = "\n" + y + a(Z[Y], y);
}
if (Z.length || D) N += Z.join("");
else if (l && l.xml) return N.substring(0, N.length - 1) + " />";
return (
!V || I || D
? (m && ~N.indexOf("\n") && (N += "\n"), (N += "</" + k + ">"))
: (N = N.replace(/>$/, " />")),
N
);
}
m.shallowRender = g;
let vnodeHook;
const old = l$1.vnode;
l$1.vnode = (vnode) => {
if (old) old(vnode);
if (vnodeHook) vnodeHook(vnode);
};
/**
* @param {ReturnType<h>} vnode The root JSX element to render (eg: `<App />`)
* @param {object} [options]
* @param {number} [options.maxDepth = 10] The maximum number of nested asynchronous operations to wait for before flushing
* @param {object} [options.props] Additional props to merge into the root JSX element
*/
async function prerender(vnode, options) {
options = options || {};
const maxDepth = options.maxDepth || 10;
const props = options.props;
let tries = 0;
if (typeof vnode === "function") {
vnode = v$1(vnode, props);
} else if (props) {
vnode = B(vnode, props);
}
const render = () => {
if (++tries > maxDepth) return;
try {
return m(vnode);
} catch (e) {
if (e && e.then) return e.then(render);
throw e;
}
};
let links = new Set();
vnodeHook = ({ type, props }) => {
if (
type === "a" &&
props &&
props.href &&
(!props.target || props.target === "_self")
) {
links.add(props.href);
}
};
try {
const html = await render();
return {
html,
links,
};
} finally {
vnodeHook = null;
}
}
export default prerender;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/wmr/archive-1/chunks/.prerender.daa73035/output.js | JavaScript | import {
l as l$1, d as d$1, v as v$1, B,
} from "../index.f66dda46.js";
var r = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i,
n = /[&<>"]/;
function o(
e
) {
var t = String(
e
);
return n.test(
t
)
? t
.replace(
/&/g,
"&"
)
.replace(
/</g,
"<"
)
.replace(
/>/g,
">"
)
.replace(
/"/g,
"""
)
: t;
}
var a = function (
e, t
) {
return String(
e
).replace(
/(\n+)/g,
"$1" + (t || "\t")
);
},
i = function (
e, t, r
) {
return (
String(
e
).length > (t || 40) ||
(!r && -1 !== String(
e
).indexOf(
"\n"
)) ||
-1 !== String(
e
).indexOf(
"<"
)
);
},
l = {
};
function s(
e
) {
var t = "";
for (var n in e) {
var o = e[n];
null != o &&
"" !== o &&
(t && (t += " "),
(t +=
"-" == n[0]
? n
: l[n] ||
(l[n] = n.replace(
/([A-Z])/g,
"-$1"
).toLowerCase(
))),
(t += ": "),
(t += o),
"number" == typeof o && !1 === r.test(
n
) && (t += "px"),
(t += ";"));
}
return t || void 0;
}
function f(
e, t
) {
for (var r in t) e[r] = t[r];
return e;
}
function u(
e, t
) {
return (
Array.isArray(
t
)
? t.reduce(
u,
e
)
: null != t && !1 !== t && e.push(
t
),
e
);
}
var c = {
shallow: !0,
},
p = [],
_ =
/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,
v = /[\s\n\\/='"\0<>]/,
d = function (
) {};
m.render = m;
var g = function (
e, t
) {
return m(
e,
t,
c
);
},
h = [];
function m(
t, r, n
) {
(r = r || {
}), (n = n || {
});
var o = l$1.__s;
l$1.__s = !0;
var a = x(
t,
r,
n
);
return l$1.__c && l$1.__c(
t,
h
), (h.length = 0), (l$1.__s = o), a;
}
function x(
r, n, l, c, g, h
) {
if (null == r || "boolean" == typeof r) return "";
if ("object" != typeof r) return o(
r
);
var m = l.pretty,
y = m && "string" == typeof m ? m : "\t";
if (Array.isArray(
r
)) {
for (var b = "", S = 0; S < r.length; S++)
m && S > 0 && (b += "\n"), (b += x(
r[S],
n,
l,
c,
g,
h
));
return b;
}
var w,
k = r.type,
O = r.props,
C = !1;
if ("function" == typeof k) {
if (((C = !0), !l.shallow || (!c && !1 !== l.renderRootComponent))) {
if (k === d$1) {
var A = [];
return (
u(
A,
r.props.children
),
x(
A,
n,
l,
!1 !== l.shallowHighOrder,
g,
h
)
);
}
var H,
j = (r.__c = {
__v: r,
context: n,
props: r.props,
setState: d,
forceUpdate: d,
__h: [],
});
if (
(l$1.__b && l$1.__b(
r
),
l$1.__r && l$1.__r(
r
),
k.prototype && "function" == typeof k.prototype.render)
) {
var F = k.contextType,
M = F && n[F.__c],
T = null != F ? (M ? M.props.value : F.__) : n;
((j = r.__c = new k(
O,
T
)).__v = r),
(j._dirty = j.__d = !0),
(j.props = O),
null == j.state && (j.state = {
}),
null == j._nextState &&
null == j.__s &&
(j._nextState = j.__s = j.state),
(j.context = T),
k.getDerivedStateFromProps
? (j.state = f(
f(
{
},
j.state
),
k.getDerivedStateFromProps(
j.props,
j.state
)
))
: j.componentWillMount &&
(j.componentWillMount(
),
(j.state =
j._nextState !== j.state
? j._nextState
: j.__s !== j.state
? j.__s
: j.state)),
(H = j.render(
j.props,
j.state,
j.context
));
} else {
var $ = k.contextType,
L = $ && n[$.__c];
H = k.call(
r.__c,
O,
null != $ ? (L ? L.props.value : $.__) : n
);
}
return (
j.getChildContext && (n = f(
f(
{
},
n
),
j.getChildContext(
)
)),
l$1.diffed && l$1.diffed(
r
),
x(
H,
n,
l,
!1 !== l.shallowHighOrder,
g,
h
)
);
}
k =
(w = k).displayName ||
(w !== Function && w.name) ||
(function (
e
) {
var t = (Function.prototype.toString
.call(
e
)
.match(
/^\s*function\s+([^( ]+)/
) || "")[1];
if (!t) {
for (var r = -1, n = p.length; n--; )
if (p[n] === e) {
r = n;
break;
}
r < 0 && (r = p.push(
e
) - 1), (t = "UnnamedComponent" + r);
}
return t;
})(
w
);
}
var E,
D,
N = "<" + k;
if (O) {
var P = Object.keys(
O
);
l && !0 === l.sortAttributes && P.sort(
);
for (var R = 0; R < P.length; R++) {
var U = P[R],
W = O[U];
if ("children" !== U) {
if (
!v.test(
U
) &&
((l && l.allAttributes) ||
("key" !== U &&
"ref" !== U &&
"__self" !== U &&
"__source" !== U &&
"defaultValue" !== U))
) {
if ("className" === U) {
if (O.class) continue;
U = "class";
} else
g &&
U.match(
/^xlink:?./
) &&
(U = U.toLowerCase(
).replace(
/^xlink:?/,
"xlink:"
));
if ("htmlFor" === U) {
if (O.for) continue;
U = "for";
}
"style" === U && W && "object" == typeof W && (W = s(
W
)),
"a" === U[0] &&
"r" === U[1] &&
"boolean" == typeof W &&
(W = String(
W
));
var q = l.attributeHook && l.attributeHook(
U,
W,
n,
l,
C
);
if (q || "" === q) N += q;
else if ("dangerouslySetInnerHTML" === U) D = W && W.__html;
else if ("textarea" === k && "value" === U) E = W;
else if (
(W || 0 === W || "" === W) &&
"function" != typeof W
) {
if (
!((!0 !== W && "" !== W) || ((W = U), l && l.xml))
) {
N += " " + U;
continue;
}
if ("value" === U) {
if ("select" === k) {
h = W;
continue;
}
"option" === k && h == W && (N += " selected");
}
N += " " + U + '="' + o(
W
) + '"';
}
}
} else E = W;
}
}
if (m) {
var z = N.replace(
/\n\s*/,
" "
);
z === N || ~z.indexOf(
"\n"
)
? m && ~N.indexOf(
"\n"
) && (N += "\n")
: (N = z);
}
if (((N += ">"), v.test(
k
)))
throw new Error(
k + " is not a valid HTML tag name in " + N
);
var I,
V = _.test(
k
) || (l.voidElements && l.voidElements.test(
k
)),
Z = [];
if (D) m && i(
D
) && (D = "\n" + y + a(
D,
y
)), (N += D);
else if (null != E && u(
(I = []),
E
).length) {
for (var B = m && ~N.indexOf(
"\n"
), G = !1, J = 0; J < I.length; J++) {
var K = I[J];
if (null != K && !1 !== K) {
var Q = x(
K,
n,
l,
!0,
"svg" === k || ("foreignObject" !== k && g),
h
);
if ((m && !B && i(
Q
) && (B = !0), Q))
if (m) {
var X = Q.length > 0 && "<" != Q[0];
G && X
? (Z[Z.length - 1] += Q)
: Z.push(
Q
), (G = X);
} else Z.push(
Q
);
}
}
if (m && B) for (var Y = Z.length; Y--; ) Z[Y] = "\n" + y + a(
Z[Y],
y
);
}
if (Z.length || D) N += Z.join(
""
);
else if (l && l.xml) return N.substring(
0,
N.length - 1
) + " />";
return (
!V || I || D
? (m && ~N.indexOf(
"\n"
) && (N += "\n"), (N += "</" + k + ">"))
: (N = N.replace(
/>$/,
" />"
)),
N
);
}
let vnodeHook;
m.shallowRender = g;
const old = l$1.vnode;
async function prerender(
vnode, options
) {
const maxDepth = (options = options || {
}).maxDepth || 10,
props = options.props;
let tries = 0;
"function" == typeof vnode
? (vnode = v$1(
vnode,
props
))
: props && (vnode = B(
vnode,
props
));
const render = (
) => {
if (!(++tries > maxDepth))
try {
return m(
vnode
);
} catch (e) {
if (e && e.then) return e.then(
render
);
throw e;
}
};
let links = new Set(
);
vnodeHook = (
{
type: type, props: props,
}
) => {
"a" !== type ||
!props ||
!props.href ||
(props.target && "_self" !== props.target) ||
links.add(
props.href
);
};
try {
return {
html: await render(
),
links: links,
};
} finally {
vnodeHook = null;
}
}
l$1.vnode = (
vnode
) => {
old && old(
vnode
), vnodeHook && vnodeHook(
vnode
);
};
export default prerender;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/wmr/archive-1/chunks/alias-outside.6e8773c7/input.js | JavaScript | import { m } from "../index.f66dda46.js";
const value$1 = "it works";
const value = "it works";
function AliasOutside() {
return m`<div><p>Inside: ${value}</p><p>Outside: ${value$1}</p></div>`;
}
export default AliasOutside;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/wmr/archive-1/chunks/alias-outside.6e8773c7/output.js | JavaScript | import { m } from "../index.f66dda46.js";
export default function() {
return m`<div><p>Inside: ${"it works"}</p><p>Outside: ${"it works"}</p></div>`;
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/wmr/archive-1/chunks/class-fields.43d5f69c/input.js | JavaScript | import { _, m } from "../index.f66dda46.js";
class ClassFields extends _ {
state = {
value: 1,
};
onClick = () => {
this.setState((prev) => ({
value: prev.value + 1,
}));
};
render() {
return m`<div><p> State: <span>${this.state.value}</span></p><button onClick=${this.onClick}>click me</button></div>`;
}
}
export default ClassFields;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/wmr/archive-1/chunks/class-fields.43d5f69c/output.js | JavaScript | import { _, m } from "../index.f66dda46.js";
export default class extends _ {
state = {
value: 1
};
onClick = ()=>{
this.setState((prev)=>({
value: prev.value + 1
}));
};
render() {
return m`<div><p> State: <span>${this.state.value}</span></p><button onClick=${this.onClick}>click me</button></div>`;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/wmr/archive-1/chunks/hoofd.module.6c5395cb/input.js | JavaScript | import { D, F, y, b as s } from "../index.f66dda46.js";
var isServerSide = typeof document === "undefined";
var META = "M";
var TITLE = "T";
var LINK = "L";
var TEMPLATE = "P";
var SCRIPT = "S";
var applyTitleTemplate = function applyTitleTemplate(title, template) {
return template ? template.replace(/%s/g, title || "") : title;
};
var changeOrCreateMetaTag = function changeOrCreateMetaTag(meta) {
var result = document.head.querySelectorAll(
meta.charset
? "meta[" + meta.keyword + "]"
: "meta[" + meta.keyword + '="' + meta[meta.keyword] + '"]'
);
if (result[0]) {
if (meta.charset) {
result[0].setAttribute(meta.keyword, meta.charset);
} else {
result[0].setAttribute("content", meta.content);
}
} else {
var metaTag = document.createElement("meta");
if (meta.charset) {
metaTag.setAttribute(meta.keyword, meta.charset);
} else {
metaTag.setAttribute(meta.keyword, meta[meta.keyword]);
metaTag.setAttribute("content", meta.content);
}
document.head.appendChild(metaTag);
}
};
var createDispatcher = function createDispatcher() {
var lang;
var linkQueue = [];
var scriptQueue = [];
var titleQueue = [];
var titleTemplateQueue = [];
var metaQueue = [];
var currentTitleIndex = 0;
var currentTitleTemplateIndex = 0;
var currentMetaIndex = 0;
var processQueue = (function () {
var timeout;
return function () {
clearTimeout(timeout);
timeout = setTimeout(function () {
timeout = null;
var visited = new Set();
document.title = applyTitleTemplate(
titleQueue[0],
titleTemplateQueue[0]
);
metaQueue.forEach(function (meta) {
if (
!visited.has(
meta.charset ? meta.keyword : meta[meta.keyword]
)
) {
visited.add(
meta.charset ? meta.keyword : meta[meta.keyword]
);
changeOrCreateMetaTag(meta);
}
});
currentTitleIndex =
currentTitleTemplateIndex =
currentMetaIndex =
0;
}, 1000 / 60);
};
})();
return {
_setLang: function _setLang(l) {
lang = l;
},
_addToQueue: function _addToQueue(type, payload) {
if (!isServerSide) processQueue();
if (type === SCRIPT) {
scriptQueue.push(payload);
} else if (type === TITLE) {
titleQueue.splice(currentTitleIndex++, 0, payload);
} else if (type === TEMPLATE) {
titleTemplateQueue.splice(
currentTitleTemplateIndex++,
0,
payload
);
} else if (type === META) {
metaQueue.splice(currentMetaIndex++, 0, payload);
} else {
linkQueue.push(payload);
}
},
_removeFromQueue: function _removeFromQueue(type, payload) {
if (type === TITLE || type === TEMPLATE) {
var queue = type === TEMPLATE ? titleTemplateQueue : titleQueue;
var index = queue.indexOf(payload);
queue.splice(index, 1);
if (index === 0)
document.title = applyTitleTemplate(
titleQueue[0] || "",
titleTemplateQueue[0]
);
} else {
var oldMeta = metaQueue[metaQueue.indexOf(payload)];
if (oldMeta) {
metaQueue.splice(metaQueue.indexOf(payload), 1);
var newMeta = metaQueue.find(function (m) {
return (
m.keyword === oldMeta.keyword &&
(m.charset || m[m.keyword] === oldMeta[m.keyword])
);
});
if (newMeta) {
changeOrCreateMetaTag(newMeta);
} else {
var result = document.head.querySelectorAll(
oldMeta.charset
? "meta[" + oldMeta.keyword + "]"
: "meta[" +
oldMeta.keyword +
'="' +
oldMeta[oldMeta.keyword] +
'"]'
);
document.head.removeChild(result[0]);
}
}
}
},
_change: function _change(type, prevPayload, payload) {
if (type === TITLE || type === TEMPLATE) {
var queue = type === TEMPLATE ? titleTemplateQueue : titleQueue;
queue[queue.indexOf(prevPayload)] = payload;
if (queue.indexOf(payload) === 0) {
document.title = applyTitleTemplate(
queue[queue.indexOf(payload)],
titleTemplateQueue[0]
);
}
} else {
changeOrCreateMetaTag(
(metaQueue[metaQueue.indexOf(prevPayload)] = payload)
);
}
},
_reset: undefined,
toStatic: function toStatic() {
var title = applyTitleTemplate(
titleQueue[titleQueue.length - 1],
titleTemplateQueue[titleTemplateQueue.length - 1]
);
var visited = new Set();
var links = [].concat(linkQueue);
var scripts = [].concat(scriptQueue);
metaQueue.reverse();
var metas = [].concat(metaQueue).filter(function (meta) {
if (
!visited.has(
meta.charset ? meta.keyword : meta[meta.keyword]
)
) {
visited.add(
meta.charset ? meta.keyword : meta[meta.keyword]
);
return true;
}
});
titleQueue = [];
titleTemplateQueue = [];
metaQueue = [];
linkQueue = [];
scriptQueue = [];
currentTitleIndex =
currentTitleTemplateIndex =
currentMetaIndex =
0;
return {
lang: lang,
title: title,
links: links,
scripts: scripts,
metas: metas.map(function (meta) {
var _ref;
return meta.keyword === "charset"
? {
charset: meta[meta.keyword],
}
: ((_ref = {}),
(_ref[meta.keyword] = meta[meta.keyword]),
(_ref.content = meta.content),
_ref);
}),
};
},
};
};
var defaultDispatcher = createDispatcher();
var DispatcherContext = D(defaultDispatcher);
var useLang = function useLang(language) {
var dispatcher = F(DispatcherContext);
if (isServerSide) {
dispatcher._setLang(language);
}
y(
function () {
document
.getElementsByTagName("html")[0]
.setAttribute("lang", language);
},
[language]
);
};
var useLink = function useLink(options) {
var dispatcher = F(DispatcherContext);
var hasMounted = s(false);
var node = s();
var originalOptions = s();
if (isServerSide && !hasMounted.current) {
dispatcher._addToQueue(LINK, options);
}
y(
function () {
if (hasMounted.current) {
Object.keys(options).forEach(function (key) {
node.current.setAttribute(key, options[key]);
});
}
},
[
options.href,
options.media,
options.as,
options.rel,
options.crossorigin,
options.type,
options.hreflang,
]
);
y(function () {
hasMounted.current = true;
var preExistingElements = document.querySelectorAll(
'link[rel="' + options.rel + '"]'
);
preExistingElements.forEach(function (x) {
var found = true;
Object.keys(options).forEach(function (key) {
if (x.getAttribute(key) !== options[key]) {
found = false;
}
});
if (found) {
node.current = x;
}
});
if (node.current) {
originalOptions.current = Object.keys(options).reduce(function (
acc,
key
) {
acc[key] = node.current.getAttribute(key);
return acc;
},
{});
} else {
node.current = document.createElement("link");
Object.keys(options).forEach(function (key) {
node.current.setAttribute(key, options[key]);
});
document.head.appendChild(node.current);
}
return function () {
hasMounted.current = false;
if (originalOptions.current) {
Object.keys(originalOptions.current).forEach(function (key) {
node.current.setAttribute(
key,
originalOptions.current[key]
);
});
} else {
document.head.removeChild(node.current);
}
};
}, []);
};
function extractKeyword(meta) {
return meta.charset
? "charset"
: meta.name
? "name"
: meta.property
? "property"
: "http-equiv";
}
var useMeta = function useMeta(options) {
var dispatcher = F(DispatcherContext);
var hasMounted = s(false);
var keyword = s();
var metaObject = s({
keyword: (keyword.current = extractKeyword(options)),
name: options.name,
charset: options.charset,
"http-equiv": options.httpEquiv,
property: options.property,
content: options.content,
});
if (isServerSide && !hasMounted.current) {
dispatcher._addToQueue(META, metaObject.current);
}
y(
function () {
if (hasMounted.current) {
dispatcher._change(
META,
metaObject.current,
(metaObject.current = {
keyword: keyword.current,
name: options.name,
charset: options.charset,
"http-equiv": options.httpEquiv,
property: options.property,
content: options.content,
})
);
}
},
[options.content]
);
y(function () {
dispatcher._addToQueue(META, metaObject.current);
hasMounted.current = true;
return function () {
hasMounted.current = false;
dispatcher._removeFromQueue(META, metaObject.current);
};
}, []);
};
var useTitle = function useTitle(title, template) {
var dispatcher = F(DispatcherContext);
var hasMounted = s(false);
var prevTitle = s();
if (isServerSide && !hasMounted.current) {
dispatcher._addToQueue(template ? TEMPLATE : TITLE, title);
}
y(
function () {
if (hasMounted.current) {
dispatcher._change(
template ? TEMPLATE : TITLE,
prevTitle.current,
(prevTitle.current = title)
);
}
},
[title, template]
);
y(
function () {
hasMounted.current = true;
dispatcher._addToQueue(
template ? TEMPLATE : TITLE,
(prevTitle.current = title)
);
return function () {
hasMounted.current = false;
dispatcher._removeFromQueue(
template ? TEMPLATE : TITLE,
prevTitle.current
);
};
},
[template]
);
};
var useTitleTemplate = function useTitleTemplate(template) {
useTitle(template, true);
};
var toStatic = defaultDispatcher.toStatic;
export {
useTitleTemplate as a,
useTitle as b,
useMeta as c,
useLink as d,
toStatic as t,
useLang as u,
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/wmr/archive-1/chunks/hoofd.module.6c5395cb/output.js | JavaScript | import { D, F, y, b as s } from "../index.f66dda46.js";
var lang, linkQueue, scriptQueue, titleQueue, titleTemplateQueue, metaQueue, currentTitleIndex, currentTitleTemplateIndex, currentMetaIndex, timeout, processQueue, isServerSide = "undefined" == typeof document, applyTitleTemplate = function(title, template) {
return template ? template.replace(/%s/g, title || "") : title;
}, changeOrCreateMetaTag = function(meta) {
var result = document.head.querySelectorAll(meta.charset ? "meta[" + meta.keyword + "]" : "meta[" + meta.keyword + '="' + meta[meta.keyword] + '"]');
if (result[0]) meta.charset ? result[0].setAttribute(meta.keyword, meta.charset) : result[0].setAttribute("content", meta.content);
else {
var metaTag = document.createElement("meta");
meta.charset ? metaTag.setAttribute(meta.keyword, meta.charset) : (metaTag.setAttribute(meta.keyword, meta[meta.keyword]), metaTag.setAttribute("content", meta.content)), document.head.appendChild(metaTag);
}
}, defaultDispatcher = (linkQueue = [], scriptQueue = [], titleQueue = [], titleTemplateQueue = [], metaQueue = [], currentTitleIndex = 0, currentTitleTemplateIndex = 0, currentMetaIndex = 0, processQueue = function() {
clearTimeout(timeout), timeout = setTimeout(function() {
timeout = null;
var visited = new Set();
document.title = applyTitleTemplate(titleQueue[0], titleTemplateQueue[0]), metaQueue.forEach(function(meta) {
visited.has(meta.charset ? meta.keyword : meta[meta.keyword]) || (visited.add(meta.charset ? meta.keyword : meta[meta.keyword]), changeOrCreateMetaTag(meta));
}), currentTitleIndex = currentTitleTemplateIndex = currentMetaIndex = 0;
}, 1000 / 60);
}, {
_setLang: function(l) {
lang = l;
},
_addToQueue: function(type, payload) {
isServerSide || processQueue(), "S" === type ? scriptQueue.push(payload) : "T" === type ? titleQueue.splice(currentTitleIndex++, 0, payload) : "P" === type ? titleTemplateQueue.splice(currentTitleTemplateIndex++, 0, payload) : "M" === type ? metaQueue.splice(currentMetaIndex++, 0, payload) : linkQueue.push(payload);
},
_removeFromQueue: function(type, payload) {
if ("T" === type || "P" === type) {
var queue = "P" === type ? titleTemplateQueue : titleQueue, index = queue.indexOf(payload);
queue.splice(index, 1), 0 === index && (document.title = applyTitleTemplate(titleQueue[0] || "", titleTemplateQueue[0]));
} else {
var oldMeta = metaQueue[metaQueue.indexOf(payload)];
if (oldMeta) {
metaQueue.splice(metaQueue.indexOf(payload), 1);
var newMeta = metaQueue.find(function(m) {
return m.keyword === oldMeta.keyword && (m.charset || m[m.keyword] === oldMeta[m.keyword]);
});
if (newMeta) changeOrCreateMetaTag(newMeta);
else {
var result = document.head.querySelectorAll(oldMeta.charset ? "meta[" + oldMeta.keyword + "]" : "meta[" + oldMeta.keyword + '="' + oldMeta[oldMeta.keyword] + '"]');
document.head.removeChild(result[0]);
}
}
}
},
_change: function(type, prevPayload, payload) {
if ("T" === type || "P" === type) {
var queue = "P" === type ? titleTemplateQueue : titleQueue;
queue[queue.indexOf(prevPayload)] = payload, 0 === queue.indexOf(payload) && (document.title = applyTitleTemplate(queue[queue.indexOf(payload)], titleTemplateQueue[0]));
} else changeOrCreateMetaTag(metaQueue[metaQueue.indexOf(prevPayload)] = payload);
},
_reset: void 0,
toStatic: function() {
var title = applyTitleTemplate(titleQueue[titleQueue.length - 1], titleTemplateQueue[titleTemplateQueue.length - 1]), visited = new Set(), links = [].concat(linkQueue), scripts = [].concat(scriptQueue);
metaQueue.reverse();
var metas = [].concat(metaQueue).filter(function(meta) {
if (!visited.has(meta.charset ? meta.keyword : meta[meta.keyword])) return visited.add(meta.charset ? meta.keyword : meta[meta.keyword]), !0;
});
return titleQueue = [], titleTemplateQueue = [], metaQueue = [], linkQueue = [], scriptQueue = [], currentTitleIndex = currentTitleTemplateIndex = currentMetaIndex = 0, {
lang: lang,
title: title,
links: links,
scripts: scripts,
metas: metas.map(function(meta) {
var _ref;
return "charset" === meta.keyword ? {
charset: meta[meta.keyword]
} : ((_ref = {})[meta.keyword] = meta[meta.keyword], _ref.content = meta.content, _ref);
})
};
}
}), DispatcherContext = D(defaultDispatcher), useLang = function(language) {
var dispatcher = F(DispatcherContext);
isServerSide && dispatcher._setLang(language), y(function() {
document.getElementsByTagName("html")[0].setAttribute("lang", language);
}, [
language
]);
}, useLink = function(options) {
var dispatcher = F(DispatcherContext), hasMounted = s(!1), node = s(), originalOptions = s();
isServerSide && !hasMounted.current && dispatcher._addToQueue("L", options), y(function() {
hasMounted.current && Object.keys(options).forEach(function(key) {
node.current.setAttribute(key, options[key]);
});
}, [
options.href,
options.media,
options.as,
options.rel,
options.crossorigin,
options.type,
options.hreflang
]), y(function() {
return hasMounted.current = !0, document.querySelectorAll('link[rel="' + options.rel + '"]').forEach(function(x) {
var found = !0;
Object.keys(options).forEach(function(key) {
x.getAttribute(key) !== options[key] && (found = !1);
}), found && (node.current = x);
}), node.current ? originalOptions.current = Object.keys(options).reduce(function(acc, key) {
return acc[key] = node.current.getAttribute(key), acc;
}, {}) : (node.current = document.createElement("link"), Object.keys(options).forEach(function(key) {
node.current.setAttribute(key, options[key]);
}), document.head.appendChild(node.current)), function() {
hasMounted.current = !1, originalOptions.current ? Object.keys(originalOptions.current).forEach(function(key) {
node.current.setAttribute(key, originalOptions.current[key]);
}) : document.head.removeChild(node.current);
};
}, []);
}, useMeta = function(options) {
var dispatcher = F(DispatcherContext), hasMounted = s(!1), keyword = s(), metaObject = s({
keyword: keyword.current = options.charset ? "charset" : options.name ? "name" : options.property ? "property" : "http-equiv",
name: options.name,
charset: options.charset,
"http-equiv": options.httpEquiv,
property: options.property,
content: options.content
});
isServerSide && !hasMounted.current && dispatcher._addToQueue("M", metaObject.current), y(function() {
hasMounted.current && dispatcher._change("M", metaObject.current, metaObject.current = {
keyword: keyword.current,
name: options.name,
charset: options.charset,
"http-equiv": options.httpEquiv,
property: options.property,
content: options.content
});
}, [
options.content
]), y(function() {
return dispatcher._addToQueue("M", metaObject.current), hasMounted.current = !0, function() {
hasMounted.current = !1, dispatcher._removeFromQueue("M", metaObject.current);
};
}, []);
}, useTitle = function(title, template) {
var dispatcher = F(DispatcherContext), hasMounted = s(!1), prevTitle = s();
isServerSide && !hasMounted.current && dispatcher._addToQueue(template ? "P" : "T", title), y(function() {
hasMounted.current && dispatcher._change(template ? "P" : "T", prevTitle.current, prevTitle.current = title);
}, [
title,
template
]), y(function() {
return hasMounted.current = !0, dispatcher._addToQueue(template ? "P" : "T", prevTitle.current = title), function() {
hasMounted.current = !1, dispatcher._removeFromQueue(template ? "P" : "T", prevTitle.current);
};
}, [
template
]);
}, useTitleTemplate = function(template) {
useTitle(template, !0);
}, toStatic = defaultDispatcher.toStatic;
export { useTitleTemplate as a, useTitle as b, useMeta as c, useLink as d, toStatic as t, useLang as u };
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/wmr/archive-1/chunks/index.5a544c41/input.js | JavaScript | import { m } from "../index.f66dda46.js";
const jpg = "/assets/img.2dae108d.jpg";
function Files() {
return m`<div style="padding: 2rem;"><h1>Files</h1><p> jpg: ${jpg}<br/><img src=${jpg} alt="" height="320"/></p></div>`;
}
export default Files;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/wmr/archive-1/chunks/index.5a544c41/output.js | JavaScript | import { m } from "../index.f66dda46.js";
const jpg = "/assets/img.2dae108d.jpg";
export default function() {
return m`<div style="padding: 2rem;"><h1>Files</h1><p> jpg: ${jpg}<br/><img src=${jpg} alt="" height="320"/></p></div>`;
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/wmr/archive-1/chunks/index.bf24abaa/input.js | JavaScript | import { s as style, m } from "../index.f66dda46.js";
const process = {
browser: true,
env: {
FOO: "bar",
OVERRIDE: "11",
EMPTY: "",
FOO_LOCAL: "bar",
NODE_ENV: "production",
},
};
null;
const foo = 42;
function Environment() {
return m`<table><thead><tr><th>Name ${foo}</th><th>Value</th></tr></thead><tbody>${Object.keys(
process.env
)
.sort()
.map((key) => {
return m`<tr key=${key}><td>${key}</td><td>${String(
process.env[key]
)}</td></tr>`;
})}</tbody></table>`;
}
export { Environment };
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/wmr/archive-1/chunks/index.bf24abaa/output.js | JavaScript | import { m } from "../index.f66dda46.js";
const process_env = {
FOO: "bar",
OVERRIDE: "11",
EMPTY: "",
FOO_LOCAL: "bar",
NODE_ENV: "production"
};
function Environment() {
return m`<table><thead><tr><th>Name ${42}</th><th>Value</th></tr></thead><tbody>${Object.keys(process_env).sort().map((key)=>m`<tr key=${key}><td>${key}</td><td>${String(process_env[key])}</td></tr>`)}</tbody></table>`;
}
export { Environment };
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/wmr/archive-1/chunks/index.ddc4110d/input.js | JavaScript | import { s as style, y, m } from "../index.f66dda46.js";
null;
const styles = {
about: "about_migxty",
};
function About({ query, title }) {
y(() => {
console.log("Mounted About: ", title);
return () => {
console.log("Unmounting About: ", title);
};
}, []);
return m`<section class=${styles.about}><h1>${
title || "About"
}</h1><p>My name is Jason.</p><pre>${JSON.stringify(
query
)}</pre></section>`;
}
export default About;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/wmr/archive-1/chunks/index.ddc4110d/output.js | JavaScript | import { y, m } from "../index.f66dda46.js";
export default function({ query, title }) {
return y(()=>(console.log("Mounted About: ", title), ()=>{
console.log("Unmounting About: ", title);
}), []), m`<section class=${"about_migxty"}><h1>${title || "About"}</h1><p>My name is Jason.</p><pre>${JSON.stringify(query)}</pre></section>`;
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/wmr/archive-1/chunks/json.5609c5fa/input.js | JavaScript | import { a as l, y, m } from "../index.f66dda46.js";
const json = {
foo: 42,
bar: "bar",
};
function JSONView() {
const [fetched, setFetched] = l(null);
y(() => {
fetch("./pages/foo.json")
.then((r) => r.json())
.then((r) => setFetched(r));
}, []);
return m`<div><p>import: ${JSON.stringify(
json
)}</p><p>fetch: ${JSON.stringify(fetched)}</p></div>`;
}
export { JSONView };
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/wmr/archive-1/chunks/json.5609c5fa/output.js | JavaScript | import { a as l, y, m } from "../index.f66dda46.js";
const json = {
foo: 42,
bar: "bar"
};
function JSONView() {
const [fetched, setFetched] = l(null);
return y(()=>{
fetch("./pages/foo.json").then((r)=>r.json()).then((r)=>setFetched(r));
}, []), m`<div><p>import: ${JSON.stringify(json)}</p><p>fetch: ${JSON.stringify(fetched)}</p></div>`;
}
export { JSONView };
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/wmr/archive-1/chunks/meta-tags.c6b3dbd5/input.js | JavaScript | import { m } from "../index.f66dda46.js";
import {
u as useLang,
a as useTitleTemplate,
b as useTitle,
c as useMeta,
d as useLink,
} from "./hoofd.module.6c5395cb.js";
function MetaTags() {
// Will set <html lang="en">
useLang("nl");
// Will set title to "Welcome to hoofd | 💭"
useTitleTemplate("%s | 💭");
useTitle("Welcome to hoofd");
// Credits to an amazing person
useMeta({
name: "author",
content: "Jovi De Croock",
});
useLink({
rel: "me",
href: "https://jovidecroock.com",
});
return m`<div><h1>Meta tag rendering</h1><p>...check document.head in devtools</p></div>`;
}
export { MetaTags };
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/wmr/archive-1/chunks/meta-tags.c6b3dbd5/output.js | JavaScript | import { m } from "../index.f66dda46.js";
import { u as useLang, a as useTitleTemplate, b as useTitle, c as useMeta, d as useLink } from "./hoofd.module.6c5395cb.js";
function MetaTags() {
return(// Will set <html lang="en">
useLang("nl"), // Will set title to "Welcome to hoofd | 💭"
useTitleTemplate("%s | 💭"), useTitle("Welcome to hoofd"), // Credits to an amazing person
useMeta({
name: "author",
content: "Jovi De Croock"
}), useLink({
rel: "me",
href: "https://jovidecroock.com"
}), m`<div><h1>Meta tag rendering</h1><p>...check document.head in devtools</p></div>`);
}
export { MetaTags };
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/wmr/archive-1/chunks/prerender.93c6f601/input.js | JavaScript | import "../index.f66dda46.js";
import { t as toStatic } from "./hoofd.module.6c5395cb.js";
function prerender$1(vnode, options) {
return import("../prerender.daa73035/input.js").then((m) =>
m.default(vnode, options)
);
}
async function prerender(vnode) {
const res = await prerender$1(vnode);
const head = toStatic();
const elements = new Set([
...head.links.map((props) => ({
type: "link",
props,
})),
...head.metas.map((props) => ({
type: "meta",
props,
})),
...head.scripts.map((props) => ({
type: "script",
props,
})),
]);
return {
...res,
data: {
hello: "world",
},
head: {
title: head.title,
lang: head.lang,
elements,
},
};
}
export { prerender };
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/wmr/archive-1/chunks/prerender.93c6f601/output.js | JavaScript | import "../index.f66dda46.js";
import { t as toStatic } from "./hoofd.module.6c5395cb.js";
async function prerender(vnode) {
const res = await import("../prerender.daa73035/input.js").then((m)=>m.default(vnode, void 0)), head = toStatic(), elements = new Set([
...head.links.map((props)=>({
type: "link",
props
})),
...head.metas.map((props)=>({
type: "meta",
props
})),
...head.scripts.map((props)=>({
type: "script",
props
}))
]);
return {
...res,
data: {
hello: "world"
},
head: {
title: head.title,
lang: head.lang,
elements
}
};
}
export { prerender };
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/yui/1/input.js | JavaScript | export const E = {
test: function (Y) {
var DOCUMENT = Y.config.doc,
useSVG =
!Y.config.defaultGraphicEngine ||
Y.config.defaultGraphicEngine != "canvas",
canvas = DOCUMENT && DOCUMENT.createElement("canvas"),
svg =
DOCUMENT &&
DOCUMENT.implementation.hasFeature(
"http://www.w3.org/TR/SVG11/feature#BasicStructure",
"1.1"
);
return svg && (useSVG || !canvas);
},
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/yui/1/output.js | JavaScript | export const E = {
test: function(Y) {
var DOCUMENT = Y.config.doc, useSVG = !Y.config.defaultGraphicEngine || "canvas" != Y.config.defaultGraphicEngine, canvas = DOCUMENT && DOCUMENT.createElement("canvas");
return DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (useSVG || !canvas);
}
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/yui/10/input.js | JavaScript | export var _path = function (dir, file, type, nomin) {
var path = dir + "/" + file;
if (!nomin) {
path += "-min";
}
path += "." + (type || CSS);
return path;
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/yui/10/output.js | JavaScript | export var _path = function(dir, file, type, nomin) {
var path = dir + "/" + file;
return nomin || (path += "-min"), path += "." + (type || CSS);
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/yui/11/input.js | JavaScript | export function foo() {
return (src = src || ""), void 0 !== src;
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/yui/11/output.js | JavaScript | export function foo() {
return void 0 !== (src = src || "");
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/yui/12/input.js | JavaScript | export const E = {
test: function (cat, name, args) {
args = args || [];
var result,
ua,
test,
cat_o = feature_tests[cat],
feature = cat_o && cat_o[name];
if (!feature) {
} else {
result = feature.result;
if (Y.Lang.isUndefined(result)) {
ua = feature.ua;
if (ua) {
result = Y.UA[ua];
}
test = feature.test;
if (test && (!ua || result)) {
result = test.apply(Y, args);
}
feature.result = result;
}
}
return result;
},
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/yui/12/output.js | JavaScript | export const E = {
test: function(cat, name, args) {
args = args || [];
var result, ua, test, cat_o = feature_tests[cat], feature = cat_o && cat_o[name];
return feature && (result = feature.result, Y.Lang.isUndefined(result) && ((ua = feature.ua) && (result = Y.UA[ua]), (test = feature.test) && (!ua || result) && (result = test.apply(Y, args)), feature.result = result)), result;
}
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/yui/13/input.js | JavaScript | export const E = {
_getTransaction: function (urls, options) {
var requests = [],
i,
len,
req,
url;
if (!Lang.isArray(urls)) {
urls = [urls];
}
options = Y.merge(this.options, options);
// Clone the attributes object so we don't end up modifying it by ref.
options.attributes = Y.merge(
this.options.attributes,
options.attributes
);
for (i = 0, len = urls.length; i < len; ++i) {
url = urls[i];
req = { attributes: {} };
// If `url` is a string, we create a URL object for it, then mix in
// global options and request-specific options. If it's an object
// with a "url" property, we assume it's a request object containing
// URL-specific options.
if (typeof url === "string") {
req.url = url;
} else if (url.url) {
// URL-specific options override both global defaults and
// request-specific options.
Y.mix(req, url, false, null, 0, true);
url = url.url; // Make url a string so we can use it later.
} else {
continue;
}
Y.mix(req, options, false, null, 0, true);
// If we didn't get an explicit type for this URL either in the
// request options or the URL-specific options, try to determine
// one from the file extension.
if (!req.type) {
if (this.REGEX_CSS.test(url)) {
req.type = "css";
} else {
if (!this.REGEX_JS.test(url)) {
}
req.type = "js";
}
}
// Mix in type-specific default options, but don't overwrite any
// options that have already been set.
Y.mix(
req,
req.type === "js" ? this.jsOptions : this.cssOptions,
false,
null,
0,
true
);
// Give the node an id attribute if it doesn't already have one.
req.attributes.id || (req.attributes.id = Y.guid());
// Backcompat for <3.5.0 behavior.
if (req.win) {
req.doc = req.win.document;
} else {
req.win = req.doc.defaultView || req.doc.parentWindow;
}
if (req.charset) {
req.attributes.charset = req.charset;
}
requests.push(req);
}
return new Transaction(requests, options);
},
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/yui/13/output.js | JavaScript | export const E = {
_getTransaction: function(urls, options) {
var i, len, req, url, requests = [];
for(Lang.isArray(urls) || (urls = [
urls
]), // Clone the attributes object so we don't end up modifying it by ref.
(options = Y.merge(this.options, options)).attributes = Y.merge(this.options.attributes, options.attributes), i = 0, len = urls.length; i < len; ++i){
// If `url` is a string, we create a URL object for it, then mix in
// global options and request-specific options. If it's an object
// with a "url" property, we assume it's a request object containing
// URL-specific options.
if (url = urls[i], req = {
attributes: {}
}, "string" == typeof url) req.url = url;
else {
if (!url.url) continue;
// URL-specific options override both global defaults and
// request-specific options.
Y.mix(req, url, !1, null, 0, !0), url = url.url;
}
Y.mix(req, options, !1, null, 0, !0), req.type || (this.REGEX_CSS.test(url) ? req.type = "css" : (this.REGEX_JS.test(url), req.type = "js")), // Mix in type-specific default options, but don't overwrite any
// options that have already been set.
Y.mix(req, "js" === req.type ? this.jsOptions : this.cssOptions, !1, null, 0, !0), // Give the node an id attribute if it doesn't already have one.
req.attributes.id || (req.attributes.id = Y.guid()), req.win ? req.doc = req.win.document : req.win = req.doc.defaultView || req.doc.parentWindow, req.charset && (req.attributes.charset = req.charset), requests.push(req);
}
return new Transaction(requests, options);
}
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/yui/14/input.js | JavaScript | YArray.indexOf = Lang._isNative(Native.indexOf)
? function (array, value, from) {
return Native.indexOf.call(array, value, from);
}
: function (array, value, from) {
// http://es5.github.com/#x15.4.4.14
var len = array.length;
from = +from || 0;
from = (from > 0 || -1) * Math.floor(Math.abs(from));
if (from < 0) {
from += len;
if (from < 0) {
from = 0;
}
}
for (; from < len; ++from) {
if (from in array && array[from] === value) {
return from;
}
}
return -1;
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/yui/14/output.js | JavaScript | YArray.indexOf = Lang._isNative(Native.indexOf) ? function(array, value, from) {
return Native.indexOf.call(array, value, from);
} : function(array, value, from) {
// http://es5.github.com/#x15.4.4.14
var len = array.length;
for((from = ((from = +from || 0) > 0 || -1) * Math.floor(Math.abs(from))) < 0 && (from += len) < 0 && (from = 0); from < len; ++from)if (from in array && array[from] === value) return from;
return -1;
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/yui/2/input.js | JavaScript | export const E = {
test: function (Y) {
var doc = Y.config.doc,
node = doc ? doc.documentElement : null;
if (node && node.style) {
return (
"MozTransition" in node.style ||
"WebkitTransition" in node.style ||
"transition" in node.style
);
}
return false;
},
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/yui/2/output.js | JavaScript | export const E = {
test: function(Y) {
var doc = Y.config.doc, node = doc ? doc.documentElement : null;
return !!node && !!node.style && ("MozTransition" in node.style || "WebkitTransition" in node.style || "transition" in node.style);
}
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/yui/3/input.js | JavaScript | Y.Loader.prototype._rollup = function () {
var i,
j,
m,
s,
r = this.required,
roll,
info = this.moduleInfo,
rolled,
c,
smod;
// find and cache rollup modules
if (this.dirty || !this.rollups) {
this.rollups = {};
for (i in info) {
if (info.hasOwnProperty(i)) {
m = this.getModule(i);
// if (m && m.rollup && m.supersedes) {
if (m && m.rollup) {
this.rollups[i] = m;
}
}
}
}
// make as many passes as needed to pick up rollup rollups
for (;;) {
rolled = false;
// go through the rollup candidates
for (i in this.rollups) {
if (this.rollups.hasOwnProperty(i)) {
// there can be only one, unless forced
if (!r[i] && (!this.loaded[i] || this.forceMap[i])) {
m = this.getModule(i);
s = m.supersedes || [];
roll = false;
// @TODO remove continue
if (!m.rollup) {
continue;
}
c = 0;
// check the threshold
for (j = 0; j < s.length; j++) {
smod = info[s[j]];
// if the superseded module is loaded, we can't
// load the rollup unless it has been forced.
if (this.loaded[s[j]] && !this.forceMap[s[j]]) {
roll = false;
break;
// increment the counter if this module is required.
// if we are beyond the rollup threshold, we will
// use the rollup module
} else if (r[s[j]] && m.type === smod.type) {
c++;
roll = c >= m.rollup;
if (roll) {
break;
}
}
}
if (roll) {
// add the rollup
r[i] = true;
rolled = true;
// expand the rollup's dependencies
this.getRequires(m);
}
}
}
}
// if we made it here w/o rolling up something, we are done
if (!rolled) {
break;
}
}
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/yui/3/output.js | JavaScript | Y.Loader.prototype._rollup = function() {
var i, j, m, s, roll, rolled, c, smod, r = this.required, info = this.moduleInfo;
// find and cache rollup modules
if (this.dirty || !this.rollups) for(i in this.rollups = {}, info)info.hasOwnProperty(i) && (m = this.getModule(i)) && m.rollup && (this.rollups[i] = m);
// make as many passes as needed to pick up rollup rollups
for(;;){
// go through the rollup candidates
for(i in rolled = !1, this.rollups)if (this.rollups.hasOwnProperty(i) && !r[i] && (!this.loaded[i] || this.forceMap[i])) {
// @TODO remove continue
if (s = (m = this.getModule(i)).supersedes || [], roll = !1, !m.rollup) continue;
// check the threshold
for(j = 0, c = 0; j < s.length; j++){
// if the superseded module is loaded, we can't
// load the rollup unless it has been forced.
if (smod = info[s[j]], this.loaded[s[j]] && !this.forceMap[s[j]]) {
roll = !1;
break;
// increment the counter if this module is required.
// if we are beyond the rollup threshold, we will
// use the rollup module
}
if (r[s[j]] && m.type === smod.type && (roll = ++c >= m.rollup)) break;
}
roll && (// add the rollup
r[i] = !0, rolled = !0, // expand the rollup's dependencies
this.getRequires(m));
}
// if we made it here w/o rolling up something, we are done
if (!rolled) break;
}
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/yui/4/input.js | JavaScript | export function foo() {
return;
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/yui/4/output.js | JavaScript | export function foo() {}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/yui/5/input.js | JavaScript | export const E = {
_continue: function () {
if (!_queue.running && _queue.size() > 0) {
_queue.running = true;
_queue.next()();
}
},
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/yui/5/output.js | JavaScript | export const E = {
_continue: function() {
!_queue.running && _queue.size() > 0 && (_queue.running = !0, _queue.next()());
}
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/yui/6/input.js | JavaScript | export function foo() {
return (
(actions = -1),
complete({
fn: self._onSuccess,
}),
void 0
);
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/yui/6/output.js | JavaScript | export function foo() {
return actions = -1, void complete({
fn: self._onSuccess
});
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/yui/7/input.js | JavaScript | export const E = {
_sort: function () {
// create an indexed list
var s = YObject.keys(this.required),
// loaded = this.loaded,
//TODO Move this out of scope
done = {},
p = 0,
l,
a,
b,
j,
k,
moved,
doneKey;
// keep going until we make a pass without moving anything
for (;;) {
l = s.length;
moved = false;
// start the loop after items that are already sorted
for (j = p; j < l; j++) {
// check the next module on the list to see if its
// dependencies have been met
a = s[j];
// check everything below current item and move if we
// find a requirement for the current item
for (k = j + 1; k < l; k++) {
doneKey = a + s[k];
if (!done[doneKey] && this._requires(a, s[k])) {
// extract the dependency so we can move it up
b = s.splice(k, 1);
// insert the dependency above the item that
// requires it
s.splice(j, 0, b[0]);
// only swap two dependencies once to short circut
// circular dependencies
done[doneKey] = true;
// keep working
moved = true;
break;
}
}
// jump out of loop if we moved something
if (moved) {
break;
// this item is sorted, move our pointer and keep going
} else {
p++;
}
}
// when we make it here and moved is false, we are
// finished sorting
if (!moved) {
break;
}
}
this.sorted = s;
},
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/yui/7/output.js | JavaScript | export const E = {
_sort: function() {
// keep going until we make a pass without moving anything
for(// create an indexed list
var l, a, b, j, k, moved, doneKey, s = YObject.keys(this.required), // loaded = this.loaded,
//TODO Move this out of scope
done = {}, p = 0;;){
// start the loop after items that are already sorted
for(l = s.length, moved = !1, j = p; j < l; j++){
// check everything below current item and move if we
// find a requirement for the current item
for(// check the next module on the list to see if its
// dependencies have been met
a = s[j], k = j + 1; k < l; k++)if (!done[doneKey = a + s[k]] && this._requires(a, s[k])) {
// extract the dependency so we can move it up
b = s.splice(k, 1), // insert the dependency above the item that
// requires it
s.splice(j, 0, b[0]), // only swap two dependencies once to short circut
// circular dependencies
done[doneKey] = !0, // keep working
moved = !0;
break;
}
// jump out of loop if we moved something
if (moved) break;
p++;
}
// when we make it here and moved is false, we are
// finished sorting
if (!moved) break;
}
this.sorted = s;
}
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/yui/8/input.js | JavaScript | export const E = {
_onProgress: function (e) {
var self = this,
i;
//set the internal cache to what just came in.
if (e.data && e.data.length) {
for (i = 0; i < e.data.length; i++) {
e.data[i] = self.getModule(e.data[i].name);
}
}
if (self.onProgress) {
self.onProgress.call(self.context, {
name: e.url,
data: e.data,
});
}
},
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/yui/8/output.js | JavaScript | export const E = {
_onProgress: function(e) {
var i;
//set the internal cache to what just came in.
if (e.data && e.data.length) for(i = 0; i < e.data.length; i++)e.data[i] = this.getModule(e.data[i].name);
this.onProgress && this.onProgress.call(this.context, {
name: e.url,
data: e.data
});
}
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/yui/9/input.js | JavaScript | export const E = {
_addLangPack: function (lang, m, packName) {
var name = m.name,
packPath,
conf,
existing = this.moduleInfo[packName];
if (!existing) {
packPath = _path(m.pkg || name, packName, JS, true);
conf = {
path: packPath,
intl: true,
langPack: true,
ext: m.ext,
group: m.group,
supersedes: [],
};
if (m.root) {
conf.root = m.root;
}
if (m.base) {
conf.base = m.base;
}
if (m.configFn) {
conf.configFn = m.configFn;
}
this.addModule(conf, packName);
if (lang) {
Y.Env.lang = Y.Env.lang || {};
Y.Env.lang[lang] = Y.Env.lang[lang] || {};
Y.Env.lang[lang][name] = true;
}
}
return this.moduleInfo[packName];
},
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/projects/yui/9/output.js | JavaScript | export const E = {
_addLangPack: function(lang, m, packName) {
var conf, name = m.name;
return !this.moduleInfo[packName] && (conf = {
path: _path(m.pkg || name, packName, JS, !0),
intl: !0,
langPack: !0,
ext: m.ext,
group: m.group,
supersedes: []
}, m.root && (conf.root = m.root), m.base && (conf.base = m.base), m.configFn && (conf.configFn = m.configFn), this.addModule(conf, packName), lang && (Y.Env.lang = Y.Env.lang || {}, Y.Env.lang[lang] = Y.Env.lang[lang] || {}, Y.Env.lang[lang][name] = !0)), this.moduleInfo[packName];
}
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/reduced/1/input.js | JavaScript | var A, B, A1;
!(function (A2) {
var Point;
(A2.Point || (A2.Point = {})).Origin = {
x: 0,
y: 0,
};
})(A || (A = {})),
((A1 = A || (A = {})).Point = function () {
return {
x: 0,
y: 0,
};
}),
(function (B1) {
var Point;
function Point1() {
return {
x: 0,
y: 0,
};
}
((Point1 = B1.Point || (B1.Point = {})).Origin = {
x: 0,
y: 0,
}),
(B1.Point = Point1);
})(B || (B = {}));
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/reduced/1/output.js | JavaScript | var A, B, A2;
((A2 = A || (A = {})).Point || (A2.Point = {})).Origin = {
x: 0,
y: 0
}, (A || (A = {})).Point = function() {
return {
x: 0,
y: 0
};
}, function(B1) {
function Point1() {
return {
x: 0,
y: 0
};
}
(Point1 = B1.Point || (B1.Point = {})).Origin = {
x: 0,
y: 0
}, B1.Point = Point1;
}(B || (B = {}));
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_minifier/tests/fixture/reduced/2/input.js | JavaScript | export const def = {
code(cxt) {
const { gen, schema, parentSchema, data, it } = cxt;
if (
it.opts.removeAdditional === "all" &&
parentSchema.additionalProperties === undefined
) {
additionalProperties_1.default.code(
new validate_1.KeywordCxt(
it,
additionalProperties_1.default,
"additionalProperties"
)
);
}
const allProps = (0, code_1.allSchemaProperties)(schema);
for (const prop of allProps) {
it.definedProperties.add(prop);
}
if (it.opts.unevaluated && allProps.length && it.props !== true) {
it.props = util_1.mergeEvaluated.props(
gen,
(0, util_1.toHash)(allProps),
it.props
);
}
const properties = allProps.filter(
(p) => !(0, util_1.alwaysValidSchema)(it, schema[p])
);
if (properties.length === 0) return;
const valid = gen.name("valid");
for (const prop of properties) {
if (hasDefault(prop)) {
applyPropertySchema(prop);
} else {
gen.if(
(0, code_1.propertyInData)(
gen,
data,
prop,
it.opts.ownProperties
)
);
applyPropertySchema(prop);
if (!it.allErrors) gen.else().var(valid, true);
gen.endIf();
}
cxt.it.definedProperties.add(prop);
cxt.ok(valid);
}
function hasDefault(prop) {
return (
it.opts.useDefaults &&
!it.compositeRule &&
schema[prop].default !== undefined
);
}
function applyPropertySchema(prop) {
cxt.subschema(
{
keyword: "properties",
schemaProp: prop,
dataProp: prop,
},
valid
);
}
},
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.