UNPKG

@playbooks/ui

Version:

An interface library for Playbooks.

540 lines (539 loc) 17 kB
function getAugmentedNamespace(n) { if (Object.prototype.hasOwnProperty.call(n, "__esModule")) return n; var f = n.default; if (typeof f == "function") { var a = function a2() { var isInstance = false; try { isInstance = this instanceof a2; } catch { } if (isInstance) { return Reflect.construct(f, arguments, this.constructor); } return f.apply(this, arguments); }; a.prototype = f.prototype; } else a = {}; Object.defineProperty(a, "__esModule", { value: true }); Object.keys(n).forEach(function(k) { var d = Object.getOwnPropertyDescriptor(n, k); Object.defineProperty(a, k, d.get ? d : { enumerable: true, get: function() { return n[k]; } }); }); return a; } var bytes = { exports: {} }; /*! * bytes * Copyright(c) 2012-2014 TJ Holowaychuk * Copyright(c) 2015 Jed Watson * MIT Licensed */ var hasRequiredBytes; function requireBytes() { if (hasRequiredBytes) return bytes.exports; hasRequiredBytes = 1; bytes.exports = bytes$1; bytes.exports.format = format; bytes.exports.parse = parse; var formatThousandsRegExp = /\B(?=(\d{3})+(?!\d))/g; var formatDecimalsRegExp = /(?:\.0*|(\.[^0]+)0+)$/; var map = { b: 1, kb: 1 << 10, mb: 1 << 20, gb: 1 << 30, tb: Math.pow(1024, 4), pb: Math.pow(1024, 5) }; var parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i; function bytes$1(value, options) { if (typeof value === "string") { return parse(value); } if (typeof value === "number") { return format(value, options); } return null; } function format(value, options) { if (!Number.isFinite(value)) { return null; } var mag = Math.abs(value); var thousandsSeparator = options && options.thousandsSeparator || ""; var unitSeparator = options && options.unitSeparator || ""; var decimalPlaces = options && options.decimalPlaces !== void 0 ? options.decimalPlaces : 2; var fixedDecimals = Boolean(options && options.fixedDecimals); var unit = options && options.unit || ""; if (!unit || !map[unit.toLowerCase()]) { if (mag >= map.pb) { unit = "PB"; } else if (mag >= map.tb) { unit = "TB"; } else if (mag >= map.gb) { unit = "GB"; } else if (mag >= map.mb) { unit = "MB"; } else if (mag >= map.kb) { unit = "KB"; } else { unit = "B"; } } var val = value / map[unit.toLowerCase()]; var str = val.toFixed(decimalPlaces); if (!fixedDecimals) { str = str.replace(formatDecimalsRegExp, "$1"); } if (thousandsSeparator) { str = str.split(".").map(function(s, i) { return i === 0 ? s.replace(formatThousandsRegExp, thousandsSeparator) : s; }).join("."); } return str + unitSeparator + unit; } function parse(val) { if (typeof val === "number" && !isNaN(val)) { return val; } if (typeof val !== "string") { return null; } var results = parseRegExp.exec(val); var floatValue; var unit = "b"; if (!results) { floatValue = parseInt(val, 10); unit = "b"; } else { floatValue = parseFloat(results[1]); unit = results[4].toLowerCase(); } if (isNaN(floatValue)) { return null; } return Math.floor(map[unit] * floatValue); } return bytes.exports; } requireBytes(); function commonjsRequire(path) { throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); } var pluralize$1 = { exports: {} }; var pluralize = pluralize$1.exports; var hasRequiredPluralize; function requirePluralize() { if (hasRequiredPluralize) return pluralize$1.exports; hasRequiredPluralize = 1; (function(module, exports) { (function(root, pluralize2) { if (typeof commonjsRequire === "function" && true && true) { module.exports = pluralize2(); } else { root.pluralize = pluralize2(); } })(pluralize, function() { var pluralRules = []; var singularRules = []; var uncountables = {}; var irregularPlurals = {}; var irregularSingles = {}; function sanitizeRule(rule) { if (typeof rule === "string") { return new RegExp("^" + rule + "$", "i"); } return rule; } function restoreCase(word, token) { if (word === token) return token; if (word === word.toLowerCase()) return token.toLowerCase(); if (word === word.toUpperCase()) return token.toUpperCase(); if (word[0] === word[0].toUpperCase()) { return token.charAt(0).toUpperCase() + token.substr(1).toLowerCase(); } return token.toLowerCase(); } function interpolate(str, args) { return str.replace(/\$(\d{1,2})/g, function(match, index) { return args[index] || ""; }); } function replace(word, rule) { return word.replace(rule[0], function(match, index) { var result = interpolate(rule[1], arguments); if (match === "") { return restoreCase(word[index - 1], result); } return restoreCase(match, result); }); } function sanitizeWord(token, word, rules) { if (!token.length || uncountables.hasOwnProperty(token)) { return word; } var len = rules.length; while (len--) { var rule = rules[len]; if (rule[0].test(word)) return replace(word, rule); } return word; } function replaceWord(replaceMap, keepMap, rules) { return function(word) { var token = word.toLowerCase(); if (keepMap.hasOwnProperty(token)) { return restoreCase(word, token); } if (replaceMap.hasOwnProperty(token)) { return restoreCase(word, replaceMap[token]); } return sanitizeWord(token, word, rules); }; } function checkWord(replaceMap, keepMap, rules, bool) { return function(word) { var token = word.toLowerCase(); if (keepMap.hasOwnProperty(token)) return true; if (replaceMap.hasOwnProperty(token)) return false; return sanitizeWord(token, token, rules) === token; }; } function pluralize2(word, count, inclusive) { var pluralized = count === 1 ? pluralize2.singular(word) : pluralize2.plural(word); return (inclusive ? count + " " : "") + pluralized; } pluralize2.plural = replaceWord( irregularSingles, irregularPlurals, pluralRules ); pluralize2.isPlural = checkWord( irregularSingles, irregularPlurals, pluralRules ); pluralize2.singular = replaceWord( irregularPlurals, irregularSingles, singularRules ); pluralize2.isSingular = checkWord( irregularPlurals, irregularSingles, singularRules ); pluralize2.addPluralRule = function(rule, replacement) { pluralRules.push([sanitizeRule(rule), replacement]); }; pluralize2.addSingularRule = function(rule, replacement) { singularRules.push([sanitizeRule(rule), replacement]); }; pluralize2.addUncountableRule = function(word) { if (typeof word === "string") { uncountables[word.toLowerCase()] = true; return; } pluralize2.addPluralRule(word, "$0"); pluralize2.addSingularRule(word, "$0"); }; pluralize2.addIrregularRule = function(single, plural) { plural = plural.toLowerCase(); single = single.toLowerCase(); irregularSingles[single] = plural; irregularPlurals[plural] = single; }; [ // Pronouns. ["I", "we"], ["me", "us"], ["he", "they"], ["she", "they"], ["them", "them"], ["myself", "ourselves"], ["yourself", "yourselves"], ["itself", "themselves"], ["herself", "themselves"], ["himself", "themselves"], ["themself", "themselves"], ["is", "are"], ["was", "were"], ["has", "have"], ["this", "these"], ["that", "those"], // Words ending in with a consonant and `o`. ["echo", "echoes"], ["dingo", "dingoes"], ["volcano", "volcanoes"], ["tornado", "tornadoes"], ["torpedo", "torpedoes"], // Ends with `us`. ["genus", "genera"], ["viscus", "viscera"], // Ends with `ma`. ["stigma", "stigmata"], ["stoma", "stomata"], ["dogma", "dogmata"], ["lemma", "lemmata"], ["schema", "schemata"], ["anathema", "anathemata"], // Other irregular rules. ["ox", "oxen"], ["axe", "axes"], ["die", "dice"], ["yes", "yeses"], ["foot", "feet"], ["eave", "eaves"], ["goose", "geese"], ["tooth", "teeth"], ["quiz", "quizzes"], ["human", "humans"], ["proof", "proofs"], ["carve", "carves"], ["valve", "valves"], ["looey", "looies"], ["thief", "thieves"], ["groove", "grooves"], ["pickaxe", "pickaxes"], ["passerby", "passersby"] ].forEach(function(rule) { return pluralize2.addIrregularRule(rule[0], rule[1]); }); [ [/s?$/i, "s"], [/[^\u0000-\u007F]$/i, "$0"], [/([^aeiou]ese)$/i, "$1"], [/(ax|test)is$/i, "$1es"], [/(alias|[^aou]us|t[lm]as|gas|ris)$/i, "$1es"], [/(e[mn]u)s?$/i, "$1s"], [/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i, "$1"], [/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, "$1i"], [/(alumn|alg|vertebr)(?:a|ae)$/i, "$1ae"], [/(seraph|cherub)(?:im)?$/i, "$1im"], [/(her|at|gr)o$/i, "$1oes"], [/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i, "$1a"], [/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i, "$1a"], [/sis$/i, "ses"], [/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i, "$1$2ves"], [/([^aeiouy]|qu)y$/i, "$1ies"], [/([^ch][ieo][ln])ey$/i, "$1ies"], [/(x|ch|ss|sh|zz)$/i, "$1es"], [/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i, "$1ices"], [/\b((?:tit)?m|l)(?:ice|ouse)$/i, "$1ice"], [/(pe)(?:rson|ople)$/i, "$1ople"], [/(child)(?:ren)?$/i, "$1ren"], [/eaux$/i, "$0"], [/m[ae]n$/i, "men"], ["thou", "you"] ].forEach(function(rule) { return pluralize2.addPluralRule(rule[0], rule[1]); }); [ [/s$/i, ""], [/(ss)$/i, "$1"], [/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i, "$1fe"], [/(ar|(?:wo|[ae])l|[eo][ao])ves$/i, "$1f"], [/ies$/i, "y"], [/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i, "$1ie"], [/\b(mon|smil)ies$/i, "$1ey"], [/\b((?:tit)?m|l)ice$/i, "$1ouse"], [/(seraph|cherub)im$/i, "$1"], [/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i, "$1"], [/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i, "$1sis"], [/(movie|twelve|abuse|e[mn]u)s$/i, "$1"], [/(test)(?:is|es)$/i, "$1is"], [/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, "$1us"], [/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i, "$1um"], [/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i, "$1on"], [/(alumn|alg|vertebr)ae$/i, "$1a"], [/(cod|mur|sil|vert|ind)ices$/i, "$1ex"], [/(matr|append)ices$/i, "$1ix"], [/(pe)(rson|ople)$/i, "$1rson"], [/(child)ren$/i, "$1"], [/(eau)x?$/i, "$1"], [/men$/i, "man"] ].forEach(function(rule) { return pluralize2.addSingularRule(rule[0], rule[1]); }); [ // Singular words with no plurals. "adulthood", "advice", "agenda", "aid", "aircraft", "alcohol", "ammo", "analytics", "anime", "athletics", "audio", "bison", "blood", "bream", "buffalo", "butter", "carp", "cash", "chassis", "chess", "clothing", "cod", "commerce", "cooperation", "corps", "debris", "diabetes", "digestion", "elk", "energy", "equipment", "excretion", "expertise", "firmware", "flounder", "fun", "gallows", "garbage", "graffiti", "hardware", "headquarters", "health", "herpes", "highjinks", "homework", "housework", "information", "jeans", "justice", "kudos", "labour", "literature", "machinery", "mackerel", "mail", "media", "mews", "moose", "music", "mud", "manga", "news", "only", "personnel", "pike", "plankton", "pliers", "police", "pollution", "premises", "rain", "research", "rice", "salmon", "scissors", "series", "sewage", "shambles", "shrimp", "software", "species", "staff", "swine", "tennis", "traffic", "transportation", "trout", "tuna", "wealth", "welfare", "whiting", "wildebeest", "wildlife", "you", /pok[eé]mon$/i, // Regexes. /[^aeiou]ese$/i, // "chinese", "japanese" /deer$/i, // "deer", "reindeer" /fish$/i, // "fish", "blowfish", "angelfish" /measles$/i, /o[iu]s$/i, // "carnivorous" /pox$/i, // "chickpox", "smallpox" /sheep$/i ].forEach(pluralize2.addUncountableRule); return pluralize2; }); })(pluralize$1); return pluralize$1.exports; } requirePluralize(); var uniqid = { exports: {} }; const __viteBrowserExternal = {}; const __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: __viteBrowserExternal }, Symbol.toStringTag, { value: "Module" })); const require$$0 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$1); var hasRequiredUniqid; function requireUniqid() { if (hasRequiredUniqid) return uniqid.exports; hasRequiredUniqid = 1; var pid = typeof process !== "undefined" && process.pid ? process.pid.toString(36) : ""; var address = ""; if (typeof __webpack_require__ !== "function" && typeof commonjsRequire !== "undefined") { var mac = "", os = require$$0; if (os.networkInterfaces) var networkInterfaces = os.networkInterfaces(); if (networkInterfaces) { loop: for (let interface_key in networkInterfaces) { const networkInterface = networkInterfaces[interface_key]; const length = networkInterface.length; for (var i = 0; i < length; i++) { if (networkInterface[i] !== void 0 && networkInterface[i].mac && networkInterface[i].mac != "00:00:00:00:00:00") { mac = networkInterface[i].mac; break loop; } } } address = mac ? parseInt(mac.replace(/\:|\D+/gi, "")).toString(36) : ""; } } uniqid.exports = uniqid.exports.default = function(prefix, suffix) { return (prefix ? prefix : "") + address + pid + now().toString(36) + (suffix ? suffix : ""); }; uniqid.exports.process = function(prefix, suffix) { return (prefix ? prefix : "") + pid + now().toString(36) + (suffix ? suffix : ""); }; uniqid.exports.time = function(prefix, suffix) { return (prefix ? prefix : "") + now().toString(36) + (suffix ? suffix : ""); }; function now() { var time = Date.now(); var last = now.last || time; return now.last = time > last ? time : last + 1; } return uniqid.exports; } requireUniqid(); process.env.NEXT_PUBLIC_NODE_ENV || process.env.NODE_ENV; const buildArray = (count = 1) => { return Array.from(Array(count).keys()); }; const isObject = (data) => { return data !== null && data && typeof data === "object"; }; export { buildArray as b, isObject as i };