@frontierjs/web
Version:
Web modules for FrontierJS
1,383 lines (1,343 loc) • 43.5 kB
JavaScript
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __reExport = (target, module, copyDefault, desc) => {
if (module && typeof module === "object" || typeof module === "function") {
for (let key of __getOwnPropNames(module))
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
__defProp(target, key, { get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable });
}
return target;
};
var __toESM = (module, isNodeMode) => {
return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", !isNodeMode && module && module.__esModule ? { get: () => module.default, enumerable: true } : { value: module, enumerable: true })), module);
};
// ../../node_modules/lodash/_freeGlobal.js
var require_freeGlobal = __commonJS({
"../../node_modules/lodash/_freeGlobal.js"(exports2, module) {
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
module.exports = freeGlobal;
}
});
// ../../node_modules/lodash/_root.js
var require_root = __commonJS({
"../../node_modules/lodash/_root.js"(exports2, module) {
var freeGlobal = require_freeGlobal();
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
var root = freeGlobal || freeSelf || Function("return this")();
module.exports = root;
}
});
// ../../node_modules/lodash/_Symbol.js
var require_Symbol = __commonJS({
"../../node_modules/lodash/_Symbol.js"(exports2, module) {
var root = require_root();
var Symbol = root.Symbol;
module.exports = Symbol;
}
});
// ../../node_modules/lodash/_arrayMap.js
var require_arrayMap = __commonJS({
"../../node_modules/lodash/_arrayMap.js"(exports2, module) {
function arrayMap(array, iteratee) {
var index = -1, length = array == null ? 0 : array.length, result = Array(length);
while (++index < length) {
result[index] = iteratee(array[index], index, array);
}
return result;
}
module.exports = arrayMap;
}
});
// ../../node_modules/lodash/isArray.js
var require_isArray = __commonJS({
"../../node_modules/lodash/isArray.js"(exports2, module) {
var isArray = Array.isArray;
module.exports = isArray;
}
});
// ../../node_modules/lodash/_getRawTag.js
var require_getRawTag = __commonJS({
"../../node_modules/lodash/_getRawTag.js"(exports2, module) {
var Symbol = require_Symbol();
var objectProto = Object.prototype;
var hasOwnProperty = objectProto.hasOwnProperty;
var nativeObjectToString = objectProto.toString;
var symToStringTag = Symbol ? Symbol.toStringTag : void 0;
function getRawTag(value) {
var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
try {
value[symToStringTag] = void 0;
var unmasked = true;
} catch (e) {
}
var result = nativeObjectToString.call(value);
if (unmasked) {
if (isOwn) {
value[symToStringTag] = tag;
} else {
delete value[symToStringTag];
}
}
return result;
}
module.exports = getRawTag;
}
});
// ../../node_modules/lodash/_objectToString.js
var require_objectToString = __commonJS({
"../../node_modules/lodash/_objectToString.js"(exports2, module) {
var objectProto = Object.prototype;
var nativeObjectToString = objectProto.toString;
function objectToString(value) {
return nativeObjectToString.call(value);
}
module.exports = objectToString;
}
});
// ../../node_modules/lodash/_baseGetTag.js
var require_baseGetTag = __commonJS({
"../../node_modules/lodash/_baseGetTag.js"(exports2, module) {
var Symbol = require_Symbol();
var getRawTag = require_getRawTag();
var objectToString = require_objectToString();
var nullTag = "[object Null]";
var undefinedTag = "[object Undefined]";
var symToStringTag = Symbol ? Symbol.toStringTag : void 0;
function baseGetTag(value) {
if (value == null) {
return value === void 0 ? undefinedTag : nullTag;
}
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
}
module.exports = baseGetTag;
}
});
// ../../node_modules/lodash/isObjectLike.js
var require_isObjectLike = __commonJS({
"../../node_modules/lodash/isObjectLike.js"(exports2, module) {
function isObjectLike(value) {
return value != null && typeof value == "object";
}
module.exports = isObjectLike;
}
});
// ../../node_modules/lodash/isSymbol.js
var require_isSymbol = __commonJS({
"../../node_modules/lodash/isSymbol.js"(exports2, module) {
var baseGetTag = require_baseGetTag();
var isObjectLike = require_isObjectLike();
var symbolTag = "[object Symbol]";
function isSymbol(value) {
return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
}
module.exports = isSymbol;
}
});
// ../../node_modules/lodash/_baseToString.js
var require_baseToString = __commonJS({
"../../node_modules/lodash/_baseToString.js"(exports2, module) {
var Symbol = require_Symbol();
var arrayMap = require_arrayMap();
var isArray = require_isArray();
var isSymbol = require_isSymbol();
var INFINITY = 1 / 0;
var symbolProto = Symbol ? Symbol.prototype : void 0;
var symbolToString = symbolProto ? symbolProto.toString : void 0;
function baseToString(value) {
if (typeof value == "string") {
return value;
}
if (isArray(value)) {
return arrayMap(value, baseToString) + "";
}
if (isSymbol(value)) {
return symbolToString ? symbolToString.call(value) : "";
}
var result = value + "";
return result == "0" && 1 / value == -INFINITY ? "-0" : result;
}
module.exports = baseToString;
}
});
// ../../node_modules/lodash/toString.js
var require_toString = __commonJS({
"../../node_modules/lodash/toString.js"(exports2, module) {
var baseToString = require_baseToString();
function toString(value) {
return value == null ? "" : baseToString(value);
}
module.exports = toString;
}
});
// ../../node_modules/lodash/_baseSlice.js
var require_baseSlice = __commonJS({
"../../node_modules/lodash/_baseSlice.js"(exports2, module) {
function baseSlice(array, start, end) {
var index = -1, length = array.length;
if (start < 0) {
start = -start > length ? 0 : length + start;
}
end = end > length ? length : end;
if (end < 0) {
end += length;
}
length = start > end ? 0 : end - start >>> 0;
start >>>= 0;
var result = Array(length);
while (++index < length) {
result[index] = array[index + start];
}
return result;
}
module.exports = baseSlice;
}
});
// ../../node_modules/lodash/_castSlice.js
var require_castSlice = __commonJS({
"../../node_modules/lodash/_castSlice.js"(exports2, module) {
var baseSlice = require_baseSlice();
function castSlice(array, start, end) {
var length = array.length;
end = end === void 0 ? length : end;
return !start && end >= length ? array : baseSlice(array, start, end);
}
module.exports = castSlice;
}
});
// ../../node_modules/lodash/_hasUnicode.js
var require_hasUnicode = __commonJS({
"../../node_modules/lodash/_hasUnicode.js"(exports2, module) {
var rsAstralRange = "\\ud800-\\udfff";
var rsComboMarksRange = "\\u0300-\\u036f";
var reComboHalfMarksRange = "\\ufe20-\\ufe2f";
var rsComboSymbolsRange = "\\u20d0-\\u20ff";
var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
var rsVarRange = "\\ufe0e\\ufe0f";
var rsZWJ = "\\u200d";
var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]");
function hasUnicode(string) {
return reHasUnicode.test(string);
}
module.exports = hasUnicode;
}
});
// ../../node_modules/lodash/_asciiToArray.js
var require_asciiToArray = __commonJS({
"../../node_modules/lodash/_asciiToArray.js"(exports2, module) {
function asciiToArray(string) {
return string.split("");
}
module.exports = asciiToArray;
}
});
// ../../node_modules/lodash/_unicodeToArray.js
var require_unicodeToArray = __commonJS({
"../../node_modules/lodash/_unicodeToArray.js"(exports2, module) {
var rsAstralRange = "\\ud800-\\udfff";
var rsComboMarksRange = "\\u0300-\\u036f";
var reComboHalfMarksRange = "\\ufe20-\\ufe2f";
var rsComboSymbolsRange = "\\u20d0-\\u20ff";
var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
var rsVarRange = "\\ufe0e\\ufe0f";
var rsAstral = "[" + rsAstralRange + "]";
var rsCombo = "[" + rsComboRange + "]";
var rsFitz = "\\ud83c[\\udffb-\\udfff]";
var rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")";
var rsNonAstral = "[^" + rsAstralRange + "]";
var rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}";
var rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]";
var rsZWJ = "\\u200d";
var reOptMod = rsModifier + "?";
var rsOptVar = "[" + rsVarRange + "]?";
var rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*";
var rsSeq = rsOptVar + reOptMod + rsOptJoin;
var rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")";
var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
function unicodeToArray(string) {
return string.match(reUnicode) || [];
}
module.exports = unicodeToArray;
}
});
// ../../node_modules/lodash/_stringToArray.js
var require_stringToArray = __commonJS({
"../../node_modules/lodash/_stringToArray.js"(exports2, module) {
var asciiToArray = require_asciiToArray();
var hasUnicode = require_hasUnicode();
var unicodeToArray = require_unicodeToArray();
function stringToArray(string) {
return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string);
}
module.exports = stringToArray;
}
});
// ../../node_modules/lodash/_createCaseFirst.js
var require_createCaseFirst = __commonJS({
"../../node_modules/lodash/_createCaseFirst.js"(exports2, module) {
var castSlice = require_castSlice();
var hasUnicode = require_hasUnicode();
var stringToArray = require_stringToArray();
var toString = require_toString();
function createCaseFirst(methodName) {
return function(string) {
string = toString(string);
var strSymbols = hasUnicode(string) ? stringToArray(string) : void 0;
var chr = strSymbols ? strSymbols[0] : string.charAt(0);
var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1);
return chr[methodName]() + trailing;
};
}
module.exports = createCaseFirst;
}
});
// ../../node_modules/lodash/upperFirst.js
var require_upperFirst = __commonJS({
"../../node_modules/lodash/upperFirst.js"(exports2, module) {
var createCaseFirst = require_createCaseFirst();
var upperFirst2 = createCaseFirst("toUpperCase");
module.exports = upperFirst2;
}
});
// ../../node_modules/lodash/capitalize.js
var require_capitalize = __commonJS({
"../../node_modules/lodash/capitalize.js"(exports2, module) {
var toString = require_toString();
var upperFirst2 = require_upperFirst();
function capitalize2(string) {
return upperFirst2(toString(string).toLowerCase());
}
module.exports = capitalize2;
}
});
// ../../node_modules/lodash/_arrayReduce.js
var require_arrayReduce = __commonJS({
"../../node_modules/lodash/_arrayReduce.js"(exports2, module) {
function arrayReduce(array, iteratee, accumulator, initAccum) {
var index = -1, length = array == null ? 0 : array.length;
if (initAccum && length) {
accumulator = array[++index];
}
while (++index < length) {
accumulator = iteratee(accumulator, array[index], index, array);
}
return accumulator;
}
module.exports = arrayReduce;
}
});
// ../../node_modules/lodash/_basePropertyOf.js
var require_basePropertyOf = __commonJS({
"../../node_modules/lodash/_basePropertyOf.js"(exports2, module) {
function basePropertyOf(object) {
return function(key) {
return object == null ? void 0 : object[key];
};
}
module.exports = basePropertyOf;
}
});
// ../../node_modules/lodash/_deburrLetter.js
var require_deburrLetter = __commonJS({
"../../node_modules/lodash/_deburrLetter.js"(exports2, module) {
var basePropertyOf = require_basePropertyOf();
var deburredLetters = {
"\xC0": "A",
"\xC1": "A",
"\xC2": "A",
"\xC3": "A",
"\xC4": "A",
"\xC5": "A",
"\xE0": "a",
"\xE1": "a",
"\xE2": "a",
"\xE3": "a",
"\xE4": "a",
"\xE5": "a",
"\xC7": "C",
"\xE7": "c",
"\xD0": "D",
"\xF0": "d",
"\xC8": "E",
"\xC9": "E",
"\xCA": "E",
"\xCB": "E",
"\xE8": "e",
"\xE9": "e",
"\xEA": "e",
"\xEB": "e",
"\xCC": "I",
"\xCD": "I",
"\xCE": "I",
"\xCF": "I",
"\xEC": "i",
"\xED": "i",
"\xEE": "i",
"\xEF": "i",
"\xD1": "N",
"\xF1": "n",
"\xD2": "O",
"\xD3": "O",
"\xD4": "O",
"\xD5": "O",
"\xD6": "O",
"\xD8": "O",
"\xF2": "o",
"\xF3": "o",
"\xF4": "o",
"\xF5": "o",
"\xF6": "o",
"\xF8": "o",
"\xD9": "U",
"\xDA": "U",
"\xDB": "U",
"\xDC": "U",
"\xF9": "u",
"\xFA": "u",
"\xFB": "u",
"\xFC": "u",
"\xDD": "Y",
"\xFD": "y",
"\xFF": "y",
"\xC6": "Ae",
"\xE6": "ae",
"\xDE": "Th",
"\xFE": "th",
"\xDF": "ss",
"\u0100": "A",
"\u0102": "A",
"\u0104": "A",
"\u0101": "a",
"\u0103": "a",
"\u0105": "a",
"\u0106": "C",
"\u0108": "C",
"\u010A": "C",
"\u010C": "C",
"\u0107": "c",
"\u0109": "c",
"\u010B": "c",
"\u010D": "c",
"\u010E": "D",
"\u0110": "D",
"\u010F": "d",
"\u0111": "d",
"\u0112": "E",
"\u0114": "E",
"\u0116": "E",
"\u0118": "E",
"\u011A": "E",
"\u0113": "e",
"\u0115": "e",
"\u0117": "e",
"\u0119": "e",
"\u011B": "e",
"\u011C": "G",
"\u011E": "G",
"\u0120": "G",
"\u0122": "G",
"\u011D": "g",
"\u011F": "g",
"\u0121": "g",
"\u0123": "g",
"\u0124": "H",
"\u0126": "H",
"\u0125": "h",
"\u0127": "h",
"\u0128": "I",
"\u012A": "I",
"\u012C": "I",
"\u012E": "I",
"\u0130": "I",
"\u0129": "i",
"\u012B": "i",
"\u012D": "i",
"\u012F": "i",
"\u0131": "i",
"\u0134": "J",
"\u0135": "j",
"\u0136": "K",
"\u0137": "k",
"\u0138": "k",
"\u0139": "L",
"\u013B": "L",
"\u013D": "L",
"\u013F": "L",
"\u0141": "L",
"\u013A": "l",
"\u013C": "l",
"\u013E": "l",
"\u0140": "l",
"\u0142": "l",
"\u0143": "N",
"\u0145": "N",
"\u0147": "N",
"\u014A": "N",
"\u0144": "n",
"\u0146": "n",
"\u0148": "n",
"\u014B": "n",
"\u014C": "O",
"\u014E": "O",
"\u0150": "O",
"\u014D": "o",
"\u014F": "o",
"\u0151": "o",
"\u0154": "R",
"\u0156": "R",
"\u0158": "R",
"\u0155": "r",
"\u0157": "r",
"\u0159": "r",
"\u015A": "S",
"\u015C": "S",
"\u015E": "S",
"\u0160": "S",
"\u015B": "s",
"\u015D": "s",
"\u015F": "s",
"\u0161": "s",
"\u0162": "T",
"\u0164": "T",
"\u0166": "T",
"\u0163": "t",
"\u0165": "t",
"\u0167": "t",
"\u0168": "U",
"\u016A": "U",
"\u016C": "U",
"\u016E": "U",
"\u0170": "U",
"\u0172": "U",
"\u0169": "u",
"\u016B": "u",
"\u016D": "u",
"\u016F": "u",
"\u0171": "u",
"\u0173": "u",
"\u0174": "W",
"\u0175": "w",
"\u0176": "Y",
"\u0177": "y",
"\u0178": "Y",
"\u0179": "Z",
"\u017B": "Z",
"\u017D": "Z",
"\u017A": "z",
"\u017C": "z",
"\u017E": "z",
"\u0132": "IJ",
"\u0133": "ij",
"\u0152": "Oe",
"\u0153": "oe",
"\u0149": "'n",
"\u017F": "s"
};
var deburrLetter = basePropertyOf(deburredLetters);
module.exports = deburrLetter;
}
});
// ../../node_modules/lodash/deburr.js
var require_deburr = __commonJS({
"../../node_modules/lodash/deburr.js"(exports2, module) {
var deburrLetter = require_deburrLetter();
var toString = require_toString();
var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
var rsComboMarksRange = "\\u0300-\\u036f";
var reComboHalfMarksRange = "\\ufe20-\\ufe2f";
var rsComboSymbolsRange = "\\u20d0-\\u20ff";
var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
var rsCombo = "[" + rsComboRange + "]";
var reComboMark = RegExp(rsCombo, "g");
function deburr(string) {
string = toString(string);
return string && string.replace(reLatin, deburrLetter).replace(reComboMark, "");
}
module.exports = deburr;
}
});
// ../../node_modules/lodash/_asciiWords.js
var require_asciiWords = __commonJS({
"../../node_modules/lodash/_asciiWords.js"(exports2, module) {
var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
function asciiWords(string) {
return string.match(reAsciiWord) || [];
}
module.exports = asciiWords;
}
});
// ../../node_modules/lodash/_hasUnicodeWord.js
var require_hasUnicodeWord = __commonJS({
"../../node_modules/lodash/_hasUnicodeWord.js"(exports2, module) {
var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
function hasUnicodeWord(string) {
return reHasUnicodeWord.test(string);
}
module.exports = hasUnicodeWord;
}
});
// ../../node_modules/lodash/_unicodeWords.js
var require_unicodeWords = __commonJS({
"../../node_modules/lodash/_unicodeWords.js"(exports2, module) {
var rsAstralRange = "\\ud800-\\udfff";
var rsComboMarksRange = "\\u0300-\\u036f";
var reComboHalfMarksRange = "\\ufe20-\\ufe2f";
var rsComboSymbolsRange = "\\u20d0-\\u20ff";
var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
var rsDingbatRange = "\\u2700-\\u27bf";
var rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff";
var rsMathOpRange = "\\xac\\xb1\\xd7\\xf7";
var rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf";
var rsPunctuationRange = "\\u2000-\\u206f";
var rsSpaceRange = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000";
var rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde";
var rsVarRange = "\\ufe0e\\ufe0f";
var rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
var rsApos = "['\u2019]";
var rsBreak = "[" + rsBreakRange + "]";
var rsCombo = "[" + rsComboRange + "]";
var rsDigits = "\\d+";
var rsDingbat = "[" + rsDingbatRange + "]";
var rsLower = "[" + rsLowerRange + "]";
var rsMisc = "[^" + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]";
var rsFitz = "\\ud83c[\\udffb-\\udfff]";
var rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")";
var rsNonAstral = "[^" + rsAstralRange + "]";
var rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}";
var rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]";
var rsUpper = "[" + rsUpperRange + "]";
var rsZWJ = "\\u200d";
var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")";
var rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")";
var rsOptContrLower = "(?:" + rsApos + "(?:d|ll|m|re|s|t|ve))?";
var rsOptContrUpper = "(?:" + rsApos + "(?:D|LL|M|RE|S|T|VE))?";
var reOptMod = rsModifier + "?";
var rsOptVar = "[" + rsVarRange + "]?";
var rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*";
var rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])";
var rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])";
var rsSeq = rsOptVar + reOptMod + rsOptJoin;
var rsEmoji = "(?:" + [rsDingbat, rsRegional, rsSurrPair].join("|") + ")" + rsSeq;
var reUnicodeWord = RegExp([
rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
rsUpper + "+" + rsOptContrUpper,
rsOrdUpper,
rsOrdLower,
rsDigits,
rsEmoji
].join("|"), "g");
function unicodeWords(string) {
return string.match(reUnicodeWord) || [];
}
module.exports = unicodeWords;
}
});
// ../../node_modules/lodash/words.js
var require_words = __commonJS({
"../../node_modules/lodash/words.js"(exports2, module) {
var asciiWords = require_asciiWords();
var hasUnicodeWord = require_hasUnicodeWord();
var toString = require_toString();
var unicodeWords = require_unicodeWords();
function words(string, pattern, guard) {
string = toString(string);
pattern = guard ? void 0 : pattern;
if (pattern === void 0) {
return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
}
return string.match(pattern) || [];
}
module.exports = words;
}
});
// ../../node_modules/lodash/_createCompounder.js
var require_createCompounder = __commonJS({
"../../node_modules/lodash/_createCompounder.js"(exports2, module) {
var arrayReduce = require_arrayReduce();
var deburr = require_deburr();
var words = require_words();
var rsApos = "['\u2019]";
var reApos = RegExp(rsApos, "g");
function createCompounder(callback) {
return function(string) {
return arrayReduce(words(deburr(string).replace(reApos, "")), callback, "");
};
}
module.exports = createCompounder;
}
});
// ../../node_modules/lodash/camelCase.js
var require_camelCase = __commonJS({
"../../node_modules/lodash/camelCase.js"(exports2, module) {
var capitalize2 = require_capitalize();
var createCompounder = require_createCompounder();
var camelCase2 = createCompounder(function(result, word, index) {
word = word.toLowerCase();
return result + (index ? capitalize2(word) : word);
});
module.exports = camelCase2;
}
});
// ../../node_modules/lodash/kebabCase.js
var require_kebabCase = __commonJS({
"../../node_modules/lodash/kebabCase.js"(exports2, module) {
var createCompounder = require_createCompounder();
var kebabCase2 = createCompounder(function(result, word, index) {
return result + (index ? "-" : "") + word.toLowerCase();
});
module.exports = kebabCase2;
}
});
// node_modules/@frontierjs/datetime-kit/src/core.js
var formatMap = {
YYYY: {
unit: "year",
style: "numeric",
ms: 315576e5
},
YY: {
unit: "year",
style: "2-digit"
},
QQQQ: {
unit: "quarter",
style: "long"
},
QQQ: {
unit: "quarter",
style: "short"
},
QQ: {
unit: "quarter",
style: "2-digit"
},
Q: {
unit: "quarter",
style: "numeric"
},
MMMM: {
unit: "month",
style: "long"
},
MMM: {
unit: "month",
style: "short"
},
MM: {
unit: "month",
style: "2-digit"
},
M: {
unit: "month",
style: "numeric",
ms: 315576e5 / 12
},
WWWW: {
unit: "week",
style: "month-long"
},
WWW: {
unit: "week",
style: "month-short"
},
WW: {
unit: "week",
style: "2-digit"
},
W: {
unit: "week",
style: "numeric",
ms: 7 * 24 * 3600 * 1e3
},
DDDD: {
unit: "weekday",
style: "long"
},
DDD: {
unit: "weekday",
style: "short"
},
DD: {
unit: "day",
style: "2-digit"
},
D: {
unit: "day",
style: "numeric",
ms: 24 * 3600 * 1e3
},
hh: {
unit: "hour",
style: "2-digit"
},
h: {
unit: "hour",
style: "numeric",
ms: 3600 * 1e3
},
mm: {
unit: "minute",
style: "2-digit"
},
m: {
unit: "minute",
style: "numeric",
ms: 60 * 1e3
},
ss: {
unit: "second",
style: "2-digit"
},
s: {
unit: "second",
style: "numeric",
ms: 1e3
},
aaa: {
unit: "dayPeriod",
style: "long"
},
aa: {
unit: "dayPeriod",
style: "short"
},
a: {
unit: "dayPeriod",
style: "narrow"
},
ttt: {
unit: "timeZoneName",
style: "long"
},
tt: {
unit: "timeZoneName",
style: "short"
},
t: {
unit: "timeZoneName",
style: "short"
}
};
var dayPeriodMap = {
shortAM: "AM",
shortPM: "PM",
narrowAM: "A",
narrowPM: "P"
};
function isValidDate(date) {
return date && Object.prototype.toString.call(date) === "[object Date]" && !isNaN(date);
}
function ordinal(n) {
const s = ["th", "st", "nd", "rd"];
const v = n % 100;
return n + (s[(v - 20) % 10] || s[v] || s[0]);
}
function pad(n) {
return n < 10 ? "0" + n : String(n);
}
function getWeekOfMonth(date) {
const d = new Date(date);
const day = d.getDate();
const startOfMonth = new Date(d.getFullYear(), d.getMonth(), 1);
const startDay = startOfMonth.getDay() || 7;
return Math.ceil((day + startDay - 1) / 7);
}
var getISOWeek = (date) => {
const temp = new Date(date.getTime());
temp.setHours(0, 0, 0, 0);
temp.setDate(temp.getDate() + 3 - (temp.getDay() + 6) % 7);
const week1 = new Date(temp.getFullYear(), 0, 4);
return 1 + Math.round(((temp - week1) / 864e5 - 3 + (week1.getDay() + 6) % 7) / 7);
};
function getWeek(date, style = "narrow") {
switch (style) {
case "numeric":
return String(getISOWeek(date));
case "2-digit":
return pad(getISOWeek(date));
case "month-short":
return `W${getWeekOfMonth(date)}`;
case "month-long":
return `${ordinal(getWeekOfMonth(date))} week`;
default:
return String(getISOWeek(date));
}
}
function getQuarter(date, style = "numeric") {
const q = Math.floor(date.getMonth() / 3) + 1;
switch (style) {
case "long":
return `${ordinal(q)} quarter`;
case "short":
return `Q${q}`;
case "2-digit":
return pad(q);
case "numeric":
default:
return String(q);
}
}
// node_modules/@frontierjs/datetime-kit/src/relative.js
function relative(val, format2 = "", options = { style: "short", precision: 2 }) {
const isFutureTime = val > 0;
if (typeof format2 === "object") {
options = format2;
format2 = null;
}
options.keys = [];
if (format2) {
const regex = Object.keys(formatMap).map((key, i) => i ? "|" + key : key).join("");
format2 = format2.replace(new RegExp(regex, "g"), (token) => {
const { unit, style } = formatMap[token];
options[unit] = style === "numeric" ? "narrow" : style === "2-digit" ? "short" : style;
return "${" + unit + "}";
});
format2 = isFutureTime ? "in about " + format2 : "about " + format2 + " ago";
}
const msPerUnitOfTime = Object.entries(formatMap).flatMap(([tokenKey, { ms, unit }]) => ms ? [{ unit, ms }] : []);
const values = msPerUnitOfTime.reduce((acc, timeObj) => {
if (format2) {
if (!Object.keys(options).includes(timeObj.unit))
return acc;
}
const relativeMs = options.keys.reduce((newVal, { ms }) => newVal % ms, val);
options.keys.push(timeObj);
const relativeTime = new Intl.RelativeTimeFormat("en", { style: options[timeObj.unit] || options.style || "short" }).format(Math.floor(Math.abs(relativeMs) / timeObj.ms), timeObj.unit);
const hasNarrowStyling = options[timeObj.unit] ? options[timeObj.unit] === "narrow" : options.style === "narrow";
let [_, value, timeUnitText] = relativeTime.split(" ");
if (timeUnitText) {
timeUnitText = hasNarrowStyling ? timeUnitText[0] : " " + timeUnitText;
}
acc[timeObj.unit] = value + (timeUnitText || "");
return acc;
}, {});
if (format2) {
return format2.replace(/\${\s*(\w+?)\s*}/g, (_, segment) => values[segment]);
} else {
let count = options.precision || 2;
const res = Object.values(values).reduce((acc, unit) => {
if (count && unit[0] !== "0") {
acc += unit + " ";
count--;
}
return acc;
}, "").trim();
return res;
}
}
function relativeTo(date, dateTo, format2, options) {
return relative(date - dateTo, format2, options);
}
// node_modules/@frontierjs/datetime-kit/src/format.js
function format(date, format2, options = { hour12: true }) {
date = typeof date === "string" ? new Date(date) : date;
if (!isValidDate(date)) {
throw new Error("::: Received date value does not make a valid date.");
}
if (typeof format2 === "object") {
options = format2;
format2 = null;
}
options.timeZone ||= date.timeZone;
if (!format2 && options) {
return new Intl.DateTimeFormat("en", options).format(date);
}
const literals = [];
const LITERAL_PREFIX = "__LIT__";
const formatWithPlaceholders = format2.replace(/\[([^\]]+)\]/g, (_, literal) => {
const placeholder = `${LITERAL_PREFIX}${literals.length}__`;
literals.push(literal);
return placeholder;
});
const regex = Object.keys(formatMap).join("|");
let tokenizedFormat = formatWithPlaceholders.replace(new RegExp(regex, "g"), (key) => {
const { unit, style } = formatMap[key];
options[unit] = style;
return `\${${unit}}`;
});
const values = new Intl.DateTimeFormat("en", options).formatToParts(date).reduce((acc, { type, value }) => {
acc[type] = value;
return acc;
}, {});
if (options.dayPeriod && options.dayPeriod !== "long" && values.hour) {
const tzHour = _getHourInZone(date, options.timeZone);
const style = options.dayPeriod + (tzHour >= 12 ? "PM" : "AM");
values.dayPeriod = dayPeriodMap[style];
}
values.week = getWeek(date, options.week);
values.quarter = getQuarter(date, options.quarter);
let result = tokenizedFormat.replace(/\${\s*(\w+?)\s*}/g, (_, segment) => {
return values[segment] || "";
});
literals.forEach((text, index) => {
result = result.replace(`${LITERAL_PREFIX}${index}__`, text);
});
return result;
}
function _getHourInZone(date, timeZone) {
return Number(new Intl.DateTimeFormat("en", { hour: "2-digit", hour12: false, timeZone }).formatToParts(date).find((p) => p.type === "hour")?.value);
}
// node_modules/@frontierjs/datetime-kit/src/getDateAndTime.js
function getDateAndTime(datetime, { utc = false, seconds = false } = {}) {
if (utc) {
const [datetimestring, msZ] = datetime.toJSON().split(".");
const [date, time2] = datetimestring.split("T");
return { date, time: seconds ? time2 : time2.substring(0, 5) };
}
const time = datetime.toLocaleTimeString("en", { hourCycle: "h23" });
return {
date: datetime.toLocaleDateString("en-GB").split("/").reverse().join("-"),
time: seconds ? time : time.substring(0, 5)
};
}
// src/preload.js
var import_capitalize = __toESM(require_capitalize());
var import_camelCase = __toESM(require_camelCase());
var import_kebabCase = __toESM(require_kebabCase());
var import_upperFirst = __toESM(require_upperFirst());
// src/errors.js
function Errors(spec = {}) {
const { errorsUrl } = spec;
return () => {
window.addEventListener("unhandledrejection", async function handleUnhandled(event) {
if (!errorsUrl)
return console.error(event.reason);
await fetch(errorsUrl, {
method: "POST",
body: JSON.stringify({ error: String(event.reason) }),
mode: "no-cors",
headers: {
"Content-Type": "application/json"
}
});
});
};
}
// src/preload.js
function snakeCase(str) {
return str.replace(/([a-z])([A-Z])/g, "$1_$2").replace(/[\s\-]+/g, "_").replace(/[^\w_]/g, "").toLowerCase();
}
function Preload(spec = {}) {
return () => {
const {
errorsUrl = "",
primitives = {
date: true,
string: true,
array: true,
object: true,
function: true,
json: true,
number: true
}
} = spec;
if (primitives.number) {
Number.prototype.round = function(precision) {
const m = Math.pow(10, precision) || 1;
return Math.round(this * m) / m;
};
Number.prototype.toCurrency = function toCurrency(currency = "USD") {
return Intl.NumberFormat("en-US", { style: "currency", currency }).format(this);
};
Number.prototype.prefix = function(text) {
return text + (this ?? "");
};
Number.prototype.postfix = function(text) {
return this + text;
};
Number.is = function is(number, number2) {
return number === number2;
};
Object.defineProperty(Number.prototype, "is", {
value: function(number) {
return Number.is(this, number);
}
});
}
if (primitives.date) {
Date.format = function(date, formatString, options) {
return format(date, formatString, options);
};
Date.relativeTo = function(date, dateTo, formatString, options) {
return relativeTo(date, dateTo, formatString, options);
};
Date.relativeToNow = function(date, formatString, options) {
return relativeTo(date, new Date(), formatString, options);
};
Date.prototype.format = function(formatString, options) {
return format(this, formatString, options);
};
Date.prototype.relativeTo = function(dateTo, formatString, options) {
return relativeTo(this, dateTo, formatString, options);
};
Date.prototype.relativeToNow = function(formatString, options) {
return relativeTo(this, new Date(), formatString, options);
};
Date.prototype.getDateAndTime = function(options) {
return getDateAndTime(this, options);
};
Object.defineProperty(Date.prototype, "timeZone", {
configurable: true,
get() {
return Date.timeZone;
}
});
}
if (primitives.string) {
String.is = function is(string, string2) {
return string === string2 ? string : "";
};
Object.defineProperty(String, "isDate", {
value: function(s) {
if (!/^\d{4}-\d{2}-\d{2}$/.test(s))
return false;
const date = new Date(s);
return date instanceof Date && !isNaN(date) && date.toISOString().startsWith(s);
},
writable: false,
enumerable: false,
configurable: false
});
Object.defineProperty(String.prototype, "is", {
value: function(string) {
return String.is(this, string);
}
});
String.prototype.dateFormat = function(formatString, options) {
return format(this, formatString, options);
};
String.prototype.capitalize = function() {
return (0, import_capitalize.default)(this);
};
String.prototype.snakeCase = function() {
return snakeCase(this);
};
String.prototype.camelCase = function() {
return (0, import_camelCase.default)(this);
};
String.prototype.pascalCase = function() {
return (0, import_upperFirst.default)((0, import_camelCase.default)(this));
};
String.prototype.kebabCase = function() {
return (0, import_kebabCase.default)(this);
};
String.prototype.humanCase = function() {
return this.replace(/([A-Z])/g, " $1").replace(/[_-]/g, " ").replace(/\s+/g, " ").trim().split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" ");
};
Object.defineProperty(String.prototype, "hash", {
value: function() {
return this.split("").reduce((hash, letter) => letter.charCodeAt(0) + ((hash << 5) - hash), 0);
}
});
Object.defineProperty(String.prototype, "initials", {
value: function() {
return this.split(" ").map((text) => text[0]).join("");
}
});
String.isMediaPath = function(string, { type = "image" } = {}) {
const map = {
image: /\.(?<type>png|svg|jpg|jpeg)$/i
};
return string.match(map[type]);
};
String.base64GetType = function(base64String) {
const regex = /^data:image\/([a-zA-Z0-9+_.-]+);base64,/;
const match = base64String.match(regex);
if (match) {
return match[1];
} else {
throw new Error("Invalid base64 image string");
}
};
}
if (primitives.array) {
Array.remove = function remove(items, instance) {
const instanceId = typeof instance === "object" ? instance.id : instance;
return items.filter((item) => item.id !== instanceId);
};
Array.filter = function filter(items, predicateFunction) {
return items.filter(predicateFunction);
};
Array.reset = function reset(items, instance) {
const index = items.findIndex((item) => item.id === instance.id);
items[index] = items[index];
return items;
};
Array.upsert = function upsert(items, instance, options = { position: "end" }) {
const index = items.findIndex((item) => item.id === instance.id);
if (index === -1) {
if (typeof options.position === "number") {
items.splice(options.position, 0, instance);
}
if (options.position === "start") {
items.unshift(instance);
}
if (options.position === "end") {
items.push(instance);
}
return items;
}
items[index] = instance;
return items;
};
Array.find = function find(items, instance) {
return items.find((item) => item === instance);
};
Array.last = function last(items, i = 1) {
return items[items.length - i];
};
Array.sort = function sort(items, sortBy) {
return items.sort(sortBy);
};
Array.groupBy = function(array, mapFunction) {
return array.reduce((r, v, i, a, k = mapFunction(v)) => ((r[k] || (r[k] = [])).push(v), r), {});
};
Array.objectify = function(array, keyFunction) {
return array.reduce((acc, item) => {
acc[keyFunction(item)] = item;
return acc;
}, {});
};
Object.defineProperty(Array.prototype, "groupBy", {
value: function(mapFunction) {
return Array.groupBy(this, mapFunction);
}
});
}
if (primitives.object) {
Object.isEmpty = function isEmpty(obj) {
return Object.keys(obj).length === 0;
};
Object.grab = function(field, obj) {
return field.split(".").reduce((acc, i) => {
if (typeof acc === "undefined")
return void 0;
if (acc === null)
return null;
if (acc[i] === void 0)
return void 0;
return acc[i];
}, obj);
};
Object.put = function(field, obj, value, cb) {
return field.split(".").reduce((acc, key, index, arr) => {
if (index === arr.length - 1) {
acc[key] = cb ? cb(value) : value;
}
if (typeof acc === "undefined")
return void 0;
if (acc === null)
return null;
if (acc[key] === void 0)
return void 0;
return acc[key];
}, obj);
};
Object.delete = function(field, obj) {
return field.split(".").reduce((acc, key, index, arr) => {
if (index === arr.length - 1) {
delete acc[key];
}
if (typeof acc === "undefined")
return void 0;
if (acc === null)
return null;
if (acc[key] === void 0)
return void 0;
return acc[key];
}, obj);
};
Object.map = function(object, transformer) {
return Object.fromEntries(Object.entries(object).map(([key, value]) => [key, transformer(value, key)]));
};
}
if (primitives.function) {
URL.prototype.fetch = async function(type = "json") {
return await fetch(this).then((res) => res[type]());
};
URL.exists = async function urlExists(url) {
try {
const response = await fetch(url, { method: "HEAD" });
return response.ok;
} catch (err) {
return false;
}
};
Function.prototype.printToString = function() {
return this.toString().replaceAll(/[\n\t]/g, "").replaceAll(/\s{2,}/g, " ");
};
Function.prototype.toJSON = function() {
const string = this.toString().replaceAll(/[\n\t]/g, "").replaceAll(/\s{2,}/g, " ");
return btoa(string);
};
Function.noop = function noop() {
};
Promise.sleep = function sleep(seconds = 1) {
return new Promise((resolve) => setTimeout(resolve, seconds * 1e3));
};
Promise.debounce = function debounce(fn, delay, { leading = true } = {}) {
let timeoutId;
let shouldWait = false;
return (...args) => {
return new Promise((resolve) => {
const callFn = async () => {
const result = await fn(...args);
resolve(result);
};
if (leading && !shouldWait) {
shouldWait = true;
callFn();
timeoutId = setTimeout(() => {
shouldWait = false;
}, delay);
} else {
clearTimeout(timeoutId);
timeoutId = setTimeout(() => {
callFn();
shouldWait = false;
}, delay);
}
});
};
};
}
if (primitives.json) {
JSON.debug = function(data) {
return `
<pre class="mb-8 overflow-y-auto">${JSON.stringify(data, null, 4)}</pre>
`;
};
JSON.try = function tryParseJSON(jsonString) {
try {
const value = JSON.parse(jsonString);
if (typeof value === "boolean") {
return value;
}
if (value && typeof value === "object") {
return value;
}
} catch (e) {
}
return void 0;
};
}
if (errorsUrl) {
const errors = Errors({
errorsUrl
});
errors();
}
};
}
export {
Preload
};