UNPKG

mermaid

Version:

Markdown-ish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.

1,581 lines 491 kB
function dedent(templ) { var values = []; for (var _i = 1; _i < arguments.length; _i++) { values[_i - 1] = arguments[_i]; } var strings = Array.from(typeof templ === "string" ? [templ] : templ); strings[strings.length - 1] = strings[strings.length - 1].replace(/\r?\n([\t ]*)$/, ""); var indentLengths = strings.reduce(function(arr, str2) { var matches = str2.match(/\n([\t ]+|(?!\s).)/g); if (matches) { return arr.concat(matches.map(function(match) { var _a, _b; return (_b = (_a = match.match(/[\t ]/g)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0; })); } return arr; }, []); if (indentLengths.length) { var pattern_1 = new RegExp("\n[ ]{" + Math.min.apply(Math, indentLengths) + "}", "g"); strings = strings.map(function(str2) { return str2.replace(pattern_1, "\n"); }); } strings[0] = strings[0].replace(/^\r?\n/, ""); var string = strings[0]; values.forEach(function(value, i) { var endentations = string.match(/(?:^|\n)( *)$/); var endentation = endentations ? endentations[1] : ""; var indentedValue = value; if (typeof value === "string" && value.includes("\n")) { indentedValue = String(value).split("\n").map(function(str2, i2) { return i2 === 0 ? str2 : "" + endentation + str2; }).join("\n"); } string += indentedValue + strings[i + 1]; }); return string; } var SECONDS_A_MINUTE = 60; var SECONDS_A_HOUR = SECONDS_A_MINUTE * 60; var SECONDS_A_DAY = SECONDS_A_HOUR * 24; var SECONDS_A_WEEK = SECONDS_A_DAY * 7; var MILLISECONDS_A_SECOND = 1e3; var MILLISECONDS_A_MINUTE = SECONDS_A_MINUTE * MILLISECONDS_A_SECOND; var MILLISECONDS_A_HOUR = SECONDS_A_HOUR * MILLISECONDS_A_SECOND; var MILLISECONDS_A_DAY = SECONDS_A_DAY * MILLISECONDS_A_SECOND; var MILLISECONDS_A_WEEK = SECONDS_A_WEEK * MILLISECONDS_A_SECOND; var MS = "millisecond"; var S = "second"; var MIN = "minute"; var H = "hour"; var D = "day"; var W = "week"; var M = "month"; var Q = "quarter"; var Y = "year"; var DATE = "date"; var FORMAT_DEFAULT = "YYYY-MM-DDTHH:mm:ssZ"; var INVALID_DATE_STRING = "Invalid Date"; var REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/; var REGEX_FORMAT = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g; const en = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function ordinal(n) { var s = ["th", "st", "nd", "rd"]; var v = n % 100; return "[" + n + (s[(v - 20) % 10] || s[v] || s[0]) + "]"; } }; var padStart$1 = function padStart(string, length2, pad) { var s = String(string); if (!s || s.length >= length2) return string; return "" + Array(length2 + 1 - s.length).join(pad) + string; }; var padZoneStr = function padZoneStr2(instance) { var negMinutes = -instance.utcOffset(); var minutes = Math.abs(negMinutes); var hourOffset = Math.floor(minutes / 60); var minuteOffset = minutes % 60; return (negMinutes <= 0 ? "+" : "-") + padStart$1(hourOffset, 2, "0") + ":" + padStart$1(minuteOffset, 2, "0"); }; var monthDiff = function monthDiff2(a, b) { if (a.date() < b.date()) return -monthDiff2(b, a); var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()); var anchor = a.clone().add(wholeMonthDiff, M); var c = b - anchor < 0; var anchor2 = a.clone().add(wholeMonthDiff + (c ? -1 : 1), M); return +(-(wholeMonthDiff + (b - anchor) / (c ? anchor - anchor2 : anchor2 - anchor)) || 0); }; var absFloor = function absFloor2(n) { return n < 0 ? Math.ceil(n) || 0 : Math.floor(n); }; var prettyUnit = function prettyUnit2(u) { var special = { M, y: Y, w: W, d: D, D: DATE, h: H, m: MIN, s: S, ms: MS, Q }; return special[u] || String(u || "").toLowerCase().replace(/s$/, ""); }; var isUndefined = function isUndefined2(s) { return s === void 0; }; const U = { s: padStart$1, z: padZoneStr, m: monthDiff, a: absFloor, p: prettyUnit, u: isUndefined }; var L = "en"; var Ls = {}; Ls[L] = en; var isDayjs = function isDayjs2(d) { return d instanceof Dayjs; }; var parseLocale = function parseLocale2(preset, object, isLocal) { var l; if (!preset) return L; if (typeof preset === "string") { var presetLower = preset.toLowerCase(); if (Ls[presetLower]) { l = presetLower; } if (object) { Ls[presetLower] = object; l = presetLower; } var presetSplit = preset.split("-"); if (!l && presetSplit.length > 1) { return parseLocale2(presetSplit[0]); } } else { var name = preset.name; Ls[name] = preset; l = name; } if (!isLocal && l) L = l; return l || !isLocal && L; }; var dayjs = function dayjs2(date, c) { if (isDayjs(date)) { return date.clone(); } var cfg = typeof c === "object" ? c : {}; cfg.date = date; cfg.args = arguments; return new Dayjs(cfg); }; var wrapper = function wrapper2(date, instance) { return dayjs(date, { locale: instance.$L, utc: instance.$u, x: instance.$x, $offset: instance.$offset // todo: refactor; do not use this.$offset in you code }); }; var Utils$1 = U; Utils$1.l = parseLocale; Utils$1.i = isDayjs; Utils$1.w = wrapper; var parseDate = function parseDate2(cfg) { var date = cfg.date, utc = cfg.utc; if (date === null) return /* @__PURE__ */ new Date(NaN); if (Utils$1.u(date)) return /* @__PURE__ */ new Date(); if (date instanceof Date) return new Date(date); if (typeof date === "string" && !/Z$/i.test(date)) { var d = date.match(REGEX_PARSE); if (d) { var m = d[2] - 1 || 0; var ms = (d[7] || "0").substring(0, 3); if (utc) { return new Date(Date.UTC(d[1], m, d[3] || 1, d[4] || 0, d[5] || 0, d[6] || 0, ms)); } return new Date(d[1], m, d[3] || 1, d[4] || 0, d[5] || 0, d[6] || 0, ms); } } return new Date(date); }; var Dayjs = /* @__PURE__ */ function() { function Dayjs2(cfg) { this.$L = parseLocale(cfg.locale, null, true); this.parse(cfg); } var _proto = Dayjs2.prototype; _proto.parse = function parse2(cfg) { this.$d = parseDate(cfg); this.$x = cfg.x || {}; this.init(); }; _proto.init = function init2() { var $d = this.$d; this.$y = $d.getFullYear(); this.$M = $d.getMonth(); this.$D = $d.getDate(); this.$W = $d.getDay(); this.$H = $d.getHours(); this.$m = $d.getMinutes(); this.$s = $d.getSeconds(); this.$ms = $d.getMilliseconds(); }; _proto.$utils = function $utils() { return Utils$1; }; _proto.isValid = function isValid() { return !(this.$d.toString() === INVALID_DATE_STRING); }; _proto.isSame = function isSame(that, units) { var other = dayjs(that); return this.startOf(units) <= other && other <= this.endOf(units); }; _proto.isAfter = function isAfter(that, units) { return dayjs(that) < this.startOf(units); }; _proto.isBefore = function isBefore(that, units) { return this.endOf(units) < dayjs(that); }; _proto.$g = function $g(input, get2, set2) { if (Utils$1.u(input)) return this[get2]; return this.set(set2, input); }; _proto.unix = function unix() { return Math.floor(this.valueOf() / 1e3); }; _proto.valueOf = function valueOf() { return this.$d.getTime(); }; _proto.startOf = function startOf(units, _startOf) { var _this = this; var isStartOf = !Utils$1.u(_startOf) ? _startOf : true; var unit2 = Utils$1.p(units); var instanceFactory = function instanceFactory2(d, m) { var ins = Utils$1.w(_this.$u ? Date.UTC(_this.$y, m, d) : new Date(_this.$y, m, d), _this); return isStartOf ? ins : ins.endOf(D); }; var instanceFactorySet = function instanceFactorySet2(method, slice2) { var argumentStart = [0, 0, 0, 0]; var argumentEnd = [23, 59, 59, 999]; return Utils$1.w(_this.toDate()[method].apply( // eslint-disable-line prefer-spread _this.toDate("s"), (isStartOf ? argumentStart : argumentEnd).slice(slice2) ), _this); }; var $W = this.$W, $M = this.$M, $D = this.$D; var utcPad = "set" + (this.$u ? "UTC" : ""); switch (unit2) { case Y: return isStartOf ? instanceFactory(1, 0) : instanceFactory(31, 11); case M: return isStartOf ? instanceFactory(1, $M) : instanceFactory(0, $M + 1); case W: { var weekStart = this.$locale().weekStart || 0; var gap = ($W < weekStart ? $W + 7 : $W) - weekStart; return instanceFactory(isStartOf ? $D - gap : $D + (6 - gap), $M); } case D: case DATE: return instanceFactorySet(utcPad + "Hours", 0); case H: return instanceFactorySet(utcPad + "Minutes", 1); case MIN: return instanceFactorySet(utcPad + "Seconds", 2); case S: return instanceFactorySet(utcPad + "Milliseconds", 3); default: return this.clone(); } }; _proto.endOf = function endOf(arg) { return this.startOf(arg, false); }; _proto.$set = function $set(units, _int) { var _C$D$C$DATE$C$M$C$Y$C; var unit2 = Utils$1.p(units); var utcPad = "set" + (this.$u ? "UTC" : ""); var name = (_C$D$C$DATE$C$M$C$Y$C = {}, _C$D$C$DATE$C$M$C$Y$C[D] = utcPad + "Date", _C$D$C$DATE$C$M$C$Y$C[DATE] = utcPad + "Date", _C$D$C$DATE$C$M$C$Y$C[M] = utcPad + "Month", _C$D$C$DATE$C$M$C$Y$C[Y] = utcPad + "FullYear", _C$D$C$DATE$C$M$C$Y$C[H] = utcPad + "Hours", _C$D$C$DATE$C$M$C$Y$C[MIN] = utcPad + "Minutes", _C$D$C$DATE$C$M$C$Y$C[S] = utcPad + "Seconds", _C$D$C$DATE$C$M$C$Y$C[MS] = utcPad + "Milliseconds", _C$D$C$DATE$C$M$C$Y$C)[unit2]; var arg = unit2 === D ? this.$D + (_int - this.$W) : _int; if (unit2 === M || unit2 === Y) { var date = this.clone().set(DATE, 1); date.$d[name](arg); date.init(); this.$d = date.set(DATE, Math.min(this.$D, date.daysInMonth())).$d; } else if (name) this.$d[name](arg); this.init(); return this; }; _proto.set = function set2(string, _int2) { return this.clone().$set(string, _int2); }; _proto.get = function get2(unit2) { return this[Utils$1.p(unit2)](); }; _proto.add = function add(number, units) { var _this2 = this, _C$MIN$C$H$C$S$unit; number = Number(number); var unit2 = Utils$1.p(units); var instanceFactorySet = function instanceFactorySet2(n) { var d = dayjs(_this2); return Utils$1.w(d.date(d.date() + Math.round(n * number)), _this2); }; if (unit2 === M) { return this.set(M, this.$M + number); } if (unit2 === Y) { return this.set(Y, this.$y + number); } if (unit2 === D) { return instanceFactorySet(1); } if (unit2 === W) { return instanceFactorySet(7); } var step = (_C$MIN$C$H$C$S$unit = {}, _C$MIN$C$H$C$S$unit[MIN] = MILLISECONDS_A_MINUTE, _C$MIN$C$H$C$S$unit[H] = MILLISECONDS_A_HOUR, _C$MIN$C$H$C$S$unit[S] = MILLISECONDS_A_SECOND, _C$MIN$C$H$C$S$unit)[unit2] || 1; var nextTimeStamp = this.$d.getTime() + number * step; return Utils$1.w(nextTimeStamp, this); }; _proto.subtract = function subtract(number, string) { return this.add(number * -1, string); }; _proto.format = function format2(formatStr) { var _this3 = this; var locale = this.$locale(); if (!this.isValid()) return locale.invalidDate || INVALID_DATE_STRING; var str2 = formatStr || FORMAT_DEFAULT; var zoneStr = Utils$1.z(this); var $H = this.$H, $m = this.$m, $M = this.$M; var weekdays = locale.weekdays, months = locale.months, meridiem = locale.meridiem; var getShort = function getShort2(arr, index, full, length2) { return arr && (arr[index] || arr(_this3, str2)) || full[index].slice(0, length2); }; var get$H = function get$H2(num) { return Utils$1.s($H % 12 || 12, num, "0"); }; var meridiemFunc = meridiem || function(hour, minute, isLowercase) { var m = hour < 12 ? "AM" : "PM"; return isLowercase ? m.toLowerCase() : m; }; var matches = { YY: String(this.$y).slice(-2), YYYY: this.$y, M: $M + 1, MM: Utils$1.s($M + 1, 2, "0"), MMM: getShort(locale.monthsShort, $M, months, 3), MMMM: getShort(months, $M), D: this.$D, DD: Utils$1.s(this.$D, 2, "0"), d: String(this.$W), dd: getShort(locale.weekdaysMin, this.$W, weekdays, 2), ddd: getShort(locale.weekdaysShort, this.$W, weekdays, 3), dddd: weekdays[this.$W], H: String($H), HH: Utils$1.s($H, 2, "0"), h: get$H(1), hh: get$H(2), a: meridiemFunc($H, $m, true), A: meridiemFunc($H, $m, false), m: String($m), mm: Utils$1.s($m, 2, "0"), s: String(this.$s), ss: Utils$1.s(this.$s, 2, "0"), SSS: Utils$1.s(this.$ms, 3, "0"), Z: zoneStr // 'ZZ' logic below }; return str2.replace(REGEX_FORMAT, function(match, $1) { return $1 || matches[match] || zoneStr.replace(":", ""); }); }; _proto.utcOffset = function utcOffset() { return -Math.round(this.$d.getTimezoneOffset() / 15) * 15; }; _proto.diff = function diff(input, units, _float) { var _C$Y$C$M$C$Q$C$W$C$D$; var unit2 = Utils$1.p(units); var that = dayjs(input); var zoneDelta = (that.utcOffset() - this.utcOffset()) * MILLISECONDS_A_MINUTE; var diff2 = this - that; var result = Utils$1.m(this, that); result = (_C$Y$C$M$C$Q$C$W$C$D$ = {}, _C$Y$C$M$C$Q$C$W$C$D$[Y] = result / 12, _C$Y$C$M$C$Q$C$W$C$D$[M] = result, _C$Y$C$M$C$Q$C$W$C$D$[Q] = result / 3, _C$Y$C$M$C$Q$C$W$C$D$[W] = (diff2 - zoneDelta) / MILLISECONDS_A_WEEK, _C$Y$C$M$C$Q$C$W$C$D$[D] = (diff2 - zoneDelta) / MILLISECONDS_A_DAY, _C$Y$C$M$C$Q$C$W$C$D$[H] = diff2 / MILLISECONDS_A_HOUR, _C$Y$C$M$C$Q$C$W$C$D$[MIN] = diff2 / MILLISECONDS_A_MINUTE, _C$Y$C$M$C$Q$C$W$C$D$[S] = diff2 / MILLISECONDS_A_SECOND, _C$Y$C$M$C$Q$C$W$C$D$)[unit2] || diff2; return _float ? result : Utils$1.a(result); }; _proto.daysInMonth = function daysInMonth() { return this.endOf(M).$D; }; _proto.$locale = function $locale() { return Ls[this.$L]; }; _proto.locale = function locale(preset, object) { if (!preset) return this.$L; var that = this.clone(); var nextLocaleName = parseLocale(preset, object, true); if (nextLocaleName) that.$L = nextLocaleName; return that; }; _proto.clone = function clone2() { return Utils$1.w(this.$d, this); }; _proto.toDate = function toDate() { return new Date(this.valueOf()); }; _proto.toJSON = function toJSON() { return this.isValid() ? this.toISOString() : null; }; _proto.toISOString = function toISOString() { return this.$d.toISOString(); }; _proto.toString = function toString2() { return this.$d.toUTCString(); }; return Dayjs2; }(); var proto = Dayjs.prototype; dayjs.prototype = proto; [["$ms", MS], ["$s", S], ["$m", MIN], ["$H", H], ["$W", D], ["$M", M], ["$y", Y], ["$D", DATE]].forEach(function(g) { proto[g[1]] = function(input) { return this.$g(input, g[0], g[1]); }; }); dayjs.extend = function(plugin2, option) { if (!plugin2.$i) { plugin2(option, Dayjs, dayjs); plugin2.$i = true; } return dayjs; }; dayjs.locale = parseLocale; dayjs.isDayjs = isDayjs; dayjs.unix = function(timestamp2) { return dayjs(timestamp2 * 1e3); }; dayjs.en = Ls[L]; dayjs.Ls = Ls; dayjs.p = {}; const LEVELS = { trace: 0, debug: 1, info: 2, warn: 3, error: 4, fatal: 5 }; const log$1 = { trace: (..._args) => { }, debug: (..._args) => { }, info: (..._args) => { }, warn: (..._args) => { }, error: (..._args) => { }, fatal: (..._args) => { } }; const setLogLevel$1 = function(level = "fatal") { let numericLevel = LEVELS.fatal; if (typeof level === "string") { level = level.toLowerCase(); if (level in LEVELS) { numericLevel = LEVELS[level]; } } else if (typeof level === "number") { numericLevel = level; } log$1.trace = () => { }; log$1.debug = () => { }; log$1.info = () => { }; log$1.warn = () => { }; log$1.error = () => { }; log$1.fatal = () => { }; if (numericLevel <= LEVELS.fatal) { log$1.fatal = console.error ? console.error.bind(console, format("FATAL"), "color: orange") : console.log.bind(console, "\x1B[35m", format("FATAL")); } if (numericLevel <= LEVELS.error) { log$1.error = console.error ? console.error.bind(console, format("ERROR"), "color: orange") : console.log.bind(console, "\x1B[31m", format("ERROR")); } if (numericLevel <= LEVELS.warn) { log$1.warn = console.warn ? console.warn.bind(console, format("WARN"), "color: orange") : console.log.bind(console, `\x1B[33m`, format("WARN")); } if (numericLevel <= LEVELS.info) { log$1.info = console.info ? console.info.bind(console, format("INFO"), "color: lightblue") : console.log.bind(console, "\x1B[34m", format("INFO")); } if (numericLevel <= LEVELS.debug) { log$1.debug = console.debug ? console.debug.bind(console, format("DEBUG"), "color: lightgreen") : console.log.bind(console, "\x1B[32m", format("DEBUG")); } if (numericLevel <= LEVELS.trace) { log$1.trace = console.debug ? console.debug.bind(console, format("TRACE"), "color: lightgreen") : console.log.bind(console, "\x1B[32m", format("TRACE")); } }; const format = (level) => { const time = dayjs().format("ss.SSS"); return `%c${time} : ${level} : `; }; var dist = {}; Object.defineProperty(dist, "__esModule", { value: true }); var sanitizeUrl_1 = dist.sanitizeUrl = void 0; var invalidProtocolRegex = /^([^\w]*)(javascript|data|vbscript)/im; var htmlEntitiesRegex = /&#(\w+)(^\w|;)?/g; var htmlCtrlEntityRegex = /&(newline|tab);/gi; var ctrlCharactersRegex = /[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim; var urlSchemeRegex = /^.+(:|&colon;)/gim; var relativeFirstCharacters = [".", "/"]; function isRelativeUrlWithoutProtocol(url) { return relativeFirstCharacters.indexOf(url[0]) > -1; } function decodeHtmlCharacters(str2) { return str2.replace(htmlEntitiesRegex, function(match, dec) { return String.fromCharCode(dec); }); } function sanitizeUrl(url) { var sanitizedUrl = decodeHtmlCharacters(url || "").replace(htmlCtrlEntityRegex, "").replace(ctrlCharactersRegex, "").trim(); if (!sanitizedUrl) { return "about:blank"; } if (isRelativeUrlWithoutProtocol(sanitizedUrl)) { return sanitizedUrl; } var urlSchemeParseResults = sanitizedUrl.match(urlSchemeRegex); if (!urlSchemeParseResults) { return sanitizedUrl; } var urlScheme = urlSchemeParseResults[0]; if (invalidProtocolRegex.test(urlScheme)) { return "about:blank"; } return sanitizedUrl; } sanitizeUrl_1 = dist.sanitizeUrl = sanitizeUrl; var noop$1 = { value: () => { } }; function dispatch() { for (var i = 0, n = arguments.length, _2 = {}, t; i < n; ++i) { if (!(t = arguments[i] + "") || t in _2 || /[\s.]/.test(t)) throw new Error("illegal type: " + t); _2[t] = []; } return new Dispatch(_2); } function Dispatch(_2) { this._ = _2; } function parseTypenames$1(typenames, types) { return typenames.trim().split(/^|\s+/).map(function(t) { var name = "", i = t.indexOf("."); if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i); if (t && !types.hasOwnProperty(t)) throw new Error("unknown type: " + t); return { type: t, name }; }); } Dispatch.prototype = dispatch.prototype = { constructor: Dispatch, on: function(typename, callback) { var _2 = this._, T = parseTypenames$1(typename + "", _2), t, i = -1, n = T.length; if (arguments.length < 2) { while (++i < n) if ((t = (typename = T[i]).type) && (t = get$1(_2[t], typename.name))) return t; return; } if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback); while (++i < n) { if (t = (typename = T[i]).type) _2[t] = set$2(_2[t], typename.name, callback); else if (callback == null) for (t in _2) _2[t] = set$2(_2[t], typename.name, null); } return this; }, copy: function() { var copy = {}, _2 = this._; for (var t in _2) copy[t] = _2[t].slice(); return new Dispatch(copy); }, call: function(type2, that) { if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2]; if (!this._.hasOwnProperty(type2)) throw new Error("unknown type: " + type2); for (t = this._[type2], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args); }, apply: function(type2, that, args) { if (!this._.hasOwnProperty(type2)) throw new Error("unknown type: " + type2); for (var t = this._[type2], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args); } }; function get$1(type2, name) { for (var i = 0, n = type2.length, c; i < n; ++i) { if ((c = type2[i]).name === name) { return c.value; } } } function set$2(type2, name, callback) { for (var i = 0, n = type2.length; i < n; ++i) { if (type2[i].name === name) { type2[i] = noop$1, type2 = type2.slice(0, i).concat(type2.slice(i + 1)); break; } } if (callback != null) type2.push({ name, value: callback }); return type2; } var xhtml = "http://www.w3.org/1999/xhtml"; const namespaces = { svg: "http://www.w3.org/2000/svg", xhtml, xlink: "http://www.w3.org/1999/xlink", xml: "http://www.w3.org/XML/1998/namespace", xmlns: "http://www.w3.org/2000/xmlns/" }; function namespace(name) { var prefix = name += "", i = prefix.indexOf(":"); if (i >= 0 && (prefix = name.slice(0, i)) !== "xmlns") name = name.slice(i + 1); return namespaces.hasOwnProperty(prefix) ? { space: namespaces[prefix], local: name } : name; } function creatorInherit(name) { return function() { var document2 = this.ownerDocument, uri = this.namespaceURI; return uri === xhtml && document2.documentElement.namespaceURI === xhtml ? document2.createElement(name) : document2.createElementNS(uri, name); }; } function creatorFixed(fullname) { return function() { return this.ownerDocument.createElementNS(fullname.space, fullname.local); }; } function creator(name) { var fullname = namespace(name); return (fullname.local ? creatorFixed : creatorInherit)(fullname); } function none() { } function selector(selector2) { return selector2 == null ? none : function() { return this.querySelector(selector2); }; } function selection_select(select2) { if (typeof select2 !== "function") select2 = selector(select2); for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) { for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node2, subnode, i = 0; i < n; ++i) { if ((node2 = group[i]) && (subnode = select2.call(node2, node2.__data__, i, group))) { if ("__data__" in node2) subnode.__data__ = node2.__data__; subgroup[i] = subnode; } } } return new Selection$1(subgroups, this._parents); } function array(x) { return x == null ? [] : Array.isArray(x) ? x : Array.from(x); } function empty() { return []; } function selectorAll(selector2) { return selector2 == null ? empty : function() { return this.querySelectorAll(selector2); }; } function arrayAll(select2) { return function() { return array(select2.apply(this, arguments)); }; } function selection_selectAll(select2) { if (typeof select2 === "function") select2 = arrayAll(select2); else select2 = selectorAll(select2); for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) { for (var group = groups[j], n = group.length, node2, i = 0; i < n; ++i) { if (node2 = group[i]) { subgroups.push(select2.call(node2, node2.__data__, i, group)); parents.push(node2); } } } return new Selection$1(subgroups, parents); } function matcher(selector2) { return function() { return this.matches(selector2); }; } function childMatcher(selector2) { return function(node2) { return node2.matches(selector2); }; } var find = Array.prototype.find; function childFind(match) { return function() { return find.call(this.children, match); }; } function childFirst() { return this.firstElementChild; } function selection_selectChild(match) { return this.select(match == null ? childFirst : childFind(typeof match === "function" ? match : childMatcher(match))); } var filter = Array.prototype.filter; function children() { return Array.from(this.children); } function childrenFilter(match) { return function() { return filter.call(this.children, match); }; } function selection_selectChildren(match) { return this.selectAll(match == null ? children : childrenFilter(typeof match === "function" ? match : childMatcher(match))); } function selection_filter(match) { if (typeof match !== "function") match = matcher(match); for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) { for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node2, i = 0; i < n; ++i) { if ((node2 = group[i]) && match.call(node2, node2.__data__, i, group)) { subgroup.push(node2); } } } return new Selection$1(subgroups, this._parents); } function sparse(update) { return new Array(update.length); } function selection_enter() { return new Selection$1(this._enter || this._groups.map(sparse), this._parents); } function EnterNode(parent, datum2) { this.ownerDocument = parent.ownerDocument; this.namespaceURI = parent.namespaceURI; this._next = null; this._parent = parent; this.__data__ = datum2; } EnterNode.prototype = { constructor: EnterNode, appendChild: function(child) { return this._parent.insertBefore(child, this._next); }, insertBefore: function(child, next2) { return this._parent.insertBefore(child, next2); }, querySelector: function(selector2) { return this._parent.querySelector(selector2); }, querySelectorAll: function(selector2) { return this._parent.querySelectorAll(selector2); } }; function constant$1(x) { return function() { return x; }; } function bindIndex(parent, group, enter, update, exit, data) { var i = 0, node2, groupLength = group.length, dataLength = data.length; for (; i < dataLength; ++i) { if (node2 = group[i]) { node2.__data__ = data[i]; update[i] = node2; } else { enter[i] = new EnterNode(parent, data[i]); } } for (; i < groupLength; ++i) { if (node2 = group[i]) { exit[i] = node2; } } } function bindKey(parent, group, enter, update, exit, data, key) { var i, node2, nodeByKeyValue = /* @__PURE__ */ new Map(), groupLength = group.length, dataLength = data.length, keyValues = new Array(groupLength), keyValue; for (i = 0; i < groupLength; ++i) { if (node2 = group[i]) { keyValues[i] = keyValue = key.call(node2, node2.__data__, i, group) + ""; if (nodeByKeyValue.has(keyValue)) { exit[i] = node2; } else { nodeByKeyValue.set(keyValue, node2); } } } for (i = 0; i < dataLength; ++i) { keyValue = key.call(parent, data[i], i, data) + ""; if (node2 = nodeByKeyValue.get(keyValue)) { update[i] = node2; node2.__data__ = data[i]; nodeByKeyValue.delete(keyValue); } else { enter[i] = new EnterNode(parent, data[i]); } } for (i = 0; i < groupLength; ++i) { if ((node2 = group[i]) && nodeByKeyValue.get(keyValues[i]) === node2) { exit[i] = node2; } } } function datum(node2) { return node2.__data__; } function selection_data(value, key) { if (!arguments.length) return Array.from(this, datum); var bind = key ? bindKey : bindIndex, parents = this._parents, groups = this._groups; if (typeof value !== "function") value = constant$1(value); for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) { var parent = parents[j], group = groups[j], groupLength = group.length, data = arraylike(value.call(parent, parent && parent.__data__, j, parents)), dataLength = data.length, enterGroup = enter[j] = new Array(dataLength), updateGroup = update[j] = new Array(dataLength), exitGroup = exit[j] = new Array(groupLength); bind(parent, group, enterGroup, updateGroup, exitGroup, data, key); for (var i0 = 0, i1 = 0, previous, next2; i0 < dataLength; ++i0) { if (previous = enterGroup[i0]) { if (i0 >= i1) i1 = i0 + 1; while (!(next2 = updateGroup[i1]) && ++i1 < dataLength) ; previous._next = next2 || null; } } } update = new Selection$1(update, parents); update._enter = enter; update._exit = exit; return update; } function arraylike(data) { return typeof data === "object" && "length" in data ? data : Array.from(data); } function selection_exit() { return new Selection$1(this._exit || this._groups.map(sparse), this._parents); } function selection_join(onenter, onupdate, onexit) { var enter = this.enter(), update = this, exit = this.exit(); if (typeof onenter === "function") { enter = onenter(enter); if (enter) enter = enter.selection(); } else { enter = enter.append(onenter + ""); } if (onupdate != null) { update = onupdate(update); if (update) update = update.selection(); } if (onexit == null) exit.remove(); else onexit(exit); return enter && update ? enter.merge(update).order() : update; } function selection_merge(context) { var selection2 = context.selection ? context.selection() : context; for (var groups0 = this._groups, groups1 = selection2._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) { for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge2 = merges[j] = new Array(n), node2, i = 0; i < n; ++i) { if (node2 = group0[i] || group1[i]) { merge2[i] = node2; } } } for (; j < m0; ++j) { merges[j] = groups0[j]; } return new Selection$1(merges, this._parents); } function selection_order() { for (var groups = this._groups, j = -1, m = groups.length; ++j < m; ) { for (var group = groups[j], i = group.length - 1, next2 = group[i], node2; --i >= 0; ) { if (node2 = group[i]) { if (next2 && node2.compareDocumentPosition(next2) ^ 4) next2.parentNode.insertBefore(node2, next2); next2 = node2; } } } return this; } function selection_sort(compare) { if (!compare) compare = ascending; function compareNode(a, b) { return a && b ? compare(a.__data__, b.__data__) : !a - !b; } for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) { for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node2, i = 0; i < n; ++i) { if (node2 = group[i]) { sortgroup[i] = node2; } } sortgroup.sort(compareNode); } return new Selection$1(sortgroups, this._parents).order(); } function ascending(a, b) { return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; } function selection_call() { var callback = arguments[0]; arguments[0] = this; callback.apply(null, arguments); return this; } function selection_nodes() { return Array.from(this); } function selection_node() { for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) { for (var group = groups[j], i = 0, n = group.length; i < n; ++i) { var node2 = group[i]; if (node2) return node2; } } return null; } function selection_size() { let size = 0; for (const node2 of this) ++size; return size; } function selection_empty() { return !this.node(); } function selection_each(callback) { for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) { for (var group = groups[j], i = 0, n = group.length, node2; i < n; ++i) { if (node2 = group[i]) callback.call(node2, node2.__data__, i, group); } } return this; } function attrRemove$1(name) { return function() { this.removeAttribute(name); }; } function attrRemoveNS$1(fullname) { return function() { this.removeAttributeNS(fullname.space, fullname.local); }; } function attrConstant$1(name, value) { return function() { this.setAttribute(name, value); }; } function attrConstantNS$1(fullname, value) { return function() { this.setAttributeNS(fullname.space, fullname.local, value); }; } function attrFunction$1(name, value) { return function() { var v = value.apply(this, arguments); if (v == null) this.removeAttribute(name); else this.setAttribute(name, v); }; } function attrFunctionNS$1(fullname, value) { return function() { var v = value.apply(this, arguments); if (v == null) this.removeAttributeNS(fullname.space, fullname.local); else this.setAttributeNS(fullname.space, fullname.local, v); }; } function selection_attr(name, value) { var fullname = namespace(name); if (arguments.length < 2) { var node2 = this.node(); return fullname.local ? node2.getAttributeNS(fullname.space, fullname.local) : node2.getAttribute(fullname); } return this.each((value == null ? fullname.local ? attrRemoveNS$1 : attrRemove$1 : typeof value === "function" ? fullname.local ? attrFunctionNS$1 : attrFunction$1 : fullname.local ? attrConstantNS$1 : attrConstant$1)(fullname, value)); } function defaultView(node2) { return node2.ownerDocument && node2.ownerDocument.defaultView || node2.document && node2 || node2.defaultView; } function styleRemove$1(name) { return function() { this.style.removeProperty(name); }; } function styleConstant$1(name, value, priority) { return function() { this.style.setProperty(name, value, priority); }; } function styleFunction$1(name, value, priority) { return function() { var v = value.apply(this, arguments); if (v == null) this.style.removeProperty(name); else this.style.setProperty(name, v, priority); }; } function selection_style(name, value, priority) { return arguments.length > 1 ? this.each((value == null ? styleRemove$1 : typeof value === "function" ? styleFunction$1 : styleConstant$1)(name, value, priority == null ? "" : priority)) : styleValue(this.node(), name); } function styleValue(node2, name) { return node2.style.getPropertyValue(name) || defaultView(node2).getComputedStyle(node2, null).getPropertyValue(name); } function propertyRemove(name) { return function() { delete this[name]; }; } function propertyConstant(name, value) { return function() { this[name] = value; }; } function propertyFunction(name, value) { return function() { var v = value.apply(this, arguments); if (v == null) delete this[name]; else this[name] = v; }; } function selection_property(name, value) { return arguments.length > 1 ? this.each((value == null ? propertyRemove : typeof value === "function" ? propertyFunction : propertyConstant)(name, value)) : this.node()[name]; } function classArray(string) { return string.trim().split(/^|\s+/); } function classList(node2) { return node2.classList || new ClassList(node2); } function ClassList(node2) { this._node = node2; this._names = classArray(node2.getAttribute("class") || ""); } ClassList.prototype = { add: function(name) { var i = this._names.indexOf(name); if (i < 0) { this._names.push(name); this._node.setAttribute("class", this._names.join(" ")); } }, remove: function(name) { var i = this._names.indexOf(name); if (i >= 0) { this._names.splice(i, 1); this._node.setAttribute("class", this._names.join(" ")); } }, contains: function(name) { return this._names.indexOf(name) >= 0; } }; function classedAdd(node2, names) { var list = classList(node2), i = -1, n = names.length; while (++i < n) list.add(names[i]); } function classedRemove(node2, names) { var list = classList(node2), i = -1, n = names.length; while (++i < n) list.remove(names[i]); } function classedTrue(names) { return function() { classedAdd(this, names); }; } function classedFalse(names) { return function() { classedRemove(this, names); }; } function classedFunction(names, value) { return function() { (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names); }; } function selection_classed(name, value) { var names = classArray(name + ""); if (arguments.length < 2) { var list = classList(this.node()), i = -1, n = names.length; while (++i < n) if (!list.contains(names[i])) return false; return true; } return this.each((typeof value === "function" ? classedFunction : value ? classedTrue : classedFalse)(names, value)); } function textRemove() { this.textContent = ""; } function textConstant$1(value) { return function() { this.textContent = value; }; } function textFunction$1(value) { return function() { var v = value.apply(this, arguments); this.textContent = v == null ? "" : v; }; } function selection_text(value) { return arguments.length ? this.each(value == null ? textRemove : (typeof value === "function" ? textFunction$1 : textConstant$1)(value)) : this.node().textContent; } function htmlRemove() { this.innerHTML = ""; } function htmlConstant(value) { return function() { this.innerHTML = value; }; } function htmlFunction(value) { return function() { var v = value.apply(this, arguments); this.innerHTML = v == null ? "" : v; }; } function selection_html(value) { return arguments.length ? this.each(value == null ? htmlRemove : (typeof value === "function" ? htmlFunction : htmlConstant)(value)) : this.node().innerHTML; } function raise() { if (this.nextSibling) this.parentNode.appendChild(this); } function selection_raise() { return this.each(raise); } function lower() { if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild); } function selection_lower() { return this.each(lower); } function selection_append(name) { var create2 = typeof name === "function" ? name : creator(name); return this.select(function() { return this.appendChild(create2.apply(this, arguments)); }); } function constantNull() { return null; } function selection_insert(name, before) { var create2 = typeof name === "function" ? name : creator(name), select2 = before == null ? constantNull : typeof before === "function" ? before : selector(before); return this.select(function() { return this.insertBefore(create2.apply(this, arguments), select2.apply(this, arguments) || null); }); } function remove() { var parent = this.parentNode; if (parent) parent.removeChild(this); } function selection_remove() { return this.each(remove); } function selection_cloneShallow() { var clone2 = this.cloneNode(false), parent = this.parentNode; return parent ? parent.insertBefore(clone2, this.nextSibling) : clone2; } function selection_cloneDeep() { var clone2 = this.cloneNode(true), parent = this.parentNode; return parent ? parent.insertBefore(clone2, this.nextSibling) : clone2; } function selection_clone(deep) { return this.select(deep ? selection_cloneDeep : selection_cloneShallow); } function selection_datum(value) { return arguments.length ? this.property("__data__", value) : this.node().__data__; } function contextListener(listener) { return function(event) { listener.call(this, event, this.__data__); }; } function parseTypenames(typenames) { return typenames.trim().split(/^|\s+/).map(function(t) { var name = "", i = t.indexOf("."); if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i); return { type: t, name }; }); } function onRemove(typename) { return function() { var on = this.__on; if (!on) return; for (var j = 0, i = -1, m = on.length, o; j < m; ++j) { if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) { this.removeEventListener(o.type, o.listener, o.options); } else { on[++i] = o; } } if (++i) on.length = i; else delete this.__on; }; } function onAdd(typename, value, options) { return function() { var on = this.__on, o, listener = contextListener(value); if (on) for (var j = 0, m = on.length; j < m; ++j) { if ((o = on[j]).type === typename.type && o.name === typename.name) { this.removeEventListener(o.type, o.listener, o.options); this.addEventListener(o.type, o.listener = listener, o.options = options); o.value = value; return; } } this.addEventListener(typename.type, listener, options); o = { type: typename.type, name: typename.name, value, listener, options }; if (!on) this.__on = [o]; else on.push(o); }; } function selection_on(typename, value, options) { var typenames = parseTypenames(typename + ""), i, n = typenames.length, t; if (arguments.length < 2) { var on = this.node().__on; if (on) for (var j = 0, m = on.length, o; j < m; ++j) { for (i = 0, o = on[j]; i < n; ++i) { if ((t = typenames[i]).type === o.type && t.name === o.name) { return o.value; } } } return; } on = value ? onAdd : onRemove; for (i = 0; i < n; ++i) this.each(on(typenames[i], value, options)); return this; } function dispatchEvent(node2, type2, params) { var window2 = defaultView(node2), event = window2.CustomEvent; if (typeof event === "function") { event = new event(type2, params); } else { event = window2.document.createEvent("Event"); if (params) event.initEvent(type2, params.bubbles, params.cancelable), event.detail = params.detail; else event.initEvent(type2, false, false); } node2.dispatchEvent(event); } function dispatchConstant(type2, params) { return function() { return dispatchEvent(this, type2, params); }; } function dispatchFunction(type2, params) { return function() { return dispatchEvent(this, type2, params.apply(this, arguments)); }; } function selection_dispatch(type2, params) { return this.each((typeof params === "function" ? dispatchFunction : dispatchConstant)(type2, params)); } function* selection_iterator() { for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) { for (var group = groups[j], i = 0, n = group.length, node2; i < n; ++i) { if (node2 = group[i]) yield node2; } } } var root$2 = [null]; function Selection$1(groups, parents) { this._groups = groups; this._parents = parents; } function selection() { return new Selection$1([[document.documentElement]], root$2); } function selection_selection() { return this; } Selection$1.prototype = selection.prototype = { constructor: Selection$1, select: selection_select, selectAll: selection_selectAll, selectChild: selection_selectChild, selectChildren: selection_selectChildren, filter: selection_filter, data: selection_data, enter: selection_enter, exit: selection_exit, join: selection_join, merge: selection_merge, selection: selection_selection, order: selection_order, sort: selection_sort, call: selection_call, nodes: selection_nodes, node: selection_node, size: selection_size, empty: selection_empty, each: selection_each, attr: selection_attr, style: selection_style, property: selection_property, classed: selection_classed, text: selection_text, html: selection_html, raise: selection_raise, lower: selection_lower, append: selection_append, insert: selection_insert, remove: selection_remove, clone: selection_clone, datum: selection_datum, on: selection_on, dispatch: selection_dispatch, [Symbol.iterator]: selection_iterator }; function select(selector2) { return typeof selector2 === "string" ? new Selection$1([[document.querySelector(selector2)]], [document.documentElement]) : new Selection$1([[selector2]], root$2); } function define(constructor, factory, prototype) { constructor.prototype = factory.prototype = prototype; prototype.constructor = constructor; } function extend$1(parent, definition) { var prototype = Object.create(parent.prototype); for (var key in definition) prototype[key] = definition[key]; return prototype; } function Color$2() { } var darker = 0.7; var brighter = 1 / darker; var reI = "\\s*([+-]?\\d+)\\s*", reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", reHex = /^#([0-9a-f]{3,8})$/, reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`), reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`), reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`), reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`), reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`), reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`); var named = { aliceblue: 15792383, antiquewhite: 16444375, aqua: 65535, aquamarine: 8388564, azure: 15794175, beige: 16119260, bisque: 16770244, black: 0, blanchedalmond: 16772045, blue: 255, blueviolet: 9055202, brown: 10824234, burlywood: 14596231, cadetblue: 6266528, chartreuse: 8388352, chocolate: 13789470, coral: 16744272, cornflowerblue: 6591981, cornsilk: 16775388, crimson: 14423100, cyan: 65535, darkblue: 139, darkcyan: 35723, darkgoldenrod: 12092939, darkgray: 11119017, darkgreen: 25600, darkgrey: 11119017, darkkhaki: 12433259, darkmagenta: 9109643, darkolivegreen: 5597999, darkorange: 16747520, darkorchid: 10040012, darkred: 9109504, darksalmon: 15308410, darkseagreen: 9419919, darkslateblue: 4734347, darkslategray: 3100495, darkslategrey: 3100495, darkturquoise: 52945, darkviolet: 9699539, deeppink: 16716947, deepskyblue: 49151, dimgray: 6908265, dimgrey: 6908265, dodgerblue: 2003199, firebrick: 11674146, floralwhite: 16775920, forestgreen: 2263842, fuchsia: 16711935, gainsboro: 14474460, ghostwhite: 16316671, gold: 16766720, goldenrod: 14329120, gray: 8421504, green: 32768, greenyellow: 11403055, grey: 8421504, honeydew: 15794160, hotpink: 16738740, indianred: 13458524, indigo: 4915330, ivory: 16777200, khaki: 15787660, lavender: 15132410, lavenderblush: 16773365, lawngreen: 8190976, lemonchiffon: 16775885, lightblue: 11393254, lightcoral: 15761536, lightcyan: 14745599, lightgoldenrodyellow: 16448210, lightgray: 13882323, lightgreen: 9498256, lightgrey: 13882323, lightpink: 16758465, lightsalmon: 16752762, lightseagreen: 2142890, lightskyblue: 8900346, lightslategray: 7833753, lightslategrey: 7833753, lightsteelblue: 11584734, lightyellow: 16777184, lime: 65280, limegreen: 3329330, linen: 16445670, magenta: 16711935, maroon: 8388608, mediumaquamarine: 6737322, mediumblue: 205, mediumorchid: 12211667, mediumpurple: 9662683, mediumseagreen: 3978097, mediumslateblue: 8087790, mediumspringgreen: 64154, mediumturquoise: 4772300, mediumvioletred: 13047173, midnightblue: 1644912, mintcream: 16121850, mistyrose: 16770273, moccasin: 16770229, navajowhite: 16768685, navy: 128, oldlace: 16643558, olive: 8421376, olivedrab: 7048739, orange: 16753920, orangered: 16729344, orchid: 14315734, palegoldenrod: 15657130, palegreen: 10025880, paleturquoise: 11529966, palevioletred: 14381203, papayawhip: 16773077, peachpuff: 16767673, peru: 13468991, pink: 16761035, plum: 14524637, powderblue: 11591910, purple: 8388736, rebeccapurple: 6697881, red: 16711680, rosybrown: 12357519, royalblue: 4286945, saddlebrown: 9127187, salmon: 16416882, sandybrown: 16032864, seagreen: 3050327, seashell: 16774638, sienna: 10506797, silver: 12632256, skyblue: 8900331, slateblue: 6970061, slategray: 7372944, slategrey: 7372944, snow: 16775930, springgreen: 65407, steelblue: 4620980, tan: 13808780, teal: 32896, thistle: 14204888, tomato: 16737095, turquoise: 4251856, violet: 15631086, wheat: 16113331, white: 16777215, whitesmoke: 16119285, yellow: 16776960, yellowgreen: 10145074 }; define(Color$2, color, { copy(channels2) { return Object.assign(new this.constructor(), this, channels2); }, displayable() { return this.rgb().displayable(); }, hex: color_formatHex, // Deprecated! Use color.formatHex. formatHex: color_formatHex, formatHex8: color_formatHex8, formatHsl: color_formatHsl, formatRgb: color_formatRgb, toString: color_formatRgb }); function color_formatHex() { return this.rgb().formatHex(); } function color_formatHex8() { return this.rgb().formatHex8(); } function color_formatHsl() { return hslConvert(this).formatHsl(); } function color_formatRgb() { return this.rgb().formatRgb(); } function color(format2) { var m, l; format2 = (format2 + "").trim().toLowerCase(); return (m = reHex.exec(format2)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) : l === 3 ? new Rgb(m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, (m & 15) << 4 | m & 15, 1) : l === 8 ? rgba$2(m >> 24 & 255, m >> 16 & 255, m >> 8 & 255, (m & 255) / 255) : l === 4 ? rgba$2(m >> 12 & 15 | m >> 8 & 240, m >> 8 & 15 | m >> 4 & 240, m