{"version":3,"file":"main.js","sources":["../node_modules/@github/relative-time-element/dist/duration-format-ponyfill.js","../node_modules/@github/relative-time-element/dist/duration.js","../node_modules/@github/relative-time-element/dist/relative-time-element.js","../node_modules/@github/relative-time-element/dist/relative-time-element-define.js","../node_modules/d3-array/src/ascending.js","../node_modules/d3-array/src/descending.js","../node_modules/d3-array/src/bisector.js","../node_modules/d3-array/src/number.js","../node_modules/d3-array/src/bisect.js","../node_modules/d3-array/src/ticks.js","../node_modules/d3-scale/src/init.js","../node_modules/d3-color/src/define.js","../node_modules/d3-color/src/color.js","../node_modules/d3-interpolate/src/constant.js","../node_modules/d3-interpolate/src/color.js","../node_modules/d3-interpolate/src/rgb.js","../node_modules/d3-interpolate/src/numberArray.js","../node_modules/d3-interpolate/src/array.js","../node_modules/d3-interpolate/src/date.js","../node_modules/d3-interpolate/src/number.js","../node_modules/d3-interpolate/src/object.js","../node_modules/d3-interpolate/src/string.js","../node_modules/d3-interpolate/src/value.js","../node_modules/d3-interpolate/src/round.js","../node_modules/d3-scale/src/constant.js","../node_modules/d3-scale/src/number.js","../node_modules/d3-scale/src/continuous.js","../node_modules/d3-format/src/formatDecimal.js","../node_modules/d3-format/src/exponent.js","../node_modules/d3-format/src/formatGroup.js","../node_modules/d3-format/src/formatNumerals.js","../node_modules/d3-format/src/formatSpecifier.js","../node_modules/d3-format/src/formatTrim.js","../node_modules/d3-format/src/formatPrefixAuto.js","../node_modules/d3-format/src/formatRounded.js","../node_modules/d3-format/src/formatTypes.js","../node_modules/d3-format/src/identity.js","../node_modules/d3-format/src/locale.js","../node_modules/d3-format/src/defaultLocale.js","../node_modules/d3-format/src/precisionFixed.js","../node_modules/d3-format/src/precisionPrefix.js","../node_modules/d3-format/src/precisionRound.js","../node_modules/d3-scale/src/tickFormat.js","../node_modules/d3-scale/src/linear.js","../node_modules/colorizr/dist/index.mjs","../node_modules/choices.js/public/assets/scripts/choices.mjs","../src/main.js"],"sourcesContent":["var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n};\nvar __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar _DurationFormat_options;\nclass ListFormatPonyFill {\n formatToParts(members) {\n const parts = [];\n for (const value of members) {\n parts.push({ type: 'element', value });\n parts.push({ type: 'literal', value: ', ' });\n }\n return parts.slice(0, -1);\n }\n}\nconst ListFormat = (typeof Intl !== 'undefined' && Intl.ListFormat) || ListFormatPonyFill;\nconst partsTable = [\n ['years', 'year'],\n ['months', 'month'],\n ['weeks', 'week'],\n ['days', 'day'],\n ['hours', 'hour'],\n ['minutes', 'minute'],\n ['seconds', 'second'],\n ['milliseconds', 'millisecond'],\n];\nconst twoDigitFormatOptions = { minimumIntegerDigits: 2 };\nexport default class DurationFormat {\n constructor(locale, options = {}) {\n _DurationFormat_options.set(this, void 0);\n let style = String(options.style || 'short');\n if (style !== 'long' && style !== 'short' && style !== 'narrow' && style !== 'digital')\n style = 'short';\n let prevStyle = style === 'digital' ? 'numeric' : style;\n const hours = options.hours || prevStyle;\n prevStyle = hours === '2-digit' ? 'numeric' : hours;\n const minutes = options.minutes || prevStyle;\n prevStyle = minutes === '2-digit' ? 'numeric' : minutes;\n const seconds = options.seconds || prevStyle;\n prevStyle = seconds === '2-digit' ? 'numeric' : seconds;\n const milliseconds = options.milliseconds || prevStyle;\n __classPrivateFieldSet(this, _DurationFormat_options, {\n locale,\n style,\n years: options.years || style === 'digital' ? 'short' : style,\n yearsDisplay: options.yearsDisplay === 'always' ? 'always' : 'auto',\n months: options.months || style === 'digital' ? 'short' : style,\n monthsDisplay: options.monthsDisplay === 'always' ? 'always' : 'auto',\n weeks: options.weeks || style === 'digital' ? 'short' : style,\n weeksDisplay: options.weeksDisplay === 'always' ? 'always' : 'auto',\n days: options.days || style === 'digital' ? 'short' : style,\n daysDisplay: options.daysDisplay === 'always' ? 'always' : 'auto',\n hours,\n hoursDisplay: options.hoursDisplay === 'always' ? 'always' : style === 'digital' ? 'always' : 'auto',\n minutes,\n minutesDisplay: options.minutesDisplay === 'always' ? 'always' : style === 'digital' ? 'always' : 'auto',\n seconds,\n secondsDisplay: options.secondsDisplay === 'always' ? 'always' : style === 'digital' ? 'always' : 'auto',\n milliseconds,\n millisecondsDisplay: options.millisecondsDisplay === 'always' ? 'always' : 'auto',\n }, \"f\");\n }\n resolvedOptions() {\n return __classPrivateFieldGet(this, _DurationFormat_options, \"f\");\n }\n formatToParts(duration) {\n const list = [];\n const options = __classPrivateFieldGet(this, _DurationFormat_options, \"f\");\n const style = options.style;\n const locale = options.locale;\n for (const [unit, nfUnit] of partsTable) {\n const value = duration[unit];\n if (options[`${unit}Display`] === 'auto' && !value)\n continue;\n const unitStyle = options[unit];\n const nfOpts = unitStyle === '2-digit'\n ? twoDigitFormatOptions\n : unitStyle === 'numeric'\n ? {}\n : { style: 'unit', unit: nfUnit, unitDisplay: unitStyle };\n let formattedValue = new Intl.NumberFormat(locale, nfOpts).format(value);\n if (unit === 'months' && (unitStyle === 'narrow' || (style === 'narrow' && formattedValue.endsWith('m')))) {\n formattedValue = formattedValue.replace(/(\\d+)m$/, '$1mo');\n }\n list.push(formattedValue);\n }\n return new ListFormat(locale, {\n type: 'unit',\n style: style === 'digital' ? 'short' : style,\n }).formatToParts(list);\n }\n format(duration) {\n return this.formatToParts(duration)\n .map(p => p.value)\n .join('');\n }\n}\n_DurationFormat_options = new WeakMap();\n","import DurationFormat from './duration-format-ponyfill.js';\nconst durationRe = /^[-+]?P(?:(\\d+)Y)?(?:(\\d+)M)?(?:(\\d+)W)?(?:(\\d+)D)?(?:T(?:(\\d+)H)?(?:(\\d+)M)?(?:(\\d+)S)?)?$/;\nexport const unitNames = ['year', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond'];\nexport const isDuration = (str) => durationRe.test(str);\nexport class Duration {\n constructor(years = 0, months = 0, weeks = 0, days = 0, hours = 0, minutes = 0, seconds = 0, milliseconds = 0) {\n this.years = years;\n this.months = months;\n this.weeks = weeks;\n this.days = days;\n this.hours = hours;\n this.minutes = minutes;\n this.seconds = seconds;\n this.milliseconds = milliseconds;\n this.years || (this.years = 0);\n this.sign || (this.sign = Math.sign(this.years));\n this.months || (this.months = 0);\n this.sign || (this.sign = Math.sign(this.months));\n this.weeks || (this.weeks = 0);\n this.sign || (this.sign = Math.sign(this.weeks));\n this.days || (this.days = 0);\n this.sign || (this.sign = Math.sign(this.days));\n this.hours || (this.hours = 0);\n this.sign || (this.sign = Math.sign(this.hours));\n this.minutes || (this.minutes = 0);\n this.sign || (this.sign = Math.sign(this.minutes));\n this.seconds || (this.seconds = 0);\n this.sign || (this.sign = Math.sign(this.seconds));\n this.milliseconds || (this.milliseconds = 0);\n this.sign || (this.sign = Math.sign(this.milliseconds));\n this.blank = this.sign === 0;\n }\n abs() {\n return new Duration(Math.abs(this.years), Math.abs(this.months), Math.abs(this.weeks), Math.abs(this.days), Math.abs(this.hours), Math.abs(this.minutes), Math.abs(this.seconds), Math.abs(this.milliseconds));\n }\n static from(durationLike) {\n var _a;\n if (typeof durationLike === 'string') {\n const str = String(durationLike).trim();\n const factor = str.startsWith('-') ? -1 : 1;\n const parsed = (_a = str\n .match(durationRe)) === null || _a === void 0 ? void 0 : _a.slice(1).map(x => (Number(x) || 0) * factor);\n if (!parsed)\n return new Duration();\n return new Duration(...parsed);\n }\n else if (typeof durationLike === 'object') {\n const { years, months, weeks, days, hours, minutes, seconds, milliseconds } = durationLike;\n return new Duration(years, months, weeks, days, hours, minutes, seconds, milliseconds);\n }\n throw new RangeError('invalid duration');\n }\n static compare(one, two) {\n const now = Date.now();\n const oneApplied = Math.abs(applyDuration(now, Duration.from(one)).getTime() - now);\n const twoApplied = Math.abs(applyDuration(now, Duration.from(two)).getTime() - now);\n return oneApplied > twoApplied ? -1 : oneApplied < twoApplied ? 1 : 0;\n }\n toLocaleString(locale, opts) {\n return new DurationFormat(locale, opts).format(this);\n }\n}\nexport function applyDuration(date, duration) {\n const r = new Date(date);\n if (duration.sign < 0) {\n r.setUTCSeconds(r.getUTCSeconds() + duration.seconds);\n r.setUTCMinutes(r.getUTCMinutes() + duration.minutes);\n r.setUTCHours(r.getUTCHours() + duration.hours);\n r.setUTCDate(r.getUTCDate() + duration.weeks * 7 + duration.days);\n r.setUTCMonth(r.getUTCMonth() + duration.months);\n r.setUTCFullYear(r.getUTCFullYear() + duration.years);\n }\n else {\n r.setUTCFullYear(r.getUTCFullYear() + duration.years);\n r.setUTCMonth(r.getUTCMonth() + duration.months);\n r.setUTCDate(r.getUTCDate() + duration.weeks * 7 + duration.days);\n r.setUTCHours(r.getUTCHours() + duration.hours);\n r.setUTCMinutes(r.getUTCMinutes() + duration.minutes);\n r.setUTCSeconds(r.getUTCSeconds() + duration.seconds);\n }\n return r;\n}\nexport function elapsedTime(date, precision = 'second', now = Date.now()) {\n const delta = date.getTime() - now;\n if (delta === 0)\n return new Duration();\n const sign = Math.sign(delta);\n const ms = Math.abs(delta);\n const sec = Math.floor(ms / 1000);\n const min = Math.floor(sec / 60);\n const hr = Math.floor(min / 60);\n const day = Math.floor(hr / 24);\n const month = Math.floor(day / 30);\n const year = Math.floor(month / 12);\n const i = unitNames.indexOf(precision) || unitNames.length;\n return new Duration(i >= 0 ? year * sign : 0, i >= 1 ? (month - year * 12) * sign : 0, 0, i >= 3 ? (day - month * 30) * sign : 0, i >= 4 ? (hr - day * 24) * sign : 0, i >= 5 ? (min - hr * 60) * sign : 0, i >= 6 ? (sec - min * 60) * sign : 0, i >= 7 ? (ms - sec * 1000) * sign : 0);\n}\nexport function roundToSingleUnit(duration, { relativeTo = Date.now() } = {}) {\n relativeTo = new Date(relativeTo);\n if (duration.blank)\n return duration;\n const sign = duration.sign;\n let years = Math.abs(duration.years);\n let months = Math.abs(duration.months);\n let weeks = Math.abs(duration.weeks);\n let days = Math.abs(duration.days);\n let hours = Math.abs(duration.hours);\n let minutes = Math.abs(duration.minutes);\n let seconds = Math.abs(duration.seconds);\n let milliseconds = Math.abs(duration.milliseconds);\n if (milliseconds >= 900)\n seconds += Math.round(milliseconds / 1000);\n if (seconds || minutes || hours || days || weeks || months || years) {\n milliseconds = 0;\n }\n if (seconds >= 55)\n minutes += Math.round(seconds / 60);\n if (minutes || hours || days || weeks || months || years)\n seconds = 0;\n if (minutes >= 55)\n hours += Math.round(minutes / 60);\n if (hours || days || weeks || months || years)\n minutes = 0;\n if (days && hours >= 12)\n days += Math.round(hours / 24);\n if (!days && hours >= 21)\n days += Math.round(hours / 24);\n if (days || weeks || months || years)\n hours = 0;\n const currentYear = relativeTo.getFullYear();\n const currentMonth = relativeTo.getMonth();\n const currentDate = relativeTo.getDate();\n if (days >= 27 || years + months + days) {\n const newMonthDate = new Date(relativeTo);\n newMonthDate.setDate(1);\n newMonthDate.setMonth(currentMonth + months * sign + 1);\n newMonthDate.setDate(0);\n const monthDateCorrection = Math.max(0, currentDate - newMonthDate.getDate());\n const newDate = new Date(relativeTo);\n newDate.setFullYear(currentYear + years * sign);\n newDate.setDate(currentDate - monthDateCorrection);\n newDate.setMonth(currentMonth + months * sign);\n newDate.setDate(currentDate - monthDateCorrection + days * sign);\n const yearDiff = newDate.getFullYear() - relativeTo.getFullYear();\n const monthDiff = newDate.getMonth() - relativeTo.getMonth();\n const daysDiff = Math.abs(Math.round((Number(newDate) - Number(relativeTo)) / 86400000)) + monthDateCorrection;\n const monthsDiff = Math.abs(yearDiff * 12 + monthDiff);\n if (daysDiff < 27) {\n if (days >= 6) {\n weeks += Math.round(days / 7);\n days = 0;\n }\n else {\n days = daysDiff;\n }\n months = years = 0;\n }\n else if (monthsDiff <= 11) {\n months = monthsDiff;\n years = 0;\n }\n else {\n months = 0;\n years = yearDiff * sign;\n }\n if (months || years)\n days = 0;\n }\n if (years)\n months = 0;\n if (weeks >= 4)\n months += Math.round(weeks / 4);\n if (months || years)\n weeks = 0;\n if (days && weeks && !months && !years) {\n weeks += Math.round(days / 7);\n days = 0;\n }\n return new Duration(years * sign, months * sign, weeks * sign, days * sign, hours * sign, minutes * sign, seconds * sign, milliseconds * sign);\n}\nexport function getRelativeTimeUnit(duration, opts) {\n const rounded = roundToSingleUnit(duration, opts);\n if (rounded.blank)\n return [0, 'second'];\n for (const unit of unitNames) {\n if (unit === 'millisecond')\n continue;\n const val = rounded[`${unit}s`];\n if (val)\n return [val, unit];\n }\n return [0, 'second'];\n}\n","var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n};\nvar _RelativeTimeElement_instances, _RelativeTimeElement_customTitle, _RelativeTimeElement_updating, _RelativeTimeElement_lang_get, _RelativeTimeElement_renderRoot, _RelativeTimeElement_getFormattedTitle, _RelativeTimeElement_resolveFormat, _RelativeTimeElement_getDurationFormat, _RelativeTimeElement_getRelativeFormat, _RelativeTimeElement_getDateTimeFormat, _RelativeTimeElement_isToday, _RelativeTimeElement_isCurrentYear, _RelativeTimeElement_getUserPreferredAbsoluteTimeFormat, _RelativeTimeElement_updateRenderRootContent, _RelativeTimeElement_shouldDisplayUserPreferredAbsoluteTime, _RelativeTimeElement_onRelativeTimeUpdated;\nimport { Duration, elapsedTime, getRelativeTimeUnit, isDuration, roundToSingleUnit, unitNames } from './duration.js';\nconst HTMLElement = globalThis.HTMLElement || null;\nconst emptyDuration = new Duration();\nconst microEmptyDuration = new Duration(0, 0, 0, 0, 0, 1);\nexport class RelativeTimeUpdatedEvent extends Event {\n constructor(oldText, newText, oldTitle, newTitle) {\n super('relative-time-updated', { bubbles: true, composed: true });\n this.oldText = oldText;\n this.newText = newText;\n this.oldTitle = oldTitle;\n this.newTitle = newTitle;\n }\n}\nfunction getUnitFactor(el) {\n if (!el.date)\n return Infinity;\n if (el.format === 'duration' || el.format === 'elapsed') {\n const precision = el.precision;\n if (precision === 'second') {\n return 1000;\n }\n else if (precision === 'minute') {\n return 60 * 1000;\n }\n }\n const ms = Math.abs(Date.now() - el.date.getTime());\n if (ms < 60 * 1000)\n return 1000;\n if (ms < 60 * 60 * 1000)\n return 60 * 1000;\n return 60 * 60 * 1000;\n}\nconst dateObserver = new (class {\n constructor() {\n this.elements = new Set();\n this.time = Infinity;\n this.timer = -1;\n }\n observe(element) {\n if (this.elements.has(element))\n return;\n this.elements.add(element);\n const date = element.date;\n if (date && date.getTime()) {\n const ms = getUnitFactor(element);\n const time = Date.now() + ms;\n if (time < this.time) {\n clearTimeout(this.timer);\n this.timer = setTimeout(() => this.update(), ms);\n this.time = time;\n }\n }\n }\n unobserve(element) {\n if (!this.elements.has(element))\n return;\n this.elements.delete(element);\n }\n update() {\n clearTimeout(this.timer);\n if (!this.elements.size)\n return;\n let nearestDistance = Infinity;\n for (const timeEl of this.elements) {\n nearestDistance = Math.min(nearestDistance, getUnitFactor(timeEl));\n timeEl.update();\n }\n this.time = Math.min(60 * 60 * 1000, nearestDistance);\n this.timer = setTimeout(() => this.update(), this.time);\n this.time += Date.now();\n }\n})();\nexport class RelativeTimeElement extends HTMLElement {\n constructor() {\n super(...arguments);\n _RelativeTimeElement_instances.add(this);\n _RelativeTimeElement_customTitle.set(this, false);\n _RelativeTimeElement_updating.set(this, false);\n _RelativeTimeElement_renderRoot.set(this, this.shadowRoot ? this.shadowRoot : this.attachShadow ? this.attachShadow({ mode: 'open' }) : this);\n _RelativeTimeElement_onRelativeTimeUpdated.set(this, null);\n }\n static define(tag = 'relative-time', registry = customElements) {\n registry.define(tag, this);\n return this;\n }\n get timeZone() {\n var _a;\n const tz = ((_a = this.closest('[time-zone]')) === null || _a === void 0 ? void 0 : _a.getAttribute('time-zone')) ||\n this.ownerDocument.documentElement.getAttribute('time-zone');\n return tz || undefined;\n }\n static get observedAttributes() {\n return [\n 'second',\n 'minute',\n 'hour',\n 'weekday',\n 'day',\n 'month',\n 'year',\n 'time-zone-name',\n 'prefix',\n 'threshold',\n 'tense',\n 'precision',\n 'format',\n 'format-style',\n 'no-title',\n 'datetime',\n 'lang',\n 'title',\n 'aria-hidden',\n 'time-zone',\n ];\n }\n get onRelativeTimeUpdated() {\n return __classPrivateFieldGet(this, _RelativeTimeElement_onRelativeTimeUpdated, \"f\");\n }\n set onRelativeTimeUpdated(listener) {\n if (__classPrivateFieldGet(this, _RelativeTimeElement_onRelativeTimeUpdated, \"f\")) {\n this.removeEventListener('relative-time-updated', __classPrivateFieldGet(this, _RelativeTimeElement_onRelativeTimeUpdated, \"f\"));\n }\n __classPrivateFieldSet(this, _RelativeTimeElement_onRelativeTimeUpdated, typeof listener === 'object' || typeof listener === 'function' ? listener : null, \"f\");\n if (typeof listener === 'function') {\n this.addEventListener('relative-time-updated', listener);\n }\n }\n get second() {\n const second = this.getAttribute('second');\n if (second === 'numeric' || second === '2-digit')\n return second;\n }\n set second(value) {\n this.setAttribute('second', value || '');\n }\n get minute() {\n const minute = this.getAttribute('minute');\n if (minute === 'numeric' || minute === '2-digit')\n return minute;\n }\n set minute(value) {\n this.setAttribute('minute', value || '');\n }\n get hour() {\n const hour = this.getAttribute('hour');\n if (hour === 'numeric' || hour === '2-digit')\n return hour;\n }\n set hour(value) {\n this.setAttribute('hour', value || '');\n }\n get weekday() {\n const weekday = this.getAttribute('weekday');\n if (weekday === 'long' || weekday === 'short' || weekday === 'narrow') {\n return weekday;\n }\n if (this.format === 'datetime' && weekday !== '')\n return this.formatStyle;\n }\n set weekday(value) {\n this.setAttribute('weekday', value || '');\n }\n get day() {\n var _a;\n const day = (_a = this.getAttribute('day')) !== null && _a !== void 0 ? _a : 'numeric';\n if (day === 'numeric' || day === '2-digit')\n return day;\n }\n set day(value) {\n this.setAttribute('day', value || '');\n }\n get month() {\n const format = this.format;\n let month = this.getAttribute('month');\n if (month === '')\n return;\n month !== null && month !== void 0 ? month : (month = format === 'datetime' ? this.formatStyle : 'short');\n if (month === 'numeric' || month === '2-digit' || month === 'short' || month === 'long' || month === 'narrow') {\n return month;\n }\n }\n set month(value) {\n this.setAttribute('month', value || '');\n }\n get year() {\n var _a;\n const year = this.getAttribute('year');\n if (year === 'numeric' || year === '2-digit')\n return year;\n if (!this.hasAttribute('year') && new Date().getUTCFullYear() !== ((_a = this.date) === null || _a === void 0 ? void 0 : _a.getUTCFullYear())) {\n return 'numeric';\n }\n }\n set year(value) {\n this.setAttribute('year', value || '');\n }\n get timeZoneName() {\n const name = this.getAttribute('time-zone-name');\n if (name === 'long' ||\n name === 'short' ||\n name === 'shortOffset' ||\n name === 'longOffset' ||\n name === 'shortGeneric' ||\n name === 'longGeneric') {\n return name;\n }\n }\n set timeZoneName(value) {\n this.setAttribute('time-zone-name', value || '');\n }\n get prefix() {\n var _a;\n return (_a = this.getAttribute('prefix')) !== null && _a !== void 0 ? _a : (this.format === 'datetime' ? '' : 'on');\n }\n set prefix(value) {\n this.setAttribute('prefix', value);\n }\n get threshold() {\n const threshold = this.getAttribute('threshold');\n return threshold && isDuration(threshold) ? threshold : 'P30D';\n }\n set threshold(value) {\n this.setAttribute('threshold', value);\n }\n get tense() {\n const tense = this.getAttribute('tense');\n if (tense === 'past')\n return 'past';\n if (tense === 'future')\n return 'future';\n return 'auto';\n }\n set tense(value) {\n this.setAttribute('tense', value);\n }\n get precision() {\n const precision = this.getAttribute('precision');\n if (unitNames.includes(precision))\n return precision;\n if (this.format === 'micro')\n return 'minute';\n return 'second';\n }\n set precision(value) {\n this.setAttribute('precision', value);\n }\n get format() {\n const format = this.getAttribute('format');\n if (format === 'datetime')\n return 'datetime';\n if (format === 'relative')\n return 'relative';\n if (format === 'duration')\n return 'duration';\n if (format === 'micro')\n return 'micro';\n if (format === 'elapsed')\n return 'elapsed';\n return 'auto';\n }\n set format(value) {\n this.setAttribute('format', value);\n }\n get formatStyle() {\n const formatStyle = this.getAttribute('format-style');\n if (formatStyle === 'long')\n return 'long';\n if (formatStyle === 'short')\n return 'short';\n if (formatStyle === 'narrow')\n return 'narrow';\n const format = this.format;\n if (format === 'elapsed' || format === 'micro')\n return 'narrow';\n if (format === 'datetime')\n return 'short';\n return 'long';\n }\n set formatStyle(value) {\n this.setAttribute('format-style', value);\n }\n get noTitle() {\n return this.hasAttribute('no-title');\n }\n set noTitle(value) {\n this.toggleAttribute('no-title', value);\n }\n get datetime() {\n return this.getAttribute('datetime') || '';\n }\n set datetime(value) {\n this.setAttribute('datetime', value);\n }\n get date() {\n const parsed = Date.parse(this.datetime);\n return Number.isNaN(parsed) ? null : new Date(parsed);\n }\n set date(value) {\n this.datetime = (value === null || value === void 0 ? void 0 : value.toISOString()) || '';\n }\n connectedCallback() {\n this.update();\n }\n disconnectedCallback() {\n dateObserver.unobserve(this);\n }\n attributeChangedCallback(attrName, oldValue, newValue) {\n if (oldValue === newValue)\n return;\n if (attrName === 'title') {\n __classPrivateFieldSet(this, _RelativeTimeElement_customTitle, newValue !== null && (this.date && __classPrivateFieldGet(this, _RelativeTimeElement_instances, \"m\", _RelativeTimeElement_getFormattedTitle).call(this, this.date)) !== newValue, \"f\");\n }\n if (!__classPrivateFieldGet(this, _RelativeTimeElement_updating, \"f\") && !(attrName === 'title' && __classPrivateFieldGet(this, _RelativeTimeElement_customTitle, \"f\"))) {\n __classPrivateFieldSet(this, _RelativeTimeElement_updating, (async () => {\n await Promise.resolve();\n this.update();\n __classPrivateFieldSet(this, _RelativeTimeElement_updating, false, \"f\");\n })(), \"f\");\n }\n }\n update() {\n const oldText = __classPrivateFieldGet(this, _RelativeTimeElement_renderRoot, \"f\").textContent || this.textContent || '';\n const oldTitle = this.getAttribute('title') || '';\n let newTitle = oldTitle;\n const date = this.date;\n if (typeof Intl === 'undefined' || !Intl.DateTimeFormat || !date) {\n __classPrivateFieldGet(this, _RelativeTimeElement_renderRoot, \"f\").textContent = oldText;\n return;\n }\n const now = Date.now();\n if (!__classPrivateFieldGet(this, _RelativeTimeElement_customTitle, \"f\")) {\n newTitle = __classPrivateFieldGet(this, _RelativeTimeElement_instances, \"m\", _RelativeTimeElement_getFormattedTitle).call(this, date) || '';\n if (newTitle && !this.noTitle)\n this.setAttribute('title', newTitle);\n }\n const duration = elapsedTime(date, this.precision, now);\n const format = __classPrivateFieldGet(this, _RelativeTimeElement_instances, \"m\", _RelativeTimeElement_resolveFormat).call(this, duration);\n let newText = oldText;\n const displayUserPreferredAbsoluteTime = __classPrivateFieldGet(this, _RelativeTimeElement_instances, \"m\", _RelativeTimeElement_shouldDisplayUserPreferredAbsoluteTime).call(this, format);\n if (displayUserPreferredAbsoluteTime) {\n newText = __classPrivateFieldGet(this, _RelativeTimeElement_instances, \"m\", _RelativeTimeElement_getUserPreferredAbsoluteTimeFormat).call(this, date);\n }\n else {\n if (format === 'duration') {\n newText = __classPrivateFieldGet(this, _RelativeTimeElement_instances, \"m\", _RelativeTimeElement_getDurationFormat).call(this, duration);\n }\n else if (format === 'relative') {\n newText = __classPrivateFieldGet(this, _RelativeTimeElement_instances, \"m\", _RelativeTimeElement_getRelativeFormat).call(this, duration);\n }\n else {\n newText = __classPrivateFieldGet(this, _RelativeTimeElement_instances, \"m\", _RelativeTimeElement_getDateTimeFormat).call(this, date);\n }\n }\n if (newText) {\n __classPrivateFieldGet(this, _RelativeTimeElement_instances, \"m\", _RelativeTimeElement_updateRenderRootContent).call(this, newText);\n }\n else if (this.shadowRoot === __classPrivateFieldGet(this, _RelativeTimeElement_renderRoot, \"f\") && this.textContent) {\n __classPrivateFieldGet(this, _RelativeTimeElement_instances, \"m\", _RelativeTimeElement_updateRenderRootContent).call(this, this.textContent);\n }\n if (newText !== oldText || newTitle !== oldTitle) {\n this.dispatchEvent(new RelativeTimeUpdatedEvent(oldText, newText, oldTitle, newTitle));\n }\n const shouldObserve = format === 'relative' ||\n format === 'duration' ||\n (displayUserPreferredAbsoluteTime && (__classPrivateFieldGet(this, _RelativeTimeElement_instances, \"m\", _RelativeTimeElement_isToday).call(this, date) || __classPrivateFieldGet(this, _RelativeTimeElement_instances, \"m\", _RelativeTimeElement_isCurrentYear).call(this, date)));\n if (shouldObserve) {\n dateObserver.observe(this);\n }\n else {\n dateObserver.unobserve(this);\n }\n }\n}\n_RelativeTimeElement_customTitle = new WeakMap(), _RelativeTimeElement_updating = new WeakMap(), _RelativeTimeElement_renderRoot = new WeakMap(), _RelativeTimeElement_onRelativeTimeUpdated = new WeakMap(), _RelativeTimeElement_instances = new WeakSet(), _RelativeTimeElement_lang_get = function _RelativeTimeElement_lang_get() {\n var _a;\n const lang = ((_a = this.closest('[lang]')) === null || _a === void 0 ? void 0 : _a.getAttribute('lang')) || this.ownerDocument.documentElement.getAttribute('lang');\n try {\n return new Intl.Locale(lang !== null && lang !== void 0 ? lang : '').toString();\n }\n catch (_b) {\n return 'default';\n }\n}, _RelativeTimeElement_getFormattedTitle = function _RelativeTimeElement_getFormattedTitle(date) {\n return new Intl.DateTimeFormat(__classPrivateFieldGet(this, _RelativeTimeElement_instances, \"a\", _RelativeTimeElement_lang_get), {\n day: 'numeric',\n month: 'short',\n year: 'numeric',\n hour: 'numeric',\n minute: '2-digit',\n timeZoneName: 'short',\n timeZone: this.timeZone,\n }).format(date);\n}, _RelativeTimeElement_resolveFormat = function _RelativeTimeElement_resolveFormat(duration) {\n const format = this.format;\n if (format === 'datetime')\n return 'datetime';\n if (format === 'duration')\n return 'duration';\n if (format === 'elapsed')\n return 'duration';\n if (format === 'micro')\n return 'duration';\n if ((format === 'auto' || format === 'relative') && typeof Intl !== 'undefined' && Intl.RelativeTimeFormat) {\n const tense = this.tense;\n if (tense === 'past' || tense === 'future')\n return 'relative';\n if (Duration.compare(duration, this.threshold) === 1)\n return 'relative';\n }\n return 'datetime';\n}, _RelativeTimeElement_getDurationFormat = function _RelativeTimeElement_getDurationFormat(duration) {\n const locale = __classPrivateFieldGet(this, _RelativeTimeElement_instances, \"a\", _RelativeTimeElement_lang_get);\n const format = this.format;\n const style = this.formatStyle;\n const tense = this.tense;\n let empty = emptyDuration;\n if (format === 'micro') {\n duration = roundToSingleUnit(duration);\n empty = microEmptyDuration;\n if (duration.months === 0 &&\n ((this.tense === 'past' && duration.sign !== -1) || (this.tense === 'future' && duration.sign !== 1))) {\n duration = microEmptyDuration;\n }\n }\n else if ((tense === 'past' && duration.sign !== -1) || (tense === 'future' && duration.sign !== 1)) {\n duration = empty;\n }\n const display = `${this.precision}sDisplay`;\n if (duration.blank) {\n return empty.toLocaleString(locale, { style, [display]: 'always' });\n }\n return duration.abs().toLocaleString(locale, { style });\n}, _RelativeTimeElement_getRelativeFormat = function _RelativeTimeElement_getRelativeFormat(duration) {\n const relativeFormat = new Intl.RelativeTimeFormat(__classPrivateFieldGet(this, _RelativeTimeElement_instances, \"a\", _RelativeTimeElement_lang_get), {\n numeric: 'auto',\n style: this.formatStyle,\n });\n const tense = this.tense;\n if (tense === 'future' && duration.sign !== 1)\n duration = emptyDuration;\n if (tense === 'past' && duration.sign !== -1)\n duration = emptyDuration;\n const [int, unit] = getRelativeTimeUnit(duration);\n if (unit === 'second' && int < 10) {\n return relativeFormat.format(0, this.precision === 'millisecond' ? 'second' : this.precision);\n }\n return relativeFormat.format(int, unit);\n}, _RelativeTimeElement_getDateTimeFormat = function _RelativeTimeElement_getDateTimeFormat(date) {\n const formatter = new Intl.DateTimeFormat(__classPrivateFieldGet(this, _RelativeTimeElement_instances, \"a\", _RelativeTimeElement_lang_get), {\n second: this.second,\n minute: this.minute,\n hour: this.hour,\n weekday: this.weekday,\n day: this.day,\n month: this.month,\n year: this.year,\n timeZoneName: this.timeZoneName,\n timeZone: this.timeZone,\n });\n return `${this.prefix} ${formatter.format(date)}`.trim();\n}, _RelativeTimeElement_isToday = function _RelativeTimeElement_isToday(date) {\n const now = new Date();\n const formatter = new Intl.DateTimeFormat(__classPrivateFieldGet(this, _RelativeTimeElement_instances, \"a\", _RelativeTimeElement_lang_get), {\n timeZone: this.timeZone,\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n });\n return formatter.format(now) === formatter.format(date);\n}, _RelativeTimeElement_isCurrentYear = function _RelativeTimeElement_isCurrentYear(date) {\n const now = new Date();\n const formatter = new Intl.DateTimeFormat(__classPrivateFieldGet(this, _RelativeTimeElement_instances, \"a\", _RelativeTimeElement_lang_get), {\n timeZone: this.timeZone,\n year: 'numeric',\n });\n return formatter.format(now) === formatter.format(date);\n}, _RelativeTimeElement_getUserPreferredAbsoluteTimeFormat = function _RelativeTimeElement_getUserPreferredAbsoluteTimeFormat(date) {\n const timeOnlyOptions = {\n hour: 'numeric',\n minute: '2-digit',\n timeZoneName: 'short',\n timeZone: this.timeZone,\n };\n if (__classPrivateFieldGet(this, _RelativeTimeElement_instances, \"m\", _RelativeTimeElement_isToday).call(this, date)) {\n const relativeFormatter = new Intl.RelativeTimeFormat(__classPrivateFieldGet(this, _RelativeTimeElement_instances, \"a\", _RelativeTimeElement_lang_get), { numeric: 'auto' });\n let todayText = relativeFormatter.format(0, 'day');\n todayText = todayText.charAt(0).toLocaleUpperCase(__classPrivateFieldGet(this, _RelativeTimeElement_instances, \"a\", _RelativeTimeElement_lang_get)) + todayText.slice(1);\n const timeOnly = new Intl.DateTimeFormat(__classPrivateFieldGet(this, _RelativeTimeElement_instances, \"a\", _RelativeTimeElement_lang_get), timeOnlyOptions).format(date);\n return `${todayText} ${timeOnly}`;\n }\n const timeAndDateOptions = Object.assign(Object.assign({}, timeOnlyOptions), { day: 'numeric', month: 'short' });\n if (__classPrivateFieldGet(this, _RelativeTimeElement_instances, \"m\", _RelativeTimeElement_isCurrentYear).call(this, date)) {\n return new Intl.DateTimeFormat(__classPrivateFieldGet(this, _RelativeTimeElement_instances, \"a\", _RelativeTimeElement_lang_get), timeAndDateOptions).format(date);\n }\n return new Intl.DateTimeFormat(__classPrivateFieldGet(this, _RelativeTimeElement_instances, \"a\", _RelativeTimeElement_lang_get), Object.assign(Object.assign({}, timeAndDateOptions), { year: 'numeric' })).format(date);\n}, _RelativeTimeElement_updateRenderRootContent = function _RelativeTimeElement_updateRenderRootContent(content) {\n if (this.hasAttribute('aria-hidden') && this.getAttribute('aria-hidden') === 'true') {\n const span = document.createElement('span');\n span.setAttribute('aria-hidden', 'true');\n span.textContent = content;\n __classPrivateFieldGet(this, _RelativeTimeElement_renderRoot, \"f\").replaceChildren(span);\n }\n else {\n __classPrivateFieldGet(this, _RelativeTimeElement_renderRoot, \"f\").textContent = content;\n }\n}, _RelativeTimeElement_shouldDisplayUserPreferredAbsoluteTime = function _RelativeTimeElement_shouldDisplayUserPreferredAbsoluteTime(format) {\n var _a;\n if (format === 'duration')\n return false;\n return (this.ownerDocument.documentElement.getAttribute('data-prefers-absolute-time') === 'true' ||\n ((_a = this.ownerDocument.body) === null || _a === void 0 ? void 0 : _a.getAttribute('data-prefers-absolute-time')) === 'true');\n};\nexport default RelativeTimeElement;\n","import { RelativeTimeElement } from './relative-time-element.js';\nconst root = (typeof globalThis !== 'undefined' ? globalThis : window);\ntry {\n root.RelativeTimeElement = RelativeTimeElement.define();\n}\ncatch (e) {\n if (!(root.DOMException && e instanceof DOMException && e.name === 'NotSupportedError') &&\n !(e instanceof ReferenceError)) {\n throw e;\n }\n}\nexport default RelativeTimeElement;\nexport * from './relative-time-element.js';\n","export default function ascending(a, b) {\n return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n","export default function descending(a, b) {\n return a == null || b == null ? NaN\n : b < a ? -1\n : b > a ? 1\n : b >= a ? 0\n : NaN;\n}\n","import ascending from \"./ascending.js\";\nimport descending from \"./descending.js\";\n\nexport default function bisector(f) {\n let compare1, compare2, delta;\n\n // If an accessor is specified, promote it to a comparator. In this case we\n // can test whether the search value is (self-) comparable. We can’t do this\n // for a comparator (except for specific, known comparators) because we can’t\n // tell if the comparator is symmetric, and an asymmetric comparator can’t be\n // used to test whether a single value is comparable.\n if (f.length !== 2) {\n compare1 = ascending;\n compare2 = (d, x) => ascending(f(d), x);\n delta = (d, x) => f(d) - x;\n } else {\n compare1 = f === ascending || f === descending ? f : zero;\n compare2 = f;\n delta = f;\n }\n\n function left(a, x, lo = 0, hi = a.length) {\n if (lo < hi) {\n if (compare1(x, x) !== 0) return hi;\n do {\n const mid = (lo + hi) >>> 1;\n if (compare2(a[mid], x) < 0) lo = mid + 1;\n else hi = mid;\n } while (lo < hi);\n }\n return lo;\n }\n\n function right(a, x, lo = 0, hi = a.length) {\n if (lo < hi) {\n if (compare1(x, x) !== 0) return hi;\n do {\n const mid = (lo + hi) >>> 1;\n if (compare2(a[mid], x) <= 0) lo = mid + 1;\n else hi = mid;\n } while (lo < hi);\n }\n return lo;\n }\n\n function center(a, x, lo = 0, hi = a.length) {\n const i = left(a, x, lo, hi - 1);\n return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;\n }\n\n return {left, center, right};\n}\n\nfunction zero() {\n return 0;\n}\n","export default function number(x) {\n return x === null ? NaN : +x;\n}\n\nexport function* numbers(values, valueof) {\n if (valueof === undefined) {\n for (let value of values) {\n if (value != null && (value = +value) >= value) {\n yield value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {\n yield value;\n }\n }\n }\n}\n","import ascending from \"./ascending.js\";\nimport bisector from \"./bisector.js\";\nimport number from \"./number.js\";\n\nconst ascendingBisect = bisector(ascending);\nexport const bisectRight = ascendingBisect.right;\nexport const bisectLeft = ascendingBisect.left;\nexport const bisectCenter = bisector(number).center;\nexport default bisectRight;\n","const e10 = Math.sqrt(50),\n e5 = Math.sqrt(10),\n e2 = Math.sqrt(2);\n\nfunction tickSpec(start, stop, count) {\n const step = (stop - start) / Math.max(0, count),\n power = Math.floor(Math.log10(step)),\n error = step / Math.pow(10, power),\n factor = error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1;\n let i1, i2, inc;\n if (power < 0) {\n inc = Math.pow(10, -power) / factor;\n i1 = Math.round(start * inc);\n i2 = Math.round(stop * inc);\n if (i1 / inc < start) ++i1;\n if (i2 / inc > stop) --i2;\n inc = -inc;\n } else {\n inc = Math.pow(10, power) * factor;\n i1 = Math.round(start / inc);\n i2 = Math.round(stop / inc);\n if (i1 * inc < start) ++i1;\n if (i2 * inc > stop) --i2;\n }\n if (i2 < i1 && 0.5 <= count && count < 2) return tickSpec(start, stop, count * 2);\n return [i1, i2, inc];\n}\n\nexport default function ticks(start, stop, count) {\n stop = +stop, start = +start, count = +count;\n if (!(count > 0)) return [];\n if (start === stop) return [start];\n const reverse = stop < start, [i1, i2, inc] = reverse ? tickSpec(stop, start, count) : tickSpec(start, stop, count);\n if (!(i2 >= i1)) return [];\n const n = i2 - i1 + 1, ticks = new Array(n);\n if (reverse) {\n if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) / -inc;\n else for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) * inc;\n } else {\n if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) / -inc;\n else for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) * inc;\n }\n return ticks;\n}\n\nexport function tickIncrement(start, stop, count) {\n stop = +stop, start = +start, count = +count;\n return tickSpec(start, stop, count)[2];\n}\n\nexport function tickStep(start, stop, count) {\n stop = +stop, start = +start, count = +count;\n const reverse = stop < start, inc = reverse ? tickIncrement(stop, start, count) : tickIncrement(start, stop, count);\n return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc);\n}\n","export function initRange(domain, range) {\n switch (arguments.length) {\n case 0: break;\n case 1: this.range(domain); break;\n default: this.range(range).domain(domain); break;\n }\n return this;\n}\n\nexport function initInterpolator(domain, interpolator) {\n switch (arguments.length) {\n case 0: break;\n case 1: {\n if (typeof domain === \"function\") this.interpolator(domain);\n else this.range(domain);\n break;\n }\n default: {\n this.domain(domain);\n if (typeof interpolator === \"function\") this.interpolator(interpolator);\n else this.range(interpolator);\n break;\n }\n }\n return this;\n}\n","export default function(constructor, factory, prototype) {\n constructor.prototype = factory.prototype = prototype;\n prototype.constructor = constructor;\n}\n\nexport function extend(parent, definition) {\n var prototype = Object.create(parent.prototype);\n for (var key in definition) prototype[key] = definition[key];\n return prototype;\n}\n","import define, {extend} from \"./define.js\";\n\nexport function Color() {}\n\nexport var darker = 0.7;\nexport var brighter = 1 / darker;\n\nvar reI = \"\\\\s*([+-]?\\\\d+)\\\\s*\",\n reN = \"\\\\s*([+-]?(?:\\\\d*\\\\.)?\\\\d+(?:[eE][+-]?\\\\d+)?)\\\\s*\",\n reP = \"\\\\s*([+-]?(?:\\\\d*\\\\.)?\\\\d+(?:[eE][+-]?\\\\d+)?)%\\\\s*\",\n reHex = /^#([0-9a-f]{3,8})$/,\n reRgbInteger = new RegExp(`^rgb\\\\(${reI},${reI},${reI}\\\\)$`),\n reRgbPercent = new RegExp(`^rgb\\\\(${reP},${reP},${reP}\\\\)$`),\n reRgbaInteger = new RegExp(`^rgba\\\\(${reI},${reI},${reI},${reN}\\\\)$`),\n reRgbaPercent = new RegExp(`^rgba\\\\(${reP},${reP},${reP},${reN}\\\\)$`),\n reHslPercent = new RegExp(`^hsl\\\\(${reN},${reP},${reP}\\\\)$`),\n reHslaPercent = new RegExp(`^hsla\\\\(${reN},${reP},${reP},${reN}\\\\)$`);\n\nvar named = {\n aliceblue: 0xf0f8ff,\n antiquewhite: 0xfaebd7,\n aqua: 0x00ffff,\n aquamarine: 0x7fffd4,\n azure: 0xf0ffff,\n beige: 0xf5f5dc,\n bisque: 0xffe4c4,\n black: 0x000000,\n blanchedalmond: 0xffebcd,\n blue: 0x0000ff,\n blueviolet: 0x8a2be2,\n brown: 0xa52a2a,\n burlywood: 0xdeb887,\n cadetblue: 0x5f9ea0,\n chartreuse: 0x7fff00,\n chocolate: 0xd2691e,\n coral: 0xff7f50,\n cornflowerblue: 0x6495ed,\n cornsilk: 0xfff8dc,\n crimson: 0xdc143c,\n cyan: 0x00ffff,\n darkblue: 0x00008b,\n darkcyan: 0x008b8b,\n darkgoldenrod: 0xb8860b,\n darkgray: 0xa9a9a9,\n darkgreen: 0x006400,\n darkgrey: 0xa9a9a9,\n darkkhaki: 0xbdb76b,\n darkmagenta: 0x8b008b,\n darkolivegreen: 0x556b2f,\n darkorange: 0xff8c00,\n darkorchid: 0x9932cc,\n darkred: 0x8b0000,\n darksalmon: 0xe9967a,\n darkseagreen: 0x8fbc8f,\n darkslateblue: 0x483d8b,\n darkslategray: 0x2f4f4f,\n darkslategrey: 0x2f4f4f,\n darkturquoise: 0x00ced1,\n darkviolet: 0x9400d3,\n deeppink: 0xff1493,\n deepskyblue: 0x00bfff,\n dimgray: 0x696969,\n dimgrey: 0x696969,\n dodgerblue: 0x1e90ff,\n firebrick: 0xb22222,\n floralwhite: 0xfffaf0,\n forestgreen: 0x228b22,\n fuchsia: 0xff00ff,\n gainsboro: 0xdcdcdc,\n ghostwhite: 0xf8f8ff,\n gold: 0xffd700,\n goldenrod: 0xdaa520,\n gray: 0x808080,\n green: 0x008000,\n greenyellow: 0xadff2f,\n grey: 0x808080,\n honeydew: 0xf0fff0,\n hotpink: 0xff69b4,\n indianred: 0xcd5c5c,\n indigo: 0x4b0082,\n ivory: 0xfffff0,\n khaki: 0xf0e68c,\n lavender: 0xe6e6fa,\n lavenderblush: 0xfff0f5,\n lawngreen: 0x7cfc00,\n lemonchiffon: 0xfffacd,\n lightblue: 0xadd8e6,\n lightcoral: 0xf08080,\n lightcyan: 0xe0ffff,\n lightgoldenrodyellow: 0xfafad2,\n lightgray: 0xd3d3d3,\n lightgreen: 0x90ee90,\n lightgrey: 0xd3d3d3,\n lightpink: 0xffb6c1,\n lightsalmon: 0xffa07a,\n lightseagreen: 0x20b2aa,\n lightskyblue: 0x87cefa,\n lightslategray: 0x778899,\n lightslategrey: 0x778899,\n lightsteelblue: 0xb0c4de,\n lightyellow: 0xffffe0,\n lime: 0x00ff00,\n limegreen: 0x32cd32,\n linen: 0xfaf0e6,\n magenta: 0xff00ff,\n maroon: 0x800000,\n mediumaquamarine: 0x66cdaa,\n mediumblue: 0x0000cd,\n mediumorchid: 0xba55d3,\n mediumpurple: 0x9370db,\n mediumseagreen: 0x3cb371,\n mediumslateblue: 0x7b68ee,\n mediumspringgreen: 0x00fa9a,\n mediumturquoise: 0x48d1cc,\n mediumvioletred: 0xc71585,\n midnightblue: 0x191970,\n mintcream: 0xf5fffa,\n mistyrose: 0xffe4e1,\n moccasin: 0xffe4b5,\n navajowhite: 0xffdead,\n navy: 0x000080,\n oldlace: 0xfdf5e6,\n olive: 0x808000,\n olivedrab: 0x6b8e23,\n orange: 0xffa500,\n orangered: 0xff4500,\n orchid: 0xda70d6,\n palegoldenrod: 0xeee8aa,\n palegreen: 0x98fb98,\n paleturquoise: 0xafeeee,\n palevioletred: 0xdb7093,\n papayawhip: 0xffefd5,\n peachpuff: 0xffdab9,\n peru: 0xcd853f,\n pink: 0xffc0cb,\n plum: 0xdda0dd,\n powderblue: 0xb0e0e6,\n purple: 0x800080,\n rebeccapurple: 0x663399,\n red: 0xff0000,\n rosybrown: 0xbc8f8f,\n royalblue: 0x4169e1,\n saddlebrown: 0x8b4513,\n salmon: 0xfa8072,\n sandybrown: 0xf4a460,\n seagreen: 0x2e8b57,\n seashell: 0xfff5ee,\n sienna: 0xa0522d,\n silver: 0xc0c0c0,\n skyblue: 0x87ceeb,\n slateblue: 0x6a5acd,\n slategray: 0x708090,\n slategrey: 0x708090,\n snow: 0xfffafa,\n springgreen: 0x00ff7f,\n steelblue: 0x4682b4,\n tan: 0xd2b48c,\n teal: 0x008080,\n thistle: 0xd8bfd8,\n tomato: 0xff6347,\n turquoise: 0x40e0d0,\n violet: 0xee82ee,\n wheat: 0xf5deb3,\n white: 0xffffff,\n whitesmoke: 0xf5f5f5,\n yellow: 0xffff00,\n yellowgreen: 0x9acd32\n};\n\ndefine(Color, color, {\n copy(channels) {\n return Object.assign(new this.constructor, this, channels);\n },\n displayable() {\n return this.rgb().displayable();\n },\n hex: color_formatHex, // Deprecated! Use color.formatHex.\n formatHex: color_formatHex,\n formatHex8: color_formatHex8,\n formatHsl: color_formatHsl,\n formatRgb: color_formatRgb,\n toString: color_formatRgb\n});\n\nfunction color_formatHex() {\n return this.rgb().formatHex();\n}\n\nfunction color_formatHex8() {\n return this.rgb().formatHex8();\n}\n\nfunction color_formatHsl() {\n return hslConvert(this).formatHsl();\n}\n\nfunction color_formatRgb() {\n return this.rgb().formatRgb();\n}\n\nexport default function color(format) {\n var m, l;\n format = (format + \"\").trim().toLowerCase();\n return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000\n : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00\n : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000\n : l === 4 ? rgba((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000\n : null) // invalid hex\n : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)\n : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)\n : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)\n : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)\n : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)\n : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)\n : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins\n : format === \"transparent\" ? new Rgb(NaN, NaN, NaN, 0)\n : null;\n}\n\nfunction rgbn(n) {\n return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);\n}\n\nfunction rgba(r, g, b, a) {\n if (a <= 0) r = g = b = NaN;\n return new Rgb(r, g, b, a);\n}\n\nexport function rgbConvert(o) {\n if (!(o instanceof Color)) o = color(o);\n if (!o) return new Rgb;\n o = o.rgb();\n return new Rgb(o.r, o.g, o.b, o.opacity);\n}\n\nexport function rgb(r, g, b, opacity) {\n return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);\n}\n\nexport function Rgb(r, g, b, opacity) {\n this.r = +r;\n this.g = +g;\n this.b = +b;\n this.opacity = +opacity;\n}\n\ndefine(Rgb, rgb, extend(Color, {\n brighter(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);\n },\n darker(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);\n },\n rgb() {\n return this;\n },\n clamp() {\n return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));\n },\n displayable() {\n return (-0.5 <= this.r && this.r < 255.5)\n && (-0.5 <= this.g && this.g < 255.5)\n && (-0.5 <= this.b && this.b < 255.5)\n && (0 <= this.opacity && this.opacity <= 1);\n },\n hex: rgb_formatHex, // Deprecated! Use color.formatHex.\n formatHex: rgb_formatHex,\n formatHex8: rgb_formatHex8,\n formatRgb: rgb_formatRgb,\n toString: rgb_formatRgb\n}));\n\nfunction rgb_formatHex() {\n return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;\n}\n\nfunction rgb_formatHex8() {\n return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;\n}\n\nfunction rgb_formatRgb() {\n const a = clampa(this.opacity);\n return `${a === 1 ? \"rgb(\" : \"rgba(\"}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? \")\" : `, ${a})`}`;\n}\n\nfunction clampa(opacity) {\n return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));\n}\n\nfunction clampi(value) {\n return Math.max(0, Math.min(255, Math.round(value) || 0));\n}\n\nfunction hex(value) {\n value = clampi(value);\n return (value < 16 ? \"0\" : \"\") + value.toString(16);\n}\n\nfunction hsla(h, s, l, a) {\n if (a <= 0) h = s = l = NaN;\n else if (l <= 0 || l >= 1) h = s = NaN;\n else if (s <= 0) h = NaN;\n return new Hsl(h, s, l, a);\n}\n\nexport function hslConvert(o) {\n if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);\n if (!(o instanceof Color)) o = color(o);\n if (!o) return new Hsl;\n if (o instanceof Hsl) return o;\n o = o.rgb();\n var r = o.r / 255,\n g = o.g / 255,\n b = o.b / 255,\n min = Math.min(r, g, b),\n max = Math.max(r, g, b),\n h = NaN,\n s = max - min,\n l = (max + min) / 2;\n if (s) {\n if (r === max) h = (g - b) / s + (g < b) * 6;\n else if (g === max) h = (b - r) / s + 2;\n else h = (r - g) / s + 4;\n s /= l < 0.5 ? max + min : 2 - max - min;\n h *= 60;\n } else {\n s = l > 0 && l < 1 ? 0 : h;\n }\n return new Hsl(h, s, l, o.opacity);\n}\n\nexport function hsl(h, s, l, opacity) {\n return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);\n}\n\nfunction Hsl(h, s, l, opacity) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n this.opacity = +opacity;\n}\n\ndefine(Hsl, hsl, extend(Color, {\n brighter(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Hsl(this.h, this.s, this.l * k, this.opacity);\n },\n darker(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Hsl(this.h, this.s, this.l * k, this.opacity);\n },\n rgb() {\n var h = this.h % 360 + (this.h < 0) * 360,\n s = isNaN(h) || isNaN(this.s) ? 0 : this.s,\n l = this.l,\n m2 = l + (l < 0.5 ? l : 1 - l) * s,\n m1 = 2 * l - m2;\n return new Rgb(\n hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),\n hsl2rgb(h, m1, m2),\n hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),\n this.opacity\n );\n },\n clamp() {\n return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));\n },\n displayable() {\n return (0 <= this.s && this.s <= 1 || isNaN(this.s))\n && (0 <= this.l && this.l <= 1)\n && (0 <= this.opacity && this.opacity <= 1);\n },\n formatHsl() {\n const a = clampa(this.opacity);\n return `${a === 1 ? \"hsl(\" : \"hsla(\"}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? \")\" : `, ${a})`}`;\n }\n}));\n\nfunction clamph(value) {\n value = (value || 0) % 360;\n return value < 0 ? value + 360 : value;\n}\n\nfunction clampt(value) {\n return Math.max(0, Math.min(1, value || 0));\n}\n\n/* From FvD 13.37, CSS Color Module Level 3 */\nfunction hsl2rgb(h, m1, m2) {\n return (h < 60 ? m1 + (m2 - m1) * h / 60\n : h < 180 ? m2\n : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60\n : m1) * 255;\n}\n","export default x => () => x;\n","import constant from \"./constant.js\";\n\nfunction linear(a, d) {\n return function(t) {\n return a + t * d;\n };\n}\n\nfunction exponential(a, b, y) {\n return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {\n return Math.pow(a + t * b, y);\n };\n}\n\nexport function hue(a, b) {\n var d = b - a;\n return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant(isNaN(a) ? b : a);\n}\n\nexport function gamma(y) {\n return (y = +y) === 1 ? nogamma : function(a, b) {\n return b - a ? exponential(a, b, y) : constant(isNaN(a) ? b : a);\n };\n}\n\nexport default function nogamma(a, b) {\n var d = b - a;\n return d ? linear(a, d) : constant(isNaN(a) ? b : a);\n}\n","import {rgb as colorRgb} from \"d3-color\";\nimport basis from \"./basis.js\";\nimport basisClosed from \"./basisClosed.js\";\nimport nogamma, {gamma} from \"./color.js\";\n\nexport default (function rgbGamma(y) {\n var color = gamma(y);\n\n function rgb(start, end) {\n var r = color((start = colorRgb(start)).r, (end = colorRgb(end)).r),\n g = color(start.g, end.g),\n b = color(start.b, end.b),\n opacity = nogamma(start.opacity, end.opacity);\n return function(t) {\n start.r = r(t);\n start.g = g(t);\n start.b = b(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n\n rgb.gamma = rgbGamma;\n\n return rgb;\n})(1);\n\nfunction rgbSpline(spline) {\n return function(colors) {\n var n = colors.length,\n r = new Array(n),\n g = new Array(n),\n b = new Array(n),\n i, color;\n for (i = 0; i < n; ++i) {\n color = colorRgb(colors[i]);\n r[i] = color.r || 0;\n g[i] = color.g || 0;\n b[i] = color.b || 0;\n }\n r = spline(r);\n g = spline(g);\n b = spline(b);\n color.opacity = 1;\n return function(t) {\n color.r = r(t);\n color.g = g(t);\n color.b = b(t);\n return color + \"\";\n };\n };\n}\n\nexport var rgbBasis = rgbSpline(basis);\nexport var rgbBasisClosed = rgbSpline(basisClosed);\n","export default function(a, b) {\n if (!b) b = [];\n var n = a ? Math.min(b.length, a.length) : 0,\n c = b.slice(),\n i;\n return function(t) {\n for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t;\n return c;\n };\n}\n\nexport function isNumberArray(x) {\n return ArrayBuffer.isView(x) && !(x instanceof DataView);\n}\n","import value from \"./value.js\";\nimport numberArray, {isNumberArray} from \"./numberArray.js\";\n\nexport default function(a, b) {\n return (isNumberArray(b) ? numberArray : genericArray)(a, b);\n}\n\nexport function genericArray(a, b) {\n var nb = b ? b.length : 0,\n na = a ? Math.min(nb, a.length) : 0,\n x = new Array(na),\n c = new Array(nb),\n i;\n\n for (i = 0; i < na; ++i) x[i] = value(a[i], b[i]);\n for (; i < nb; ++i) c[i] = b[i];\n\n return function(t) {\n for (i = 0; i < na; ++i) c[i] = x[i](t);\n return c;\n };\n}\n","export default function(a, b) {\n var d = new Date;\n return a = +a, b = +b, function(t) {\n return d.setTime(a * (1 - t) + b * t), d;\n };\n}\n","export default function(a, b) {\n return a = +a, b = +b, function(t) {\n return a * (1 - t) + b * t;\n };\n}\n","import value from \"./value.js\";\n\nexport default function(a, b) {\n var i = {},\n c = {},\n k;\n\n if (a === null || typeof a !== \"object\") a = {};\n if (b === null || typeof b !== \"object\") b = {};\n\n for (k in b) {\n if (k in a) {\n i[k] = value(a[k], b[k]);\n } else {\n c[k] = b[k];\n }\n }\n\n return function(t) {\n for (k in i) c[k] = i[k](t);\n return c;\n };\n}\n","import number from \"./number.js\";\n\nvar reA = /[-+]?(?:\\d+\\.?\\d*|\\.?\\d+)(?:[eE][-+]?\\d+)?/g,\n reB = new RegExp(reA.source, \"g\");\n\nfunction zero(b) {\n return function() {\n return b;\n };\n}\n\nfunction one(b) {\n return function(t) {\n return b(t) + \"\";\n };\n}\n\nexport default function(a, b) {\n var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b\n am, // current match in a\n bm, // current match in b\n bs, // string preceding current number in b, if any\n i = -1, // index in s\n s = [], // string constants and placeholders\n q = []; // number interpolators\n\n // Coerce inputs to strings.\n a = a + \"\", b = b + \"\";\n\n // Interpolate pairs of numbers in a & b.\n while ((am = reA.exec(a))\n && (bm = reB.exec(b))) {\n if ((bs = bm.index) > bi) { // a string precedes the next number in b\n bs = b.slice(bi, bs);\n if (s[i]) s[i] += bs; // coalesce with previous string\n else s[++i] = bs;\n }\n if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match\n if (s[i]) s[i] += bm; // coalesce with previous string\n else s[++i] = bm;\n } else { // interpolate non-matching numbers\n s[++i] = null;\n q.push({i: i, x: number(am, bm)});\n }\n bi = reB.lastIndex;\n }\n\n // Add remains of b.\n if (bi < b.length) {\n bs = b.slice(bi);\n if (s[i]) s[i] += bs; // coalesce with previous string\n else s[++i] = bs;\n }\n\n // Special optimization for only a single match.\n // Otherwise, interpolate each of the numbers and rejoin the string.\n return s.length < 2 ? (q[0]\n ? one(q[0].x)\n : zero(b))\n : (b = q.length, function(t) {\n for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);\n return s.join(\"\");\n });\n}\n","import {color} from \"d3-color\";\nimport rgb from \"./rgb.js\";\nimport {genericArray} from \"./array.js\";\nimport date from \"./date.js\";\nimport number from \"./number.js\";\nimport object from \"./object.js\";\nimport string from \"./string.js\";\nimport constant from \"./constant.js\";\nimport numberArray, {isNumberArray} from \"./numberArray.js\";\n\nexport default function(a, b) {\n var t = typeof b, c;\n return b == null || t === \"boolean\" ? constant(b)\n : (t === \"number\" ? number\n : t === \"string\" ? ((c = color(b)) ? (b = c, rgb) : string)\n : b instanceof color ? rgb\n : b instanceof Date ? date\n : isNumberArray(b) ? numberArray\n : Array.isArray(b) ? genericArray\n : typeof b.valueOf !== \"function\" && typeof b.toString !== \"function\" || isNaN(b) ? object\n : number)(a, b);\n}\n","export default function(a, b) {\n return a = +a, b = +b, function(t) {\n return Math.round(a * (1 - t) + b * t);\n };\n}\n","export default function constants(x) {\n return function() {\n return x;\n };\n}\n","export default function number(x) {\n return +x;\n}\n","import {bisect} from \"d3-array\";\nimport {interpolate as interpolateValue, interpolateNumber, interpolateRound} from \"d3-interpolate\";\nimport constant from \"./constant.js\";\nimport number from \"./number.js\";\n\nvar unit = [0, 1];\n\nexport function identity(x) {\n return x;\n}\n\nfunction normalize(a, b) {\n return (b -= (a = +a))\n ? function(x) { return (x - a) / b; }\n : constant(isNaN(b) ? NaN : 0.5);\n}\n\nfunction clamper(a, b) {\n var t;\n if (a > b) t = a, a = b, b = t;\n return function(x) { return Math.max(a, Math.min(b, x)); };\n}\n\n// normalize(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1].\n// interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b].\nfunction bimap(domain, range, interpolate) {\n var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1];\n if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0);\n else d0 = normalize(d0, d1), r0 = interpolate(r0, r1);\n return function(x) { return r0(d0(x)); };\n}\n\nfunction polymap(domain, range, interpolate) {\n var j = Math.min(domain.length, range.length) - 1,\n d = new Array(j),\n r = new Array(j),\n i = -1;\n\n // Reverse descending domains.\n if (domain[j] < domain[0]) {\n domain = domain.slice().reverse();\n range = range.slice().reverse();\n }\n\n while (++i < j) {\n d[i] = normalize(domain[i], domain[i + 1]);\n r[i] = interpolate(range[i], range[i + 1]);\n }\n\n return function(x) {\n var i = bisect(domain, x, 1, j) - 1;\n return r[i](d[i](x));\n };\n}\n\nexport function copy(source, target) {\n return target\n .domain(source.domain())\n .range(source.range())\n .interpolate(source.interpolate())\n .clamp(source.clamp())\n .unknown(source.unknown());\n}\n\nexport function transformer() {\n var domain = unit,\n range = unit,\n interpolate = interpolateValue,\n transform,\n untransform,\n unknown,\n clamp = identity,\n piecewise,\n output,\n input;\n\n function rescale() {\n var n = Math.min(domain.length, range.length);\n if (clamp !== identity) clamp = clamper(domain[0], domain[n - 1]);\n piecewise = n > 2 ? polymap : bimap;\n output = input = null;\n return scale;\n }\n\n function scale(x) {\n return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate)))(transform(clamp(x)));\n }\n\n scale.invert = function(y) {\n return clamp(untransform((input || (input = piecewise(range, domain.map(transform), interpolateNumber)))(y)));\n };\n\n scale.domain = function(_) {\n return arguments.length ? (domain = Array.from(_, number), rescale()) : domain.slice();\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = Array.from(_), rescale()) : range.slice();\n };\n\n scale.rangeRound = function(_) {\n return range = Array.from(_), interpolate = interpolateRound, rescale();\n };\n\n scale.clamp = function(_) {\n return arguments.length ? (clamp = _ ? true : identity, rescale()) : clamp !== identity;\n };\n\n scale.interpolate = function(_) {\n return arguments.length ? (interpolate = _, rescale()) : interpolate;\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n return function(t, u) {\n transform = t, untransform = u;\n return rescale();\n };\n}\n\nexport default function continuous() {\n return transformer()(identity, identity);\n}\n","export default function(x) {\n return Math.abs(x = Math.round(x)) >= 1e21\n ? x.toLocaleString(\"en\").replace(/,/g, \"\")\n : x.toString(10);\n}\n\n// Computes the decimal coefficient and exponent of the specified number x with\n// significant digits p, where x is positive and p is in [1, 21] or undefined.\n// For example, formatDecimalParts(1.23) returns [\"123\", 0].\nexport function formatDecimalParts(x, p) {\n if (!isFinite(x) || x === 0) return null; // NaN, ±Infinity, ±0\n var i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf(\"e\"), coefficient = x.slice(0, i);\n\n // The string returned by toExponential either has the form \\d\\.\\d+e[-+]\\d+\n // (e.g., 1.2e+3) or the form \\de[-+]\\d+ (e.g., 1e+3).\n return [\n coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,\n +x.slice(i + 1)\n ];\n}\n","import {formatDecimalParts} from \"./formatDecimal.js\";\n\nexport default function(x) {\n return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;\n}\n","export default function(grouping, thousands) {\n return function(value, width) {\n var i = value.length,\n t = [],\n j = 0,\n g = grouping[0],\n length = 0;\n\n while (i > 0 && g > 0) {\n if (length + g + 1 > width) g = Math.max(1, width - length);\n t.push(value.substring(i -= g, i + g));\n if ((length += g + 1) > width) break;\n g = grouping[j = (j + 1) % grouping.length];\n }\n\n return t.reverse().join(thousands);\n };\n}\n","export default function(numerals) {\n return function(value) {\n return value.replace(/[0-9]/g, function(i) {\n return numerals[+i];\n });\n };\n}\n","// [[fill]align][sign][symbol][0][width][,][.precision][~][type]\nvar re = /^(?:(.)?([<>=^]))?([+\\-( ])?([$#])?(0)?(\\d+)?(,)?(\\.\\d+)?(~)?([a-z%])?$/i;\n\nexport default function formatSpecifier(specifier) {\n if (!(match = re.exec(specifier))) throw new Error(\"invalid format: \" + specifier);\n var match;\n return new FormatSpecifier({\n fill: match[1],\n align: match[2],\n sign: match[3],\n symbol: match[4],\n zero: match[5],\n width: match[6],\n comma: match[7],\n precision: match[8] && match[8].slice(1),\n trim: match[9],\n type: match[10]\n });\n}\n\nformatSpecifier.prototype = FormatSpecifier.prototype; // instanceof\n\nexport function FormatSpecifier(specifier) {\n this.fill = specifier.fill === undefined ? \" \" : specifier.fill + \"\";\n this.align = specifier.align === undefined ? \">\" : specifier.align + \"\";\n this.sign = specifier.sign === undefined ? \"-\" : specifier.sign + \"\";\n this.symbol = specifier.symbol === undefined ? \"\" : specifier.symbol + \"\";\n this.zero = !!specifier.zero;\n this.width = specifier.width === undefined ? undefined : +specifier.width;\n this.comma = !!specifier.comma;\n this.precision = specifier.precision === undefined ? undefined : +specifier.precision;\n this.trim = !!specifier.trim;\n this.type = specifier.type === undefined ? \"\" : specifier.type + \"\";\n}\n\nFormatSpecifier.prototype.toString = function() {\n return this.fill\n + this.align\n + this.sign\n + this.symbol\n + (this.zero ? \"0\" : \"\")\n + (this.width === undefined ? \"\" : Math.max(1, this.width | 0))\n + (this.comma ? \",\" : \"\")\n + (this.precision === undefined ? \"\" : \".\" + Math.max(0, this.precision | 0))\n + (this.trim ? \"~\" : \"\")\n + this.type;\n};\n","// Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k.\nexport default function(s) {\n out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {\n switch (s[i]) {\n case \".\": i0 = i1 = i; break;\n case \"0\": if (i0 === 0) i0 = i; i1 = i; break;\n default: if (!+s[i]) break out; if (i0 > 0) i0 = 0; break;\n }\n }\n return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;\n}\n","import {formatDecimalParts} from \"./formatDecimal.js\";\n\nexport var prefixExponent;\n\nexport default function(x, p) {\n var d = formatDecimalParts(x, p);\n if (!d) return prefixExponent = undefined, x.toPrecision(p);\n var coefficient = d[0],\n exponent = d[1],\n i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,\n n = coefficient.length;\n return i === n ? coefficient\n : i > n ? coefficient + new Array(i - n + 1).join(\"0\")\n : i > 0 ? coefficient.slice(0, i) + \".\" + coefficient.slice(i)\n : \"0.\" + new Array(1 - i).join(\"0\") + formatDecimalParts(x, Math.max(0, p + i - 1))[0]; // less than 1y!\n}\n","import {formatDecimalParts} from \"./formatDecimal.js\";\n\nexport default function(x, p) {\n var d = formatDecimalParts(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1];\n return exponent < 0 ? \"0.\" + new Array(-exponent).join(\"0\") + coefficient\n : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + \".\" + coefficient.slice(exponent + 1)\n : coefficient + new Array(exponent - coefficient.length + 2).join(\"0\");\n}\n","import formatDecimal from \"./formatDecimal.js\";\nimport formatPrefixAuto from \"./formatPrefixAuto.js\";\nimport formatRounded from \"./formatRounded.js\";\n\nexport default {\n \"%\": (x, p) => (x * 100).toFixed(p),\n \"b\": (x) => Math.round(x).toString(2),\n \"c\": (x) => x + \"\",\n \"d\": formatDecimal,\n \"e\": (x, p) => x.toExponential(p),\n \"f\": (x, p) => x.toFixed(p),\n \"g\": (x, p) => x.toPrecision(p),\n \"o\": (x) => Math.round(x).toString(8),\n \"p\": (x, p) => formatRounded(x * 100, p),\n \"r\": formatRounded,\n \"s\": formatPrefixAuto,\n \"X\": (x) => Math.round(x).toString(16).toUpperCase(),\n \"x\": (x) => Math.round(x).toString(16)\n};\n","export default function(x) {\n return x;\n}\n","import exponent from \"./exponent.js\";\nimport formatGroup from \"./formatGroup.js\";\nimport formatNumerals from \"./formatNumerals.js\";\nimport formatSpecifier from \"./formatSpecifier.js\";\nimport formatTrim from \"./formatTrim.js\";\nimport formatTypes from \"./formatTypes.js\";\nimport {prefixExponent} from \"./formatPrefixAuto.js\";\nimport identity from \"./identity.js\";\n\nvar map = Array.prototype.map,\n prefixes = [\"y\",\"z\",\"a\",\"f\",\"p\",\"n\",\"µ\",\"m\",\"\",\"k\",\"M\",\"G\",\"T\",\"P\",\"E\",\"Z\",\"Y\"];\n\nexport default function(locale) {\n var group = locale.grouping === undefined || locale.thousands === undefined ? identity : formatGroup(map.call(locale.grouping, Number), locale.thousands + \"\"),\n currencyPrefix = locale.currency === undefined ? \"\" : locale.currency[0] + \"\",\n currencySuffix = locale.currency === undefined ? \"\" : locale.currency[1] + \"\",\n decimal = locale.decimal === undefined ? \".\" : locale.decimal + \"\",\n numerals = locale.numerals === undefined ? identity : formatNumerals(map.call(locale.numerals, String)),\n percent = locale.percent === undefined ? \"%\" : locale.percent + \"\",\n minus = locale.minus === undefined ? \"−\" : locale.minus + \"\",\n nan = locale.nan === undefined ? \"NaN\" : locale.nan + \"\";\n\n function newFormat(specifier, options) {\n specifier = formatSpecifier(specifier);\n\n var fill = specifier.fill,\n align = specifier.align,\n sign = specifier.sign,\n symbol = specifier.symbol,\n zero = specifier.zero,\n width = specifier.width,\n comma = specifier.comma,\n precision = specifier.precision,\n trim = specifier.trim,\n type = specifier.type;\n\n // The \"n\" type is an alias for \",g\".\n if (type === \"n\") comma = true, type = \"g\";\n\n // The \"\" type, and any invalid type, is an alias for \".12~g\".\n else if (!formatTypes[type]) precision === undefined && (precision = 12), trim = true, type = \"g\";\n\n // If zero fill is specified, padding goes after sign and before digits.\n if (zero || (fill === \"0\" && align === \"=\")) zero = true, fill = \"0\", align = \"=\";\n\n // Compute the prefix and suffix.\n // For SI-prefix, the suffix is lazily computed.\n var prefix = (options && options.prefix !== undefined ? options.prefix : \"\") + (symbol === \"$\" ? currencyPrefix : symbol === \"#\" && /[boxX]/.test(type) ? \"0\" + type.toLowerCase() : \"\"),\n suffix = (symbol === \"$\" ? currencySuffix : /[%p]/.test(type) ? percent : \"\") + (options && options.suffix !== undefined ? options.suffix : \"\");\n\n // What format function should we use?\n // Is this an integer type?\n // Can this type generate exponential notation?\n var formatType = formatTypes[type],\n maybeSuffix = /[defgprs%]/.test(type);\n\n // Set the default precision if not specified,\n // or clamp the specified precision to the supported range.\n // For significant precision, it must be in [1, 21].\n // For fixed precision, it must be in [0, 20].\n precision = precision === undefined ? 6\n : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))\n : Math.max(0, Math.min(20, precision));\n\n function format(value) {\n var valuePrefix = prefix,\n valueSuffix = suffix,\n i, n, c;\n\n if (type === \"c\") {\n valueSuffix = formatType(value) + valueSuffix;\n value = \"\";\n } else {\n value = +value;\n\n // Determine the sign. -0 is not less than 0, but 1 / -0 is!\n var valueNegative = value < 0 || 1 / value < 0;\n\n // Perform the initial formatting.\n value = isNaN(value) ? nan : formatType(Math.abs(value), precision);\n\n // Trim insignificant zeros.\n if (trim) value = formatTrim(value);\n\n // If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign.\n if (valueNegative && +value === 0 && sign !== \"+\") valueNegative = false;\n\n // Compute the prefix and suffix.\n valuePrefix = (valueNegative ? (sign === \"(\" ? sign : minus) : sign === \"-\" || sign === \"(\" ? \"\" : sign) + valuePrefix;\n valueSuffix = (type === \"s\" && !isNaN(value) && prefixExponent !== undefined ? prefixes[8 + prefixExponent / 3] : \"\") + valueSuffix + (valueNegative && sign === \"(\" ? \")\" : \"\");\n\n // Break the formatted value into the integer “value” part that can be\n // grouped, and fractional or exponential “suffix” part that is not.\n if (maybeSuffix) {\n i = -1, n = value.length;\n while (++i < n) {\n if (c = value.charCodeAt(i), 48 > c || c > 57) {\n valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;\n value = value.slice(0, i);\n break;\n }\n }\n }\n }\n\n // If the fill character is not \"0\", grouping is applied before padding.\n if (comma && !zero) value = group(value, Infinity);\n\n // Compute the padding.\n var length = valuePrefix.length + value.length + valueSuffix.length,\n padding = length < width ? new Array(width - length + 1).join(fill) : \"\";\n\n // If the fill character is \"0\", grouping is applied after padding.\n if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = \"\";\n\n // Reconstruct the final output based on the desired alignment.\n switch (align) {\n case \"<\": value = valuePrefix + value + valueSuffix + padding; break;\n case \"=\": value = valuePrefix + padding + value + valueSuffix; break;\n case \"^\": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break;\n default: value = padding + valuePrefix + value + valueSuffix; break;\n }\n\n return numerals(value);\n }\n\n format.toString = function() {\n return specifier + \"\";\n };\n\n return format;\n }\n\n function formatPrefix(specifier, value) {\n var e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3,\n k = Math.pow(10, -e),\n f = newFormat((specifier = formatSpecifier(specifier), specifier.type = \"f\", specifier), {suffix: prefixes[8 + e / 3]});\n return function(value) {\n return f(k * value);\n };\n }\n\n return {\n format: newFormat,\n formatPrefix: formatPrefix\n };\n}\n","import formatLocale from \"./locale.js\";\n\nvar locale;\nexport var format;\nexport var formatPrefix;\n\ndefaultLocale({\n thousands: \",\",\n grouping: [3],\n currency: [\"$\", \"\"]\n});\n\nexport default function defaultLocale(definition) {\n locale = formatLocale(definition);\n format = locale.format;\n formatPrefix = locale.formatPrefix;\n return locale;\n}\n","import exponent from \"./exponent.js\";\n\nexport default function(step) {\n return Math.max(0, -exponent(Math.abs(step)));\n}\n","import exponent from \"./exponent.js\";\n\nexport default function(step, value) {\n return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step)));\n}\n","import exponent from \"./exponent.js\";\n\nexport default function(step, max) {\n step = Math.abs(step), max = Math.abs(max) - step;\n return Math.max(0, exponent(max) - exponent(step)) + 1;\n}\n","import {tickStep} from \"d3-array\";\nimport {format, formatPrefix, formatSpecifier, precisionFixed, precisionPrefix, precisionRound} from \"d3-format\";\n\nexport default function tickFormat(start, stop, count, specifier) {\n var step = tickStep(start, stop, count),\n precision;\n specifier = formatSpecifier(specifier == null ? \",f\" : specifier);\n switch (specifier.type) {\n case \"s\": {\n var value = Math.max(Math.abs(start), Math.abs(stop));\n if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value))) specifier.precision = precision;\n return formatPrefix(specifier, value);\n }\n case \"\":\n case \"e\":\n case \"g\":\n case \"p\":\n case \"r\": {\n if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === \"e\");\n break;\n }\n case \"f\":\n case \"%\": {\n if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === \"%\") * 2;\n break;\n }\n }\n return format(specifier);\n}\n","import {ticks, tickIncrement} from \"d3-array\";\nimport continuous, {copy} from \"./continuous.js\";\nimport {initRange} from \"./init.js\";\nimport tickFormat from \"./tickFormat.js\";\n\nexport function linearish(scale) {\n var domain = scale.domain;\n\n scale.ticks = function(count) {\n var d = domain();\n return ticks(d[0], d[d.length - 1], count == null ? 10 : count);\n };\n\n scale.tickFormat = function(count, specifier) {\n var d = domain();\n return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier);\n };\n\n scale.nice = function(count) {\n if (count == null) count = 10;\n\n var d = domain();\n var i0 = 0;\n var i1 = d.length - 1;\n var start = d[i0];\n var stop = d[i1];\n var prestep;\n var step;\n var maxIter = 10;\n\n if (stop < start) {\n step = start, start = stop, stop = step;\n step = i0, i0 = i1, i1 = step;\n }\n \n while (maxIter-- > 0) {\n step = tickIncrement(start, stop, count);\n if (step === prestep) {\n d[i0] = start\n d[i1] = stop\n return domain(d);\n } else if (step > 0) {\n start = Math.floor(start / step) * step;\n stop = Math.ceil(stop / step) * step;\n } else if (step < 0) {\n start = Math.ceil(start * step) / step;\n stop = Math.floor(stop * step) / step;\n } else {\n break;\n }\n prestep = step;\n }\n\n return scale;\n };\n\n return scale;\n}\n\nexport default function linear() {\n var scale = continuous();\n\n scale.copy = function() {\n return copy(scale, linear());\n };\n\n initRange.apply(scale, arguments);\n\n return linearish(scale);\n}\n","var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __export = (target, all) => {\n for (var name2 in all)\n __defProp(target, name2, { get: all[name2], enumerable: true });\n};\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\n\n// src/modules/constants.ts\nvar COLOR_KEYS = {\n hsl: [\"h\", \"s\", \"l\"],\n oklab: [\"l\", \"a\", \"b\"],\n oklch: [\"l\", \"c\", \"h\"],\n rgb: [\"r\", \"g\", \"b\"]\n};\nvar COLOR_MODELS = [\"hsl\", \"oklab\", \"oklch\", \"rgb\"];\nvar DEG2RAD = Math.PI / 180;\nvar LAB_TO_LMS = {\n l: [0.3963377773761749, 0.2158037573099136],\n m: [-0.1055613458156586, -0.0638541728258133],\n s: [-0.0894841775298119, -1.2914855480194092]\n};\nvar LRGB_TO_LMS = {\n l: [0.4122214708, 0.5363325363, 0.0514459929],\n m: [0.2119034982, 0.6806995451, 0.1073969566],\n s: [0.0883024619, 0.2817188376, 0.6299787005]\n};\nvar LSM_TO_LAB = {\n l: [0.2104542553, 0.793617785, 0.0040720468],\n a: [1.9779984951, 2.428592205, 0.4505937099],\n b: [0.0259040371, 0.7827717662, 0.808675766]\n};\nvar LSM_TO_RGB = {\n r: [4.076741636075958, -3.307711539258063, 0.2309699031821043],\n g: [-1.2684379732850315, 2.609757349287688, -0.341319376002657],\n b: [-0.0041960761386756, -0.7034186179359362, 1.7076146940746117]\n};\nvar SRGB_TO_P3 = [\n [0.8224270476, 0.1775729524, 0],\n [0.0331008087, 0.9668991913, 0],\n [0.0170720188, 0.0723477973, 0.9105801839]\n];\nvar PRECISION = 5;\nvar RAD2DEG = 180 / Math.PI;\nvar MESSAGES = {\n alpha: \"alpha must be a number between 0 and 1\",\n alphaAdjustment: \"alpha must be a number between -1 and 1\",\n amount: \"amount must be a number between 0 and 100\",\n colorRequired: \"color is required\",\n degreesRange: \"degrees must be a number between -360 and 360\",\n hueArgs: \"point, chroma and h are required\",\n hueRange: \"hue must be a number between 0 and 360\",\n input: \"input is required\",\n inputHex: \"input is required and must be a hex\",\n inputNumber: \"input is required and must be a number\",\n inputString: \"input is required and must be a string\",\n invalid: \"invalid input\",\n invalidColor: \"invalid color\",\n invalidCSS: \"invalid CSS string\",\n invalidHex: \"invalid hex\",\n invalidKey: \"invalid key\",\n invalidModel: \"invalid model\",\n invalidRange: \"color value out of range\",\n left: \"left is required and must be a string\",\n lightnessRange: \"lightness must be a number between 0 and 1\",\n options: \"invalid options\",\n paletteSize: \"palette size must be at least 2\",\n ratioRange: \"ratio must be a number between 0 and 1\",\n right: \"right is required and must be a string\",\n threshold: \"threshold must be a number between 0 and 255\",\n thresholdNormalized: \"threshold must be a number between 0 and 1\"\n};\nvar MONOCHROMATIC_LIGHTNESS_MAX = 80;\n\n// src/modules/invariant.ts\nfunction invariant(condition, message) {\n if (condition) {\n return;\n }\n if (process.env.NODE_ENV !== \"production\") {\n if (message === void 0) {\n throw new Error(\"invariant requires an error message argument\");\n }\n }\n const error = !message ? new Error(\n \"Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.\"\n ) : new Error(message);\n error.name = \"colorizr\";\n throw error;\n}\n\n// src/modules/css-colors.ts\nvar cssColors = {\n aliceblue: \"#f0f8ff\",\n antiquewhite: \"#faebd7\",\n aqua: \"#00ffff\",\n aquamarine: \"#7fffd4\",\n azure: \"#f0ffff\",\n beige: \"#f5f5dc\",\n bisque: \"#ffe4c4\",\n black: \"#000000\",\n blanchedalmond: \"#ffebcd\",\n blue: \"#0000ff\",\n blueviolet: \"#8a2be2\",\n brown: \"#a52a2a\",\n burlywood: \"#deb887\",\n cadetblue: \"#5f9ea0\",\n chartreuse: \"#7fff00\",\n chocolate: \"#d2691e\",\n coral: \"#ff7f50\",\n cornflowerblue: \"#6495ed\",\n cornsilk: \"#fff8dc\",\n crimson: \"#dc143c\",\n cyan: \"#00ffff\",\n darkblue: \"#00008b\",\n darkcyan: \"#008b8b\",\n darkgoldenrod: \"#b8860b\",\n darkgray: \"#a9a9a9\",\n darkgreen: \"#006400\",\n darkkhaki: \"#bdb76b\",\n darkmagenta: \"#8b008b\",\n darkolivegreen: \"#556b2f\",\n darkorange: \"#ff8c00\",\n darkorchid: \"#9932cc\",\n darkred: \"#8b0000\",\n darksalmon: \"#e9967a\",\n darkseagreen: \"#8fbc8f\",\n darkslateblue: \"#483d8b\",\n darkslategray: \"#2f4f4f\",\n darkslategrey: \"#2f4f4f\",\n darkturquoise: \"#00ced1\",\n darkviolet: \"#9400d3\",\n deeppink: \"#ff1493\",\n deepskyblue: \"#00bfff\",\n dimgray: \"#696969\",\n dimgrey: \"#696969\",\n dodgerblue: \"#1e90ff\",\n firebrick: \"#b22222\",\n floralwhite: \"#fffaf0\",\n forestgreen: \"#228b22\",\n fuchsia: \"#ff00ff\",\n gainsboro: \"#dcdcdc\",\n ghostwhite: \"#f8f8ff\",\n gold: \"#ffd700\",\n goldenrod: \"#daa520\",\n gray: \"#808080\",\n grey: \"#808080\",\n green: \"#008000\",\n greenyellow: \"#adff2f\",\n honeydew: \"#f0fff0\",\n hotpink: \"#ff69b4\",\n indianred: \"#cd5c5c\",\n indigo: \"#4b0082\",\n ivory: \"#fffff0\",\n khaki: \"#f0e68c\",\n lavender: \"#e6e6fa\",\n lavenderblush: \"#fff0f5\",\n lawngreen: \"#7cfc00\",\n lemonchiffon: \"#fffacd\",\n lightblue: \"#add8e6\",\n lightcoral: \"#f08080\",\n lightcyan: \"#e0ffff\",\n lightgoldenrodyellow: \"#fafad2\",\n lightgray: \"#d3d3d3\",\n lightgreen: \"#90ee90\",\n lightgrey: \"#d3d3d3\",\n lightpink: \"#ffb6c1\",\n lightsalmon: \"#ffa07a\",\n lightseagreen: \"#20b2aa\",\n lightskyblue: \"#87cefa\",\n lightslategray: \"#778899\",\n lightslategrey: \"#778899\",\n lightsteelblue: \"#b0c4de\",\n lightyellow: \"#ffffe0\",\n lime: \"#00ff00\",\n limegreen: \"#32cd32\",\n linen: \"#faf0e6\",\n magenta: \"#ff00ff\",\n maroon: \"#800000\",\n mediumaquamarine: \"#66cdaa\",\n mediumblue: \"#0000cd\",\n mediumorchid: \"#ba55d3\",\n mediumpurple: \"#9370db\",\n mediumseagreen: \"#3cb371\",\n mediumslateblue: \"#7b68ee\",\n mediumspringgreen: \"#00fa9a\",\n mediumturquoise: \"#48d1cc\",\n mediumvioletred: \"#c71585\",\n midnightblue: \"#191970\",\n mintcream: \"#f5fffa\",\n mistyrose: \"#ffe4e1\",\n moccasin: \"#ffe4b5\",\n navajowhite: \"#ffdead\",\n navy: \"#000080\",\n oldlace: \"#fdf5e6\",\n olive: \"#808000\",\n olivedrab: \"#6b8e23\",\n orange: \"#ffa500\",\n orangered: \"#ff4500\",\n orchid: \"#da70d6\",\n palegoldenrod: \"#eee8aa\",\n palegreen: \"#98fb98\",\n paleturquoise: \"#afeeee\",\n palevioletred: \"#db7093\",\n papayawhip: \"#ffefd5\",\n peachpuff: \"#ffdab9\",\n peru: \"#cd853f\",\n pink: \"#ffc0cb\",\n plum: \"#dda0dd\",\n powderblue: \"#b0e0e6\",\n purple: \"#800080\",\n rebeccapurple: \"#663399\",\n red: \"#ff0000\",\n rosybrown: \"#bc8f8f\",\n royalblue: \"#4169e1\",\n saddlebrown: \"#8b4513\",\n salmon: \"#fa8072\",\n sandybrown: \"#f4a460\",\n seagreen: \"#2e8b57\",\n seashell: \"#fff5ee\",\n sienna: \"#a0522d\",\n silver: \"#c0c0c0\",\n skyblue: \"#87ceeb\",\n slateblue: \"#6a5acd\",\n slategray: \"#708090\",\n slategrey: \"#708090\",\n snow: \"#fffafa\",\n springgreen: \"#00ff7f\",\n steelblue: \"#4682b4\",\n tan: \"#d2b48c\",\n teal: \"#008080\",\n thistle: \"#d8bfd8\",\n tomato: \"#ff6347\",\n turquoise: \"#40e0d0\",\n violet: \"#ee82ee\",\n wheat: \"#f5deb3\",\n white: \"#ffffff\",\n whitesmoke: \"#f5f5f5\",\n yellow: \"#ffff00\",\n yellowgreen: \"#9acd32\"\n};\n\n// src/modules/validators.ts\nvar hexRegex = /^#(?:[\\da-f]{3,4}|[\\da-f]{6,8})$/i;\nfunction hasValidMatches(input) {\n return Array.isArray(input) && input.length === 6;\n}\nfunction isHex(input) {\n if (!isString(input)) {\n return false;\n }\n return hexRegex.test(input);\n}\nfunction isHSL(input) {\n if (!isPlainObject(input)) {\n return false;\n }\n const entries = Object.entries(input);\n return !!entries.length && entries.every(([key, value]) => {\n if (key === \"h\") {\n return value >= 0 && value <= 360;\n }\n if (key === \"alpha\") {\n return value >= 0 && value <= 1;\n }\n return COLOR_KEYS.hsl.includes(key) && value >= 0 && value <= 100;\n });\n}\nfunction isLAB(input) {\n if (!isPlainObject(input)) {\n return false;\n }\n const entries = Object.entries(input);\n return !!entries.length && entries.every(([key, value]) => {\n if (key === \"l\") {\n return value >= 0 && value <= 100;\n }\n if (key === \"alpha\") {\n return value >= 0 && value <= 1;\n }\n return COLOR_KEYS.oklab.includes(key) && value >= -1 && value <= 1;\n });\n}\nfunction isLCH(input) {\n if (!isPlainObject(input)) {\n return false;\n }\n const entries = Object.entries(input);\n return !!entries.length && entries.every(([key, value]) => {\n if (key === \"l\") {\n return value >= 0 && value <= 100;\n }\n if (key === \"alpha\") {\n return value >= 0 && value <= 1;\n }\n return COLOR_KEYS.oklch.includes(key) && value >= 0 && value <= (key === \"h\" ? 360 : 1);\n });\n}\nfunction isNamedColor(input) {\n return isString(input) && Object.keys(cssColors).includes(input.toLowerCase());\n}\nfunction isNumber(input) {\n return typeof input === \"number\" && !Number.isNaN(input);\n}\nfunction isNumberInRange(input, min, max) {\n return isNumber(input) && input >= min && input <= max;\n}\nfunction isPlainObject(input) {\n if (!input) {\n return false;\n }\n const { toString } = Object.prototype;\n const prototype = Object.getPrototypeOf(input);\n return toString.call(input) === \"[object Object]\" && (prototype === null || prototype === Object.getPrototypeOf({}));\n}\nfunction isRGB(input) {\n if (!isPlainObject(input)) {\n return false;\n }\n const entries = Object.entries(input);\n return !!entries.length && entries.every(([key, value]) => {\n if (key === \"alpha\") {\n return value >= 0 && value <= 1;\n }\n return COLOR_KEYS.rgb.includes(key) && value >= 0 && value <= 255;\n });\n}\nfunction isString(input, validate = true) {\n const isValid = typeof input === \"string\";\n if (validate) {\n return isValid && !!input.trim().length;\n }\n return isValid;\n}\nfunction isValidColorModel(input) {\n return isHSL(input) || isRGB(input) || isLAB(input) || isLCH(input);\n}\n\n// src/format-hex.ts\nfunction formatHex(input) {\n invariant(isHex(input), MESSAGES.inputHex);\n let color = input.replace(\"#\", \"\");\n if (color.length === 3 || color.length === 4) {\n const values = [...color];\n color = \"\";\n values.forEach((d) => {\n color += `${d}${d}`;\n });\n }\n const hex = `#${color}`;\n invariant(isHex(hex), MESSAGES.invalidHex);\n return hex;\n}\n\n// src/modules/utils.ts\nfunction addAlpha(input, alpha) {\n invariant(isValidColorModel(input), MESSAGES.invalid);\n let value = alpha;\n if (value === void 0) {\n return input;\n }\n if (value > 1) {\n value /= 100;\n }\n if (value === 1) {\n return input;\n }\n return { ...input, alpha: value };\n}\nfunction clamp(value, min = 0, max = 100) {\n return Math.min(Math.max(value, min), max);\n}\nfunction constrainDegrees(input, amount) {\n invariant(isNumber(input), MESSAGES.inputNumber);\n let value = input + amount;\n if (value > 360) {\n value %= 360;\n }\n if (value < 0) {\n value += 360;\n }\n return Math.abs(value);\n}\nfunction extractAlpha(input) {\n if (Array.isArray(input)) {\n return void 0;\n }\n return input.alpha;\n}\nfunction limit(input, model, key) {\n invariant(isNumber(input), MESSAGES.inputNumber);\n invariant(COLOR_MODELS.includes(model), `${MESSAGES.invalidModel}${model ? `: ${model}` : \"\"}`);\n invariant(COLOR_KEYS[model].includes(key), `${MESSAGES.invalidKey}${key ? `: ${key}` : \"\"}`);\n switch (model) {\n case \"hsl\": {\n invariant(COLOR_KEYS.hsl.includes(key), MESSAGES.invalidKey);\n if ([\"l\", \"s\"].includes(key)) {\n return clamp(input);\n }\n return clamp(input, 0, 360);\n }\n case \"rgb\": {\n invariant(COLOR_KEYS.rgb.includes(key), MESSAGES.invalidKey);\n return clamp(input, 0, 255);\n }\n /* v8 ignore next 3 -- @preserve */\n default: {\n throw new Error(\"Invalid inputs\");\n }\n }\n}\nfunction parseInput(input, model) {\n const keys = COLOR_KEYS[model];\n const validator = {\n hsl: isHSL,\n oklab: isLAB,\n oklch: isLCH,\n rgb: isRGB\n };\n invariant(isPlainObject(input) || Array.isArray(input), MESSAGES.invalid);\n const value = Array.isArray(input) ? { [keys[0]]: input[0], [keys[1]]: input[1], [keys[2]]: input[2] } : input;\n invariant(validator[model](value), `${MESSAGES.invalidColor}: ${model}`);\n return value;\n}\nfunction restrictValues(input, precision = PRECISION, forcePrecision = true) {\n const output = new Map(Object.entries(input));\n for (const [key, value] of output.entries()) {\n output.set(key, round(value, precision, forcePrecision));\n }\n return Object.fromEntries(output);\n}\nfunction round(input, precision = 2, forcePrecision = true) {\n if (!isNumber(input) || input === 0) {\n return 0;\n }\n if (forcePrecision) {\n const factor2 = 10 ** precision;\n return Math.round(input * factor2) / factor2;\n }\n const absInput = Math.abs(input);\n let digits = Math.abs(Math.ceil(Math.log(absInput) / Math.LN10));\n if (digits === 0) {\n digits = 2;\n } else if (digits > precision) {\n digits = precision;\n }\n let exponent = precision - (digits < 0 ? 0 : digits);\n if (exponent <= 1 && precision > 1) {\n exponent = 2;\n } else if (exponent > precision || exponent === 0) {\n exponent = precision;\n }\n const factor = 10 ** exponent;\n return Math.round(input * factor) / factor;\n}\nfunction warn(message) {\n if (process.env.NODE_ENV !== \"production\") {\n console.warn(`[colorizr] ${message}`);\n }\n}\nvar STEP_KEYS = {\n 3: [100, 500, 900],\n 4: [100, 400, 600, 900],\n 5: [100, 300, 500, 700, 900],\n 6: [100, 200, 400, 600, 800, 900],\n 7: [100, 200, 400, 500, 600, 800, 900],\n 8: [100, 200, 300, 500, 600, 700, 800, 900],\n 9: [100, 200, 300, 400, 500, 600, 700, 800, 900],\n 10: [50, 100, 200, 300, 400, 500, 600, 700, 800, 900],\n 11: [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950],\n 12: [50, 100, 150, 200, 300, 400, 500, 600, 700, 800, 900, 950],\n 13: [50, 100, 150, 200, 300, 400, 500, 600, 700, 800, 850, 900, 950],\n 14: [50, 100, 150, 200, 250, 300, 400, 500, 600, 700, 800, 850, 900, 950],\n 15: [50, 100, 150, 200, 250, 300, 400, 500, 600, 700, 750, 800, 850, 900, 950],\n 16: [50, 100, 150, 200, 250, 300, 350, 400, 500, 600, 700, 750, 800, 850, 900, 950],\n 17: [50, 100, 150, 200, 250, 300, 350, 400, 500, 600, 650, 700, 750, 800, 850, 900, 950],\n 18: [50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 600, 650, 700, 750, 800, 850, 900, 950],\n 19: [\n 50,\n 100,\n 150,\n 200,\n 250,\n 300,\n 350,\n 400,\n 450,\n 500,\n 550,\n 600,\n 650,\n 700,\n 750,\n 800,\n 850,\n 900,\n 950\n ],\n 20: [\n 50,\n 100,\n 150,\n 200,\n 250,\n 300,\n 350,\n 400,\n 450,\n 500,\n 550,\n 600,\n 650,\n 700,\n 750,\n 800,\n 850,\n 900,\n 950,\n 1e3\n ]\n};\nfunction getScaleStepKeys(steps) {\n const value = clamp(Math.round(steps), 3, 20);\n return STEP_KEYS[value];\n}\n\n// src/modules/hex-utils.ts\nfunction addAlphaToHex(input, alpha) {\n invariant(isHex(input), MESSAGES.inputHex);\n invariant(isNumberInRange(alpha, 0, 1), MESSAGES.alpha);\n if (alpha >= 1) {\n return removeAlphaFromHex(input);\n }\n return `${removeAlphaFromHex(input)}${convertAlphaToHex(alpha)}`;\n}\nfunction convertAlphaToHex(input) {\n invariant(isNumber(input), MESSAGES.inputNumber);\n let alpha = input;\n if (input > 1) {\n alpha /= 100;\n }\n return Math.round(alpha * 255).toString(16).padStart(2, \"0\");\n}\nfunction extractAlphaFromHex(input) {\n invariant(isHex(input), MESSAGES.inputString);\n const alpha = input.substring(7, 9);\n if (!alpha) {\n return 1;\n }\n return round(parseInt(alpha, 16) / 255);\n}\nfunction hexadecimalToNumber(input) {\n return round(parseInt(input, 16));\n}\nfunction removeAlphaFromHex(input) {\n invariant(isHex(input), MESSAGES.inputHex);\n if (input.length === 5) {\n return input.substring(0, 4);\n }\n return input.substring(0, 7);\n}\n\n// src/converters/hex2rgb.ts\nfunction hex2rgb(input) {\n invariant(isHex(input), MESSAGES.inputHex);\n const hex = formatHex(input).slice(1);\n const alpha = extractAlphaFromHex(input);\n return addAlpha(\n {\n r: parseInt(hex.charAt(0) + hex.charAt(1), 16),\n g: parseInt(hex.charAt(2) + hex.charAt(3), 16),\n b: parseInt(hex.charAt(4) + hex.charAt(5), 16)\n },\n alpha\n );\n}\n\n// src/converters/index.ts\nvar converters_exports = {};\n__export(converters_exports, {\n hex2hsl: () => hex2hsl,\n hex2oklab: () => hex2oklab,\n hex2oklch: () => hex2oklch,\n hex2rgb: () => hex2rgb,\n hsl2hex: () => hsl2hex,\n hsl2oklab: () => hsl2oklab,\n hsl2oklch: () => hsl2oklch,\n hsl2rgb: () => hsl2rgb,\n oklab2hex: () => oklab2hex,\n oklab2hsl: () => oklab2hsl,\n oklab2oklch: () => oklab2oklch,\n oklab2rgb: () => oklab2rgb,\n oklch2hex: () => oklch2hex,\n oklch2hsl: () => oklch2hsl,\n oklch2oklab: () => oklch2oklab,\n oklch2rgb: () => oklch2rgb,\n rgb2hex: () => rgb2hex,\n rgb2hsl: () => rgb2hsl,\n rgb2oklab: () => rgb2oklab,\n rgb2oklch: () => rgb2oklch\n});\n\n// src/converters/rgb2hsl.ts\nfunction rgb2hsl(input) {\n const value = parseInput(input, \"rgb\");\n const alpha = extractAlpha(input);\n const rLimit = limit(value.r, \"rgb\", \"r\") / 255;\n const gLimit = limit(value.g, \"rgb\", \"g\") / 255;\n const bLimit = limit(value.b, \"rgb\", \"b\") / 255;\n const min = Math.min(rLimit, gLimit, bLimit);\n const max = Math.max(rLimit, gLimit, bLimit);\n const delta = max - min;\n let h = 0;\n let s;\n const l = (max + min) / 2;\n let rate;\n switch (max) {\n case rLimit:\n rate = !delta ? 0 : (gLimit - bLimit) / delta;\n h = 60 * rate;\n break;\n case gLimit:\n rate = (bLimit - rLimit) / delta;\n h = 60 * rate + 120;\n break;\n case bLimit:\n rate = (rLimit - gLimit) / delta;\n h = 60 * rate + 240;\n break;\n /* v8 ignore next 2 -- @preserve */\n default:\n break;\n }\n if (h < 0) {\n h = 360 + h;\n }\n if (min === max) {\n s = 0;\n } else {\n s = l < 0.5 ? delta / (2 * l) : delta / (2 - 2 * l);\n }\n return addAlpha(\n {\n h: Math.abs(+(h % 360).toFixed(2)),\n s: +(s * 100).toFixed(2),\n l: +(l * 100).toFixed(2)\n },\n alpha\n );\n}\n\n// src/converters/hex2hsl.ts\nfunction hex2hsl(input) {\n invariant(isHex(input), MESSAGES.inputHex);\n const alpha = extractAlphaFromHex(input);\n return addAlpha(rgb2hsl(hex2rgb(input)), alpha);\n}\n\n// src/converters/rgb2oklab.ts\nvar { cbrt, sign } = Math;\nfunction rgb2lrgb(input) {\n const abs2 = Math.abs(input);\n if (abs2 < 0.04045) {\n return input / 12.92;\n }\n return (sign(input) || 1) * ((abs2 + 0.055) / 1.055) ** 2.4;\n}\nfunction rgb2oklab(input, precision = PRECISION) {\n const value = parseInput(input, \"rgb\");\n const alpha = extractAlpha(input);\n const [lr, lg, lb] = [rgb2lrgb(value.r / 255), rgb2lrgb(value.g / 255), rgb2lrgb(value.b / 255)];\n const l = cbrt(LRGB_TO_LMS.l[0] * lr + LRGB_TO_LMS.l[1] * lg + LRGB_TO_LMS.l[2] * lb);\n const m = cbrt(LRGB_TO_LMS.m[0] * lr + LRGB_TO_LMS.m[1] * lg + LRGB_TO_LMS.m[2] * lb);\n const s = cbrt(LRGB_TO_LMS.s[0] * lr + LRGB_TO_LMS.s[1] * lg + LRGB_TO_LMS.s[2] * lb);\n const lab = restrictValues(\n {\n l: LSM_TO_LAB.l[0] * l + LSM_TO_LAB.l[1] * m - LSM_TO_LAB.l[2] * s,\n a: LSM_TO_LAB.a[0] * l - LSM_TO_LAB.a[1] * m + LSM_TO_LAB.a[2] * s,\n b: LSM_TO_LAB.b[0] * l + LSM_TO_LAB.b[1] * m - LSM_TO_LAB.b[2] * s\n },\n precision\n );\n return addAlpha(lab, alpha);\n}\n\n// src/converters/hex2oklab.ts\nfunction hex2oklab(input, precision) {\n invariant(isHex(input), MESSAGES.inputHex);\n const alpha = extractAlphaFromHex(input);\n return addAlpha(rgb2oklab(hex2rgb(input), precision), alpha);\n}\n\n// src/converters/oklab2oklch.ts\nvar { atan2, sqrt } = Math;\nfunction oklab2oklch(input, precision) {\n const { l, a, b } = restrictValues(parseInput(input, \"oklab\"));\n const alpha = extractAlpha(input);\n const c = sqrt(a ** 2 + b ** 2);\n let h = (atan2(b, a) * RAD2DEG + 360) % 360;\n if (round(c * 1e4) === 0) {\n h = 0;\n }\n return addAlpha(restrictValues({ l, c, h }, precision), alpha);\n}\n\n// src/converters/rgb2oklch.ts\nfunction rgb2oklch(input, precision) {\n const value = parseInput(input, \"rgb\");\n const alpha = extractAlpha(input);\n return addAlpha(oklab2oklch(rgb2oklab(value, precision), precision), alpha);\n}\n\n// src/converters/hex2oklch.ts\nfunction hex2oklch(input, precision) {\n invariant(isHex(input), MESSAGES.inputHex);\n const alpha = extractAlphaFromHex(input);\n return addAlpha(rgb2oklch(hex2rgb(input), precision), alpha);\n}\n\n// src/modules/hue2rgb.ts\nfunction hue2rgb(point, chroma2, h) {\n invariant(isNumber(point) && isNumber(chroma2) && isNumber(h), MESSAGES.hueArgs);\n let hue = h;\n if (hue < 0) {\n hue += 1;\n }\n if (hue > 1) {\n hue -= 1;\n }\n if (hue < 1 / 6) {\n return round(point + (chroma2 - point) * 6 * hue, 4);\n }\n if (hue < 1 / 2) {\n return round(chroma2, 4);\n }\n if (hue < 2 / 3) {\n return round(point + (chroma2 - point) * (2 / 3 - hue) * 6, 4);\n }\n return round(point, 4);\n}\n\n// src/converters/hsl2rgb.ts\nfunction hsl2rgb(input) {\n const value = parseInput(input, \"hsl\");\n const alpha = extractAlpha(input);\n const h = round(value.h) / 360;\n const s = round(value.s) / 100;\n const l = round(value.l) / 100;\n let r;\n let g;\n let b;\n let point;\n let chroma2;\n if (s === 0) {\n r = l;\n g = l;\n b = l;\n } else {\n chroma2 = l < 0.5 ? l * (1 + s) : l + s - l * s;\n point = 2 * l - chroma2;\n r = hue2rgb(point, chroma2, h + 1 / 3);\n g = hue2rgb(point, chroma2, h);\n b = hue2rgb(point, chroma2, h - 1 / 3);\n }\n return addAlpha(\n {\n r: Math.round(r * 255),\n g: Math.round(g * 255),\n b: Math.round(b * 255)\n },\n alpha\n );\n}\n\n// src/converters/rgb2hex.ts\nfunction rgb2hex(input) {\n const rgb = parseInput(input, \"rgb\");\n const alpha = extractAlpha(input);\n const hex = `#${[rgb.r, rgb.g, rgb.b].map((d) => `0${Math.floor(d).toString(16)}`.slice(-2)).join(\"\")}`;\n return alpha !== void 0 && alpha < 1 ? addAlphaToHex(hex, alpha) : hex;\n}\n\n// src/converters/hsl2hex.ts\nfunction hsl2hex(input) {\n const value = parseInput(input, \"hsl\");\n const alpha = extractAlpha(input);\n const hex = rgb2hex(hsl2rgb(value));\n return alpha !== void 0 && alpha < 1 ? addAlphaToHex(hex, alpha) : hex;\n}\n\n// src/converters/hsl2oklab.ts\nfunction hsl2oklab(input, precision) {\n const value = parseInput(input, \"hsl\");\n const alpha = extractAlpha(input);\n return addAlpha(rgb2oklab(hsl2rgb(value), precision), alpha);\n}\n\n// src/converters/hsl2oklch.ts\nfunction hsl2oklch(input, precision) {\n const value = parseInput(input, \"hsl\");\n const alpha = extractAlpha(input);\n return addAlpha(rgb2oklch(hsl2rgb(value), precision), alpha);\n}\n\n// src/converters/oklab2rgb.ts\nvar { abs } = Math;\nfunction lrgb2rgb(input) {\n const absoluteNumber = abs(input);\n const sign2 = input < 0 ? -1 : 1;\n if (absoluteNumber > 31308e-7) {\n return sign2 * (absoluteNumber ** (1 / 2.4) * 1.055 - 0.055);\n }\n return input * 12.92;\n}\nfunction oklab2rgb(input, precision = 0) {\n const { l: L, a: A, b: B } = parseInput(input, \"oklab\");\n const alpha = extractAlpha(input);\n const l = (L + LAB_TO_LMS.l[0] * A + LAB_TO_LMS.l[1] * B) ** 3;\n const m = (L + LAB_TO_LMS.m[0] * A + LAB_TO_LMS.m[1] * B) ** 3;\n const s = (L + LAB_TO_LMS.s[0] * A + LAB_TO_LMS.s[1] * B) ** 3;\n const r = 255 * lrgb2rgb(LSM_TO_RGB.r[0] * l + LSM_TO_RGB.r[1] * m + LSM_TO_RGB.r[2] * s);\n const g = 255 * lrgb2rgb(LSM_TO_RGB.g[0] * l + LSM_TO_RGB.g[1] * m + LSM_TO_RGB.g[2] * s);\n const b = 255 * lrgb2rgb(LSM_TO_RGB.b[0] * l + LSM_TO_RGB.b[1] * m + LSM_TO_RGB.b[2] * s);\n return addAlpha(\n {\n r: clamp(round(r, precision), 0, 255),\n g: clamp(round(g, precision), 0, 255),\n b: clamp(round(b, precision), 0, 255)\n },\n alpha\n );\n}\n\n// src/converters/oklab2hex.ts\nfunction oklab2hex(input) {\n const value = parseInput(input, \"oklab\");\n const alpha = extractAlpha(input);\n const hex = rgb2hex(oklab2rgb(value));\n return alpha !== void 0 && alpha < 1 ? addAlphaToHex(hex, alpha) : hex;\n}\n\n// src/converters/oklab2hsl.ts\nfunction oklab2hsl(input) {\n const value = parseInput(input, \"oklab\");\n const alpha = extractAlpha(input);\n return addAlpha(rgb2hsl(oklab2rgb(value)), alpha);\n}\n\n// src/converters/oklch2oklab.ts\nvar { sin, cos } = Math;\nfunction oklch2oklab(input, precision) {\n let { l, c, h } = parseInput(input, \"oklch\");\n const alpha = extractAlpha(input);\n if (Number.isNaN(h) || h < 0) {\n h = 0;\n }\n return addAlpha(\n restrictValues({ l, a: c * cos(h * DEG2RAD), b: c * sin(h * DEG2RAD) }, precision),\n alpha\n );\n}\n\n// src/converters/oklch2rgb.ts\nfunction oklch2rgb(input, precision = 0) {\n const value = parseInput(input, \"oklch\");\n const alpha = extractAlpha(input);\n return addAlpha(oklab2rgb(oklch2oklab(value), precision), alpha);\n}\n\n// src/converters/oklch2hex.ts\nfunction oklch2hex(input) {\n const value = parseInput(input, \"oklch\");\n const alpha = extractAlpha(input);\n const hex = rgb2hex(oklch2rgb(value));\n return alpha !== void 0 && alpha < 1 ? addAlphaToHex(hex, alpha) : hex;\n}\n\n// src/converters/oklch2hsl.ts\nfunction oklch2hsl(input) {\n const value = parseInput(input, \"oklch\");\n const alpha = extractAlpha(input);\n return addAlpha(rgb2hsl(oklch2rgb(value)), alpha);\n}\n\n// src/extract-color-parts.ts\nvar MODEL = \"(rgb|hsl|oklab|oklch)a?\";\nvar SEP = \"(?:\\\\s*[,/]\\\\s*|\\\\s+)\";\nvar VALUE = \"(none|[\\\\d%.-]+(?:deg|grad|rad|turn)?)\";\nvar colorRegex = new RegExp(\n `${MODEL}\\\\s*\\\\(\\\\s*${VALUE}${SEP}${VALUE}${SEP}${VALUE}(?:${SEP}${VALUE})?\\\\s*\\\\)`,\n \"i\"\n);\nfunction parseAngle(value) {\n const number_ = parseFloat(value);\n let result;\n if (value.endsWith(\"grad\")) {\n result = number_ * 0.9;\n } else if (value.endsWith(\"rad\")) {\n result = number_ * (180 / Math.PI);\n } else if (value.endsWith(\"turn\")) {\n result = number_ * 360;\n } else {\n result = number_;\n }\n return Math.round(result * 1e5) / 1e5;\n}\nfunction extractColorParts(input) {\n invariant(isString(input), MESSAGES.inputString);\n if (isHex(input)) {\n const keys2 = COLOR_KEYS.rgb;\n const { r, g, b } = hex2rgb(input);\n const alpha2 = extractAlphaFromHex(input);\n return {\n model: \"rgb\",\n [keys2[0]]: r,\n [keys2[1]]: g,\n [keys2[2]]: b,\n alpha: alpha2 < 1 ? alpha2 : void 0\n };\n }\n const matches = colorRegex.exec(input);\n invariant(hasValidMatches(matches), MESSAGES.invalidCSS);\n const model = matches[1];\n const keys = COLOR_KEYS[model];\n let alpha = matches[5] ? parseFloat(matches[5]) : 1;\n if (alpha > 1) {\n alpha /= 100;\n }\n const parseValue = (value, index) => {\n if (value === \"none\") {\n return 0;\n }\n const isHue = model === \"hsl\" && index === 0 || model === \"oklch\" && index === 2;\n if (isHue) {\n return parseAngle(value);\n }\n const parsedValue = parseFloat(value);\n const isPercent = value.includes(\"%\");\n if (!isPercent) {\n return parsedValue;\n }\n if (model === \"oklch\") {\n if (index === 1) {\n return parsedValue * 0.4 / 100;\n }\n } else if (model === \"oklab\") {\n if (index === 1 || index === 2) {\n return parsedValue * 0.4 / 100;\n }\n }\n return parsedValue;\n };\n const values = [parseValue(matches[2], 0), parseValue(matches[3], 1), parseValue(matches[4], 2)];\n if (model === \"oklab\") {\n invariant(values[1] >= -0.4 && values[1] <= 0.4, MESSAGES.invalidRange);\n invariant(values[2] >= -0.4 && values[2] <= 0.4, MESSAGES.invalidRange);\n } else if (model === \"oklch\") {\n invariant(values[1] >= 0 && values[1] <= 0.4, MESSAGES.invalidRange);\n }\n return {\n model,\n [keys[0]]: values[0],\n [keys[1]]: values[1],\n [keys[2]]: values[2],\n alpha: alpha < 1 ? alpha : void 0\n };\n}\n\n// src/parse-css.ts\nvar toHslConverters = {\n oklab: oklab2hsl,\n oklch: oklch2hsl,\n rgb: rgb2hsl\n};\nvar toOklabConverters = {\n hsl: hsl2oklab,\n oklch: oklch2oklab,\n rgb: rgb2oklab\n};\nvar toOklchConverters = {\n hsl: hsl2oklch,\n oklab: oklab2oklch,\n rgb: rgb2oklch\n};\nvar toRgbConverters = {\n hsl: hsl2rgb,\n oklab: oklab2rgb,\n oklch: oklch2rgb\n};\nvar toHexConverters = {\n hsl: hsl2hex,\n oklab: oklab2hex,\n oklch: oklch2hex,\n rgb: rgb2hex\n};\nvar fromHexConverters = {\n hsl: hex2hsl,\n oklab: hex2oklab,\n oklch: hex2oklch,\n rgb: hex2rgb\n};\nvar converterTables = {\n hsl: toHslConverters,\n oklab: toOklabConverters,\n oklch: toOklchConverters,\n rgb: toRgbConverters\n};\nfunction convertFromCSS(value, output) {\n const { alpha, model, ...color } = extractColorParts(value);\n if ([\"oklab\", \"oklch\"].includes(model) && color.l > 1) {\n color.l = round(color.l / 100, PRECISION);\n }\n const colorTuple = Object.values(color);\n if (output === \"hex\") {\n const alphaPrefix = alpha ? convertAlphaToHex(alpha) : \"\";\n return `${toHexConverters[model](colorTuple)}${alphaPrefix}`;\n }\n const converter = converterTables[output]?.[model];\n return addAlpha(\n converter ? converter(colorTuple) : color,\n alpha\n );\n}\nfunction convertFromHex(value, output) {\n const alpha = extractAlphaFromHex(value);\n if (output === \"hex\") {\n return `${removeAlphaFromHex(value)}${alpha !== 1 ? convertAlphaToHex(alpha) : \"\"}`;\n }\n return addAlpha(fromHexConverters[output](value), alpha);\n}\nfunction parseCSS(input, format) {\n invariant(isString(input), MESSAGES.inputString);\n const value = isNamedColor(input) ? cssColors[input.toLowerCase()] : input;\n const output = format ?? (isHex(value) ? \"hex\" : extractColorParts(value).model);\n if (isHex(value)) {\n return convertFromHex(value, output);\n }\n return convertFromCSS(value, output);\n}\n\n// src/apca.ts\nvar APCA_VERSION = \"0.0.98G-4g\";\nvar mainTRC = 2.4;\nvar normBG = 0.56;\nvar normTXT = 0.57;\nvar revBG = 0.65;\nvar revTXT = 0.62;\nvar sRco = 0.2126729;\nvar sGco = 0.7151522;\nvar sBco = 0.072175;\nvar blkThreshold = 0.022;\nvar blkClamp = 1.414;\nvar scaleBoW = 1.14;\nvar scaleWoB = 1.14;\nvar loBoWOffset = 0.027;\nvar loWoBOffset = 0.027;\nvar loClip = 0.1;\nvar deltaYmin = 5e-4;\nfunction softClamp(Y) {\n return Y > blkThreshold ? Y : Y + (blkThreshold - Y) ** blkClamp;\n}\nfunction sRGBtoY(r, g, b) {\n return sRco * (r / 255) ** mainTRC + sGco * (g / 255) ** mainTRC + sBco * (b / 255) ** mainTRC;\n}\nfunction apcaContrast(background, foreground) {\n invariant(isString(background), MESSAGES.inputString);\n invariant(isString(foreground), MESSAGES.inputString);\n const bg = hex2rgb(parseCSS(background, \"hex\"));\n const fg = hex2rgb(parseCSS(foreground, \"hex\"));\n const txtY = softClamp(sRGBtoY(fg.r, fg.g, fg.b));\n const bgY = softClamp(sRGBtoY(bg.r, bg.g, bg.b));\n if (Math.abs(bgY - txtY) < deltaYmin) {\n return 0;\n }\n const SAPC = bgY > txtY ? (bgY ** normBG - txtY ** normTXT) * scaleBoW : (bgY ** revBG - txtY ** revTXT) * scaleWoB;\n if (Math.abs(SAPC) < loClip) {\n return 0;\n }\n const Lc = SAPC > 0 ? (SAPC - loBoWOffset) * 100 : (SAPC + loWoBOffset) * 100;\n return round(Lc, 5);\n}\n\n// src/brightness-difference.ts\nfunction brightnessDifference(left, right, precision = PRECISION) {\n invariant(isString(left), MESSAGES.left);\n invariant(isString(right), MESSAGES.right);\n const RGBLeft = parseCSS(left, \"rgb\");\n const RGBRight = parseCSS(right, \"rgb\");\n const brightnessLeft = (RGBLeft.r * 299 + RGBLeft.g * 587 + RGBLeft.b * 114) / 1e3;\n const brightnessRight = (RGBRight.r * 299 + RGBRight.g * 587 + RGBRight.b * 114) / 1e3;\n return round(Math.abs(brightnessRight - brightnessLeft), precision);\n}\n\n// src/chroma.ts\nfunction chroma(input) {\n invariant(isString(input), MESSAGES.inputString);\n const { r, g, b } = parseCSS(input, \"rgb\");\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n return round((max - min) / 255, 4);\n}\n\n// src/color-difference.ts\nfunction colorDifference(left, right) {\n invariant(isString(left), MESSAGES.left);\n invariant(isString(right), MESSAGES.right);\n const RGBLeft = parseCSS(left, \"rgb\");\n const RGBRight = parseCSS(right, \"rgb\");\n return Math.max(RGBLeft.r, RGBRight.r) - Math.min(RGBLeft.r, RGBRight.r) + (Math.max(RGBLeft.g, RGBRight.g) - Math.min(RGBLeft.g, RGBRight.g)) + (Math.max(RGBLeft.b, RGBRight.b) - Math.min(RGBLeft.b, RGBRight.b));\n}\n\n// src/luminance.ts\nfunction luminance(input) {\n invariant(isString(input), MESSAGES.inputString);\n const { r, g, b } = parseCSS(input, \"rgb\");\n const rgb = [r / 255, g / 255, b / 255];\n for (let index = 0; index < rgb.length; index++) {\n if (rgb[index] <= 0.04045) {\n rgb[index] /= 12.92;\n } else {\n rgb[index] = ((rgb[index] + 0.055) / 1.055) ** 2.4;\n }\n }\n return round(0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2], 4);\n}\n\n// src/contrast.ts\nfunction contrast(left, right) {\n invariant(isString(left), MESSAGES.left);\n invariant(isString(right), MESSAGES.right);\n const LuminanceLeft = luminance(left);\n const LuminanceRight = luminance(right);\n return round(\n LuminanceLeft >= LuminanceRight ? (LuminanceLeft + 0.05) / (LuminanceRight + 0.05) : (LuminanceRight + 0.05) / (LuminanceLeft + 0.05)\n );\n}\n\n// src/compare.ts\nfunction compare(left, right) {\n invariant(isString(left), MESSAGES.left);\n invariant(isString(right), MESSAGES.right);\n const colorThreshold = 500;\n const brightnessThreshold = 125;\n const colorDifference2 = colorDifference(left, right);\n const contrast2 = contrast(left, right);\n const brightnessDifference2 = brightnessDifference(left, right);\n const isBright = brightnessDifference2 >= brightnessThreshold;\n const hasEnoughDifference = colorDifference2 >= colorThreshold;\n let compliant = 0;\n if (isBright && hasEnoughDifference) {\n compliant = 2;\n } else if (isBright || hasEnoughDifference) {\n compliant = 1;\n }\n return {\n brightnessDifference: brightnessDifference2,\n colorDifference: colorDifference2,\n compliant,\n contrast: contrast2,\n largeAA: contrast2 >= 3,\n largeAAA: contrast2 >= 4.5,\n normalAA: contrast2 >= 4.5,\n normalAAA: contrast2 >= 7\n };\n}\n\n// src/format-css.ts\nfunction getColorModel(input) {\n if (isHex(input) || isNamedColor(input)) {\n return \"hex\";\n }\n if (isHSL(input)) {\n return \"hsl\";\n }\n if (isLAB(input)) {\n return \"oklab\";\n }\n if (isLCH(input)) {\n return \"oklch\";\n }\n if (isRGB(input)) {\n return \"rgb\";\n }\n throw new Error(MESSAGES.invalid);\n}\nfunction getColorValue(input, output) {\n const value = isNamedColor(input) ? cssColors[input.toLowerCase()] : input;\n const from = getColorModel(value);\n if (from === output) {\n return value;\n }\n const converterKey = `${from}2${output}`;\n const converter = converters_exports[converterKey];\n if (!converter) {\n throw new Error(`Converter not found for ${from} to ${output}`);\n }\n return converter(value);\n}\nfunction formatCSS(input, options = {}) {\n invariant(isHex(input) || isValidColorModel(input), MESSAGES.invalid);\n const { alpha, format = \"hex\", precision = PRECISION, separator: baseSeparator = \" \" } = options;\n const opacity2 = alpha && alpha !== 1 ? `${round(alpha * 100)}%` : null;\n let params = [];\n let separator = baseSeparator;\n switch (format) {\n case \"hsl\": {\n const { h, s, l } = getColorValue(input, \"hsl\");\n params = [h, `${s}%`, `${l}%`];\n break;\n }\n case \"oklab\": {\n separator = \" \";\n const { l, a, b } = restrictValues(getColorValue(input, \"oklab\"), precision);\n params = [`${round(l * 100, precision)}%`, a, b];\n break;\n }\n case \"oklch\": {\n separator = \" \";\n const { l, c, h } = restrictValues(getColorValue(input, \"oklch\"), precision);\n params = [`${round(l * 100, precision)}%`, c, h];\n break;\n }\n case \"rgb\": {\n const { r, g, b } = getColorValue(input, \"rgb\");\n params = [r, g, b];\n break;\n }\n default: {\n const hex = removeAlphaFromHex(getColorValue(input, \"hex\"));\n if (alpha && alpha !== 1) {\n return `${hex}${convertAlphaToHex(alpha)}`;\n }\n return hex;\n }\n }\n return `${format}(${params.join(separator)}${opacity2 ? ` / ${opacity2}` : \"\"})`;\n}\n\n// src/modules/updater.ts\nfunction updater(key, operator, format) {\n return (input, amount) => {\n invariant(isString(input), MESSAGES.inputString);\n invariant(isNumberInRange(amount, 0, 100), MESSAGES.amount);\n const color = parseCSS(input, \"hsl\");\n const output = isHex(input) || isNamedColor(input) ? \"hex\" : extractColorParts(input).model;\n return formatCSS(\n {\n ...color,\n [key]: clamp(color[key] + (operator === \"+\" ? amount : -amount), 0, 100)\n },\n { format: format ?? output }\n );\n };\n}\n\n// src/darken.ts\nfunction darken(input, amount, format) {\n return updater(\"l\", \"-\", format)(input, amount);\n}\n\n// src/desaturate.ts\nfunction desaturate(input, amount, format) {\n return updater(\"s\", \"-\", format)(input, amount);\n}\n\n// src/grayscale.ts\nfunction grayscale(input, format) {\n invariant(isString(input), MESSAGES.inputString);\n const output = isHex(input) || isNamedColor(input) ? \"hex\" : extractColorParts(input).model;\n const lch = parseCSS(input, \"oklch\");\n return formatCSS({ ...lch, c: 0 }, { format: format ?? output, alpha: lch.alpha });\n}\n\n// src/rotate.ts\nfunction rotate(input, degrees, format) {\n invariant(isString(input), MESSAGES.inputString);\n invariant(isNumberInRange(degrees, -360, 360), MESSAGES.degreesRange);\n const color = parseCSS(input, \"hsl\");\n const output = isHex(input) || isNamedColor(input) ? \"hex\" : extractColorParts(input).model;\n return formatCSS(\n {\n ...color,\n h: constrainDegrees(color.h, degrees)\n },\n { format: format ?? output }\n );\n}\n\n// src/invert.ts\nfunction invert(input) {\n invariant(isString(input), MESSAGES.inputString);\n const format = isHex(input) || isNamedColor(input) ? \"hex\" : extractColorParts(input).model;\n const hex = parseCSS(input, \"hex\");\n return formatCSS(rotate(hex, 180), { format });\n}\n\n// src/lighten.ts\nfunction lighten(input, amount, format) {\n return updater(\"l\", \"+\", format)(input, amount);\n}\n\n// src/mix.ts\nfunction interpolateHue(h1, h2, c1, c2, ratio) {\n if (c1 < 1e-4) {\n return h2;\n }\n if (c2 < 1e-4) {\n return h1;\n }\n let diff = h2 - h1;\n if (diff > 180) {\n diff -= 360;\n } else if (diff < -180) {\n diff += 360;\n }\n let result = h1 + diff * ratio;\n if (result < 0) {\n result += 360;\n } else if (result >= 360) {\n result -= 360;\n }\n return result;\n}\nfunction mix(color1, color2, ratio = 0.5, format) {\n invariant(isString(color1), MESSAGES.inputString);\n invariant(isString(color2), MESSAGES.inputString);\n invariant(isNumberInRange(ratio, 0, 1), MESSAGES.ratioRange);\n const output = isHex(color1) || isNamedColor(color1) ? \"hex\" : extractColorParts(color1).model;\n const lch1 = parseCSS(color1, \"oklch\");\n const lch2 = parseCSS(color2, \"oklch\");\n const l = lch1.l + (lch2.l - lch1.l) * ratio;\n const c = lch1.c + (lch2.c - lch1.c) * ratio;\n const h = interpolateHue(lch1.h, lch2.h, lch1.c, lch2.c, ratio);\n const alpha1 = lch1.alpha ?? 1;\n const alpha2 = lch2.alpha ?? 1;\n const alpha = alpha1 + (alpha2 - alpha1) * ratio;\n return formatCSS({ l, c, h }, { format: format ?? output, alpha: alpha < 1 ? alpha : void 0 });\n}\n\n// src/modules/parse-color.ts\nfunction parseColor(color) {\n invariant(!!color, MESSAGES.input);\n const output = {};\n if (isString(color)) {\n const { alpha = 1 } = extractColorParts(color);\n const type = isHex(color) ? \"hex\" : extractColorParts(color).model;\n output.hex = addAlphaToHex(parseCSS(color, \"hex\"), alpha);\n output.hsl = addAlpha(parseCSS(color, \"hsl\"), alpha);\n output.oklab = addAlpha(parseCSS(color, \"oklab\"), alpha);\n output.oklch = addAlpha(parseCSS(color, \"oklch\"), alpha);\n output.rgb = addAlpha(parseCSS(color, \"rgb\"), alpha);\n output.alpha = alpha;\n output.type = type;\n } else if (isPlainObject(color)) {\n const { alpha = 1 } = color;\n if (isHSL(color)) {\n output.hsl = {\n h: limit(color.h, \"hsl\", \"h\"),\n s: limit(color.s, \"hsl\", \"s\"),\n l: limit(color.l, \"hsl\", \"l\")\n };\n output.rgb = hsl2rgb(output.hsl);\n output.oklab = hsl2oklab(output.hsl);\n output.oklch = hsl2oklch(output.hsl);\n output.type = \"hsl\";\n } else if (isLAB(color)) {\n output.hsl = oklab2hsl(color);\n output.oklab = color;\n output.oklch = oklab2oklch(color);\n output.rgb = oklab2rgb(color);\n output.type = \"oklab\";\n } else if (isLCH(color)) {\n output.hsl = oklch2hsl(color);\n output.oklab = oklch2oklab(color);\n output.oklch = color;\n output.rgb = oklch2rgb(color);\n output.type = \"oklch\";\n } else if (isRGB(color)) {\n output.rgb = {\n r: limit(color.r, \"rgb\", \"r\"),\n g: limit(color.g, \"rgb\", \"g\"),\n b: limit(color.b, \"rgb\", \"b\")\n };\n output.hsl = rgb2hsl(output.rgb);\n output.oklab = rgb2oklab(output.rgb);\n output.oklch = rgb2oklch(output.rgb);\n output.type = \"rgb\";\n } else {\n throw new Error(\"invalid color\");\n }\n output.hex = addAlphaToHex(hsl2hex(output.hsl), alpha);\n output.hsl = addAlpha(output.hsl, alpha);\n output.oklab = addAlpha(output.oklab, alpha);\n output.oklch = addAlpha(output.oklch, alpha);\n output.rgb = addAlpha(output.rgb, alpha);\n output.alpha = alpha;\n } else {\n throw new Error(MESSAGES.input);\n }\n return output;\n}\n\n// src/opacify.ts\nfunction opacify(input, alpha, format) {\n invariant(isString(input), MESSAGES.inputString);\n invariant(isNumberInRange(alpha, 0, 1), MESSAGES.alpha);\n const type = isHex(input) || isNamedColor(input) ? \"hex\" : extractColorParts(input).model;\n const rgb = parseCSS(input, \"rgb\");\n return formatCSS(rgb, { format: format ?? type, alpha });\n}\n\n// src/opacity.ts\nfunction opacity(input) {\n invariant(isString(input), MESSAGES.inputString);\n if (isHex(input)) {\n return extractAlphaFromHex(input);\n } else if (Object.keys(cssColors).includes(input)) {\n return 1;\n }\n const { alpha } = extractColorParts(input);\n if (!alpha) {\n return 1;\n }\n return alpha;\n}\n\n// src/readable-color.ts\nfunction pickByContrast(darkContrast, lightContrast, darkColor, lightColor) {\n return darkContrast >= lightContrast ? darkColor : lightColor;\n}\nfunction readableColor(backgroundColor, options = {}) {\n const { darkColor = \"#000000\", lightColor = \"#ffffff\", method = \"yiq\", threshold } = options;\n invariant(isString(backgroundColor), MESSAGES.inputString);\n switch (method) {\n case \"yiq\": {\n const yiqThreshold = threshold ?? 128;\n invariant(yiqThreshold >= 0 && yiqThreshold <= 255, MESSAGES.threshold);\n const { r, g, b } = hex2rgb(parseCSS(backgroundColor, \"hex\"));\n const yiq = (r * 299 + g * 587 + b * 114) / 1e3;\n return yiq >= yiqThreshold ? darkColor : lightColor;\n }\n case \"wcag\": {\n const wcagThreshold = threshold ?? 0.5;\n invariant(wcagThreshold >= 0 && wcagThreshold <= 1, MESSAGES.thresholdNormalized);\n const lum = luminance(backgroundColor);\n return lum >= wcagThreshold ? darkColor : lightColor;\n }\n case \"contrast\": {\n const darkContrast = contrast(darkColor, backgroundColor);\n const lightContrast = contrast(lightColor, backgroundColor);\n return pickByContrast(darkContrast, lightContrast, darkColor, lightColor);\n }\n case \"oklab\": {\n const oklabThreshold = threshold ?? 0.5;\n invariant(oklabThreshold >= 0 && oklabThreshold <= 1, MESSAGES.thresholdNormalized);\n const { l } = hex2oklab(parseCSS(backgroundColor, \"hex\"));\n return l >= oklabThreshold ? darkColor : lightColor;\n }\n case \"apca\": {\n const darkContrast = Math.abs(apcaContrast(backgroundColor, darkColor));\n const lightContrast = Math.abs(apcaContrast(backgroundColor, lightColor));\n return pickByContrast(darkContrast, lightContrast, darkColor, lightColor);\n }\n /* v8 ignore next 3 -- @preserve */\n default: {\n throw new Error(`Unknown method: ${method}`);\n }\n }\n}\n\n// src/saturate.ts\nfunction saturate(input, amount, format) {\n return updater(\"s\", \"+\", format)(input, amount);\n}\n\n// src/transparentize.ts\nfunction transparentize(input, alpha, format) {\n invariant(isString(input), MESSAGES.inputString);\n invariant(isNumberInRange(alpha, -1, 1), MESSAGES.alphaAdjustment);\n const oklch = parseCSS(input, \"oklab\");\n const value = round(clamp(opacity(input) - alpha, 0, 1));\n return formatCSS(oklch, { format, alpha: value });\n}\n\n// src/colorizr.ts\nvar Colorizr = class {\n constructor(color, options = {}) {\n /** The alpha/opacity value (0-1). */\n __publicField(this, \"alpha\");\n __publicField(this, \"hex\");\n __publicField(this, \"hsl\");\n __publicField(this, \"oklab\");\n __publicField(this, \"oklch\");\n __publicField(this, \"rgb\");\n __publicField(this, \"type\");\n invariant(!!color, MESSAGES.colorRequired);\n const { alpha, hex, hsl, oklab, oklch, rgb, type } = parseColor(color);\n this.hex = hex;\n this.hsl = hsl;\n this.oklab = oklab;\n this.oklch = oklch;\n this.rgb = rgb;\n this.alpha = alpha;\n this.type = options.format ?? type;\n }\n /**\n * Get CSS string\n */\n get css() {\n return this.currentColor;\n }\n /**\n * Get the red value\n */\n get red() {\n return this.rgb.r;\n }\n /**\n * Get the green value\n */\n get green() {\n return this.rgb.g;\n }\n /**\n * Get the blue value\n */\n get blue() {\n return this.rgb.b;\n }\n /**\n * Get the hue value\n */\n get hue() {\n return this.hsl.h;\n }\n /**\n * Get the saturation value\n */\n get saturation() {\n return this.hsl.s;\n }\n /**\n * Get the lightness value\n */\n get lightness() {\n return this.hsl.l;\n }\n /**\n * Get the luminance value\n */\n get luminance() {\n return luminance(this.currentColor);\n }\n /**\n * Get the chroma value\n */\n get chroma() {\n return chroma(this.currentColor);\n }\n get opacity() {\n return opacity(this.currentColor);\n }\n /**\n * Get the most readable color (light or dark) for this color as a background.\n */\n get readableColor() {\n return readableColor(this.currentColor);\n }\n get currentColor() {\n return formatCSS(this[this.type], { format: this.type, alpha: this.alpha });\n }\n /**\n * Get the brightness difference between this color and another.\n *\n * @param input - The color to compare against.\n * @returns The brightness difference value.\n */\n brightnessDifference(input) {\n return brightnessDifference(this.currentColor, input);\n }\n /**\n * Get the color difference between this color and another.\n *\n * @param input - The color to compare against.\n * @returns The color difference value.\n */\n colorDifference(input) {\n return colorDifference(this.currentColor, input);\n }\n /**\n * Test 2 colors for WCAG compliance.\n *\n * @param input - The color to compare against.\n * @returns Analysis object with compliance information.\n */\n compare(input) {\n return compare(this.currentColor, input);\n }\n /**\n * Get the contrast ratio between this color and another.\n *\n * @param input - The color to compare against.\n * @returns The contrast ratio.\n */\n contrast(input) {\n return contrast(this.currentColor, input);\n }\n /**\n * Format the color to a specific type.\n *\n * @param type - The color format to convert to.\n * @param precision - The decimal precision for the output.\n * @returns The formatted color string.\n */\n format(type, precision) {\n return formatCSS(this.rgb, {\n alpha: this.alpha,\n format: type,\n precision\n });\n }\n /**\n * Increase lightness.\n *\n * @param amount - A number between 0 and 100.\n * @returns The lightened color string.\n */\n lighten(amount) {\n return lighten(this.currentColor, amount);\n }\n /**\n * Decrease lightness.\n *\n * @param amount - A number between 0 and 100.\n * @returns The darkened color string.\n */\n darken(amount) {\n return darken(this.currentColor, amount);\n }\n /**\n * Increase saturation.\n *\n * @param amount - A number between 0 and 100.\n * @returns The saturated color string.\n */\n saturate(amount) {\n return saturate(this.currentColor, amount);\n }\n /**\n * Decrease saturation.\n *\n * @param amount - A number between 0 and 100.\n * @returns The desaturated color string.\n */\n desaturate(amount) {\n return desaturate(this.currentColor, amount);\n }\n /**\n * Convert to grayscale.\n *\n * @returns The grayscale color string.\n */\n grayscale() {\n return grayscale(this.currentColor);\n }\n /**\n * Invert color.\n *\n * @returns The inverted color string.\n */\n invert() {\n return invert(this.currentColor);\n }\n /**\n * Mix with another color.\n *\n * @param color - The color to mix with.\n * @param ratio - A number between 0 and 1 (0 = this color, 1 = input color).\n * @returns The mixed color string.\n */\n mix(color, ratio) {\n return mix(this.currentColor, color, ratio);\n }\n /**\n * Add opacity to the color.\n *\n * @param alpha - A number between 0 and 1.\n * @returns The opacified color string.\n */\n opacify(alpha = 0.9) {\n return opacify(this.currentColor, alpha, this.type);\n }\n /**\n * Rotate color hue.\n *\n * @param degrees - A number between -360 and 360.\n * @returns The rotated color string.\n */\n rotate(degrees) {\n return rotate(this.currentColor, degrees);\n }\n /**\n * Make the color more transparent.\n *\n * @param alpha - A number between -1 and 1.\n * @returns The transparentized color string.\n */\n transparentize(alpha = 0.1) {\n return transparentize(this.currentColor, alpha, this.type);\n }\n};\n\n// src/convert.ts\nfunction convert(input, format) {\n const value = parseCSS(input, format);\n return formatCSS(value, { format });\n}\n\n// src/get-color-type.ts\nfunction getColorType(input) {\n if (!isString(input)) {\n return null;\n }\n if (isHex(input)) {\n return \"hex\";\n }\n if (isNamedColor(input)) {\n return \"named\";\n }\n try {\n const { model } = extractColorParts(input);\n return model;\n } catch {\n return null;\n }\n}\n\n// src/is-valid-color.ts\nfunction isValidColor(input, type) {\n const detectedType = getColorType(input);\n if (detectedType === null) {\n return false;\n }\n if (type === void 0) {\n return true;\n }\n return detectedType === type;\n}\n\n// src/name.ts\nfunction name(input) {\n invariant(isString(input), MESSAGES.inputString);\n const hex = parseCSS(input, \"hex\");\n const [color] = Object.entries(cssColors).find(([, value]) => value === hex) || [];\n return color ?? hex;\n}\n\n// src/p3.ts\nfunction isInP3Gamut(color) {\n const epsilon = 1e-6;\n return color.every((component) => component >= 0 - epsilon && component <= 1 + epsilon);\n}\nfunction multiplyMatrix(matrix, vector) {\n return [\n matrix[0][0] * vector[0] + matrix[0][1] * vector[1] + matrix[0][2] * vector[2],\n matrix[1][0] * vector[0] + matrix[1][1] * vector[1] + matrix[1][2] * vector[2],\n matrix[2][0] * vector[0] + matrix[2][1] * vector[1] + matrix[2][2] * vector[2]\n ];\n}\nfunction oklabToLinearP3(L, a, b) {\n const srgb = oklabToLinearSRGB(L, a, b);\n return multiplyMatrix(SRGB_TO_P3, srgb);\n}\nfunction oklabToLinearSRGB(L, a, b) {\n const l = (L + LAB_TO_LMS.l[0] * a + LAB_TO_LMS.l[1] * b) ** 3;\n const m = (L + LAB_TO_LMS.m[0] * a + LAB_TO_LMS.m[1] * b) ** 3;\n const s = (L + LAB_TO_LMS.s[0] * a + LAB_TO_LMS.s[1] * b) ** 3;\n return [\n LSM_TO_RGB.r[0] * l + LSM_TO_RGB.r[1] * m + LSM_TO_RGB.r[2] * s,\n LSM_TO_RGB.g[0] * l + LSM_TO_RGB.g[1] * m + LSM_TO_RGB.g[2] * s,\n LSM_TO_RGB.b[0] * l + LSM_TO_RGB.b[1] * m + LSM_TO_RGB.b[2] * s\n ];\n}\nfunction getOkLCHMaxChroma(input, precision = PRECISION) {\n const { l, h } = isString(input) ? parseCSS(input, \"oklch\") : input;\n invariant(isNumberInRange(l, 0, 1), MESSAGES.lightnessRange);\n invariant(isNumberInRange(h, 0, 360), MESSAGES.hueRange);\n const epsilon = 1e-6;\n let low = 0;\n let high = 0.5;\n while (high - low > epsilon) {\n const mid = (low + high) / 2;\n const { l: L, a, b } = oklch2oklab({ l, c: mid, h }, 16);\n const p3Color = oklabToLinearP3(L, a, b);\n if (isInP3Gamut(p3Color)) {\n low = mid;\n } else {\n high = mid;\n }\n }\n return round(low, precision);\n}\nfunction getP3MaxColor(input) {\n const lch = isString(input) ? parseCSS(input, \"oklch\") : input;\n return `oklch(${lch.l} ${getOkLCHMaxChroma(lch)} ${lch.h})`;\n}\n\n// src/palette.ts\nfunction palette(input, options = {}) {\n invariant(isString(input), MESSAGES.inputString);\n invariant(isPlainObject(options), MESSAGES.options);\n const { format, lightness, saturation, size = 6, type } = options;\n invariant(size >= 2, MESSAGES.paletteSize);\n const hsl = parseCSS(input, \"hsl\");\n const colorFormat = isHex(input) || isNamedColor(input) ? \"hex\" : extractColorParts(input).model;\n const output = [];\n if (type === \"monochromatic\") {\n const step = MONOCHROMATIC_LIGHTNESS_MAX / size;\n for (let index = size; index > 0; index--) {\n output.push(hsl2hex({ ...hsl, l: step * index }));\n }\n } else {\n const step = 360 / size;\n output.push(hsl2hex({ ...hsl, l: lightness ?? hsl.l, s: saturation ?? hsl.s }));\n for (let index = 1; index < size; index++) {\n const color = rotate(input, step * index, \"hex\");\n output.push(hsl2hex({ ...hex2hsl(color), l: lightness ?? hsl.l, s: saturation ?? hsl.s }));\n }\n }\n return output.map((color) => convert(color, format ?? colorFormat));\n}\n\n// src/random.ts\nfunction randomInRange(min, max, wrapAt) {\n if (wrapAt && min > max) {\n const range = wrapAt - min + max;\n const value = min + Math.floor(Math.random() * range);\n return value >= wrapAt ? value - wrapAt : value;\n }\n return min + Math.floor(Math.random() * (max - min + 1));\n}\nfunction random(options = {}) {\n const { format = \"hex\" } = options;\n const minHue = clamp(options.minHue ?? 0, 0, 360);\n const maxHue = clamp(options.maxHue ?? 360, 0, 360);\n const minSaturation = clamp(options.minSaturation ?? 10, 0, 100);\n const maxSaturation = clamp(options.maxSaturation ?? 100, 0, 100);\n const minLightness = clamp(options.minLightness ?? 10, 0, 100);\n const maxLightness = clamp(options.maxLightness ?? 90, 0, 100);\n const hsl = {\n h: randomInRange(minHue, maxHue, 360),\n s: randomInRange(\n Math.min(minSaturation, maxSaturation),\n Math.max(minSaturation, maxSaturation)\n ),\n l: randomInRange(Math.min(minLightness, maxLightness), Math.max(minLightness, maxLightness))\n };\n return formatCSS(hsl, { format });\n}\n\n// src/readable-color-apca.ts\nfunction readableColorAPCA(backgroundColor, options = {}) {\n const { darkColor = \"#000000\", lightColor = \"#ffffff\" } = options;\n invariant(isString(backgroundColor), MESSAGES.inputString);\n const darkContrast = Math.abs(apcaContrast(backgroundColor, darkColor));\n const lightContrast = Math.abs(apcaContrast(backgroundColor, lightColor));\n return darkContrast >= lightContrast ? darkColor : lightColor;\n}\n\n// src/scale.ts\nvar chromaScale = {\n deep: 0.8,\n neutral: 0.5,\n pastel: 0.3,\n subtle: 0.2,\n vibrant: 1.25\n};\nfunction generatePalette(options) {\n const {\n baseChroma,\n chromaCurve,\n hue,\n inputLightness,\n keys,\n lightnessCurve,\n lock,\n maxLightness,\n minLightness,\n mode\n } = options;\n const palette2 = {};\n const lightnessMap = {};\n if (lock !== void 0 && inputLightness !== void 0) {\n const lockIndex = keys.indexOf(lock);\n lightnessMap[lock] = inputLightness;\n if (lockIndex > 0) {\n const target = mode === \"light\" ? maxLightness : minLightness;\n for (let index = 0; index < lockIndex; index++) {\n const t = index / lockIndex;\n lightnessMap[keys[index]] = target + (inputLightness - target) * t ** lightnessCurve;\n }\n }\n const remaining = keys.length - 1 - lockIndex;\n if (remaining > 0) {\n const target = mode === \"light\" ? minLightness : maxLightness;\n for (let index = lockIndex + 1; index < keys.length; index++) {\n const t = (index - lockIndex) / remaining;\n lightnessMap[keys[index]] = inputLightness + (target - inputLightness) * t ** lightnessCurve;\n }\n }\n } else {\n for (let index = 0; index < keys.length; index++) {\n const t = (index / (keys.length - 1)) ** lightnessCurve;\n lightnessMap[keys[index]] = mode === \"light\" ? maxLightness - (maxLightness - minLightness) * t : minLightness + (maxLightness - minLightness) * t;\n }\n }\n for (const key of keys) {\n const lightness = lightnessMap[key];\n const chroma2 = getStepChroma(lightness, baseChroma, chromaCurve);\n const maxChroma = getOkLCHMaxChroma({ l: lightness, c: 0, h: hue });\n palette2[key] = { l: lightness, c: Math.min(chroma2, maxChroma), h: hue };\n }\n return palette2;\n}\nfunction getStepChroma(lightness, baseChroma, chromaCurve) {\n if (chromaCurve === 0) {\n return baseChroma;\n }\n const parabolic = 4 * lightness * (1 - lightness);\n const curveScale = 1 - chromaCurve * (1 - parabolic);\n return baseChroma * curveScale;\n}\nfunction scale(input, options = {}) {\n invariant(isString(input), MESSAGES.inputString);\n const {\n chromaCurve = 0,\n format,\n lightnessCurve = 1.5,\n lock: lockOption,\n maxLightness = 0.97,\n minLightness = 0.2,\n mode = \"light\",\n saturation,\n steps: stepsOption,\n variant\n } = options;\n invariant(\n maxLightness > minLightness && maxLightness <= 1 && minLightness >= 0,\n \"maxLightness must be greater than minLightness and within the range [0, 1].\"\n );\n const steps = stepsOption !== void 0 ? clamp(Math.round(stepsOption), 3, 20) : 11;\n const keys = getScaleStepKeys(steps);\n let lock = lockOption;\n if (lock !== void 0) {\n if (!isNumber(lock) || !keys.includes(lock)) {\n warn(`lock: ${lock} is not valid for steps: ${steps}, ignoring`);\n lock = void 0;\n }\n }\n const lch = parseCSS(input, \"oklch\");\n let baseChroma;\n if (saturation !== void 0) {\n const maxChroma = getOkLCHMaxChroma(lch);\n baseChroma = clamp(saturation, 0, 100) / 100 * maxChroma;\n } else if (variant && chromaScale[variant]) {\n baseChroma = lch.c * chromaScale[variant];\n } else {\n baseChroma = lch.c;\n }\n const detectedType = getColorType(input);\n let colorFormat = \"hex\";\n if (detectedType) {\n colorFormat = detectedType === \"named\" ? \"hex\" : detectedType;\n }\n const palette2 = generatePalette({\n baseChroma,\n chromaCurve,\n hue: lch.h,\n inputLightness: lock !== void 0 ? lch.l : void 0,\n keys,\n lightnessCurve,\n lock,\n maxLightness,\n minLightness,\n mode\n });\n return Object.fromEntries(\n Object.entries(palette2).map(([key, value]) => [\n key,\n formatCSS(value, { format: format ?? colorFormat })\n ])\n );\n}\n\n// src/scheme.ts\nfunction scheme(input, typeOrOptions) {\n invariant(isString(input), MESSAGES.inputString);\n const { format, type = \"complementary\" } = isString(typeOrOptions) ? { type: typeOrOptions } : typeOrOptions ?? {};\n const output = isHex(input) || isNamedColor(input) ? \"hex\" : extractColorParts(input).model;\n const colors = [];\n switch (type) {\n case \"analogous\": {\n colors.push(rotate(input, -30), input, rotate(input, 30));\n break;\n }\n case \"complementary\": {\n colors.push(input, rotate(input, 180));\n break;\n }\n case \"split\":\n case \"split-complementary\": {\n colors.push(input, rotate(input, 150), rotate(input, 210));\n break;\n }\n case \"triadic\": {\n colors.push(input, rotate(input, 120), rotate(input, 240));\n break;\n }\n case \"tetradic\":\n case \"rectangle\": {\n colors.push(input, rotate(input, 60), rotate(input, 180), rotate(input, 240));\n break;\n }\n case \"square\": {\n colors.push(input, rotate(input, 90), rotate(input, 180), rotate(input, 270));\n break;\n }\n default: {\n throw new TypeError(\"invalid type\");\n }\n }\n return colors.map((color) => convert(color, format ?? output));\n}\nexport {\n APCA_VERSION,\n addAlphaToHex,\n apcaContrast,\n brightnessDifference,\n chroma,\n colorDifference,\n compare,\n contrast,\n convert,\n convertAlphaToHex,\n darken,\n Colorizr as default,\n desaturate,\n extractAlphaFromHex,\n extractColorParts,\n formatCSS,\n formatHex,\n getColorType,\n getOkLCHMaxChroma,\n getP3MaxColor,\n getScaleStepKeys,\n grayscale,\n hex2hsl,\n hex2oklab,\n hex2oklch,\n hex2rgb,\n hexadecimalToNumber,\n hsl2hex,\n hsl2oklab,\n hsl2oklch,\n hsl2rgb,\n invert,\n isHSL,\n isHex,\n isLAB,\n isLCH,\n isRGB,\n isValidColor,\n lighten,\n luminance,\n mix,\n name,\n oklab2hex,\n oklab2hsl,\n oklab2oklch,\n oklab2rgb,\n oklch2hex,\n oklch2hsl,\n oklch2oklab,\n oklch2rgb,\n opacify,\n opacity,\n palette,\n parseCSS,\n random,\n readableColor,\n readableColorAPCA,\n removeAlphaFromHex,\n rgb2hex,\n rgb2hsl,\n rgb2oklab,\n rgb2oklch,\n rotate,\n saturate,\n scale,\n scheme,\n transparentize\n};\n/* v8 ignore next 3 -- @preserve */\n//# sourceMappingURL=index.mjs.map","/*! choices.js v11.2.1 | © 2026 Josh Johnson | https://github.com/Choices-js/Choices#readme */\n\n/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\n/* global Reflect, Promise, SuppressedError, Symbol */\n\nvar extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];\n };\n return extendStatics(d, b);\n};\nfunction __extends(d, b) {\n if (typeof b !== \"function\" && b !== null) throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() {\n this.constructor = d;\n }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\nvar __assign = function () {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nfunction __spreadArray(to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n}\ntypeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\n var e = new Error(message);\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\n};\n\nvar ActionType = {\n ADD_CHOICE: 'ADD_CHOICE',\n REMOVE_CHOICE: 'REMOVE_CHOICE',\n FILTER_CHOICES: 'FILTER_CHOICES',\n ACTIVATE_CHOICES: 'ACTIVATE_CHOICES',\n CLEAR_CHOICES: 'CLEAR_CHOICES',\n ADD_GROUP: 'ADD_GROUP',\n ADD_ITEM: 'ADD_ITEM',\n REMOVE_ITEM: 'REMOVE_ITEM',\n HIGHLIGHT_ITEM: 'HIGHLIGHT_ITEM',\n};\n\nvar EventType = {\n showDropdown: 'showDropdown',\n hideDropdown: 'hideDropdown',\n change: 'change',\n choice: 'choice',\n search: 'search',\n addItem: 'addItem',\n removeItem: 'removeItem',\n highlightItem: 'highlightItem',\n highlightChoice: 'highlightChoice',\n unhighlightItem: 'unhighlightItem',\n};\n\nvar KeyCodeMap = {\n TAB_KEY: 9,\n SHIFT_KEY: 16,\n BACK_KEY: 46,\n DELETE_KEY: 8,\n ENTER_KEY: 13,\n A_KEY: 65,\n ESC_KEY: 27,\n UP_KEY: 38,\n DOWN_KEY: 40,\n PAGE_UP_KEY: 33,\n PAGE_DOWN_KEY: 34,\n};\n\nvar ObjectsInConfig = ['fuseOptions', 'classNames'];\n\nvar PassedElementTypes = {\n Text: 'text',\n SelectOne: 'select-one',\n SelectMultiple: 'select-multiple',\n};\n\nvar addChoice = function (choice) { return ({\n type: ActionType.ADD_CHOICE,\n choice: choice,\n}); };\nvar removeChoice = function (choice) { return ({\n type: ActionType.REMOVE_CHOICE,\n choice: choice,\n}); };\nvar filterChoices = function (results) { return ({\n type: ActionType.FILTER_CHOICES,\n results: results,\n}); };\nvar activateChoices = function (active) {\n return ({\n type: ActionType.ACTIVATE_CHOICES,\n active: active,\n });\n};\n\nvar addGroup = function (group) { return ({\n type: ActionType.ADD_GROUP,\n group: group,\n}); };\n\nvar addItem = function (item) { return ({\n type: ActionType.ADD_ITEM,\n item: item,\n}); };\nvar removeItem$1 = function (item) { return ({\n type: ActionType.REMOVE_ITEM,\n item: item,\n}); };\nvar highlightItem = function (item, highlighted) { return ({\n type: ActionType.HIGHLIGHT_ITEM,\n item: item,\n highlighted: highlighted,\n}); };\n\nvar getRandomNumber = function (min, max) { return Math.floor(Math.random() * (max - min) + min); };\nvar generateChars = function (length) {\n return Array.from({ length: length }, function () { return getRandomNumber(0, 36).toString(36); }).join('');\n};\nvar generateId = function (element, prefix) {\n var id = element.id || (element.name && \"\".concat(element.name, \"-\").concat(generateChars(2))) || generateChars(4);\n id = id.replace(/(:|\\.|\\[|\\]|,)/g, '');\n id = \"\".concat(prefix, \"-\").concat(id);\n return id;\n};\nvar getAdjacentEl = function (startEl, selector, direction) {\n if (direction === void 0) { direction = 1; }\n var prop = \"\".concat(direction > 0 ? 'next' : 'previous', \"ElementSibling\");\n var sibling = startEl[prop];\n while (sibling) {\n if (sibling.matches(selector)) {\n return sibling;\n }\n sibling = sibling[prop];\n }\n return null;\n};\nvar isScrolledIntoView = function (element, parent, direction) {\n if (direction === void 0) { direction = 1; }\n var isVisible;\n if (direction > 0) {\n // In view from bottom\n isVisible = parent.scrollTop + parent.offsetHeight >= element.offsetTop + element.offsetHeight;\n }\n else {\n // In view from top\n isVisible = element.offsetTop >= parent.scrollTop;\n }\n return isVisible;\n};\nvar sanitise = function (value) {\n if (typeof value !== 'string') {\n if (value === null || value === undefined) {\n return '';\n }\n if (typeof value === 'object') {\n if ('raw' in value) {\n return sanitise(value.raw);\n }\n if ('trusted' in value) {\n return value.trusted;\n }\n }\n return value;\n }\n return value\n .replace(/&/g, '&')\n .replace(/>/g, '>')\n .replace(/= 0 &&\n !window.matchMedia(\"(min-height: \".concat(dropdownPos + 1, \"px)\")).matches;\n }\n else if (this.position === 'top') {\n shouldFlip = true;\n }\n return shouldFlip;\n };\n Container.prototype.setActiveDescendant = function (activeDescendantID) {\n this.element.setAttribute('aria-activedescendant', activeDescendantID);\n };\n Container.prototype.removeActiveDescendant = function () {\n this.element.removeAttribute('aria-activedescendant');\n };\n Container.prototype.open = function (dropdownPos, dropdownHeight) {\n addClassesToElement(this.element, this.classNames.openState);\n this.element.setAttribute('aria-expanded', 'true');\n this.isOpen = true;\n if (this.shouldFlip(dropdownPos, dropdownHeight)) {\n addClassesToElement(this.element, this.classNames.flippedState);\n this.isFlipped = true;\n }\n };\n Container.prototype.close = function () {\n removeClassesFromElement(this.element, this.classNames.openState);\n this.element.setAttribute('aria-expanded', 'false');\n this.removeActiveDescendant();\n this.isOpen = false;\n // A dropdown flips if it does not have space within the page\n if (this.isFlipped) {\n removeClassesFromElement(this.element, this.classNames.flippedState);\n this.isFlipped = false;\n }\n };\n Container.prototype.addFocusState = function () {\n addClassesToElement(this.element, this.classNames.focusState);\n };\n Container.prototype.removeFocusState = function () {\n removeClassesFromElement(this.element, this.classNames.focusState);\n };\n Container.prototype.addInvalidState = function () {\n addClassesToElement(this.element, this.classNames.invalidState);\n };\n Container.prototype.removeInvalidState = function () {\n removeClassesFromElement(this.element, this.classNames.invalidState);\n };\n Container.prototype.enable = function () {\n removeClassesFromElement(this.element, this.classNames.disabledState);\n this.element.removeAttribute('aria-disabled');\n if (this.type === PassedElementTypes.SelectOne) {\n this.element.setAttribute('tabindex', '0');\n }\n this.isDisabled = false;\n };\n Container.prototype.disable = function () {\n addClassesToElement(this.element, this.classNames.disabledState);\n this.element.setAttribute('aria-disabled', 'true');\n if (this.type === PassedElementTypes.SelectOne) {\n this.element.setAttribute('tabindex', '-1');\n }\n this.isDisabled = true;\n };\n Container.prototype.wrap = function (element) {\n var el = this.element;\n var parentNode = element.parentNode;\n if (parentNode) {\n if (element.nextSibling) {\n parentNode.insertBefore(el, element.nextSibling);\n }\n else {\n parentNode.appendChild(el);\n }\n }\n el.appendChild(element);\n };\n Container.prototype.unwrap = function (element) {\n var el = this.element;\n var parentNode = el.parentNode;\n if (parentNode) {\n // Move passed element outside this element\n parentNode.insertBefore(element, el);\n // Remove this element\n parentNode.removeChild(el);\n }\n };\n Container.prototype.addLoadingState = function () {\n addClassesToElement(this.element, this.classNames.loadingState);\n this.element.setAttribute('aria-busy', 'true');\n this.isLoading = true;\n };\n Container.prototype.removeLoadingState = function () {\n removeClassesFromElement(this.element, this.classNames.loadingState);\n this.element.removeAttribute('aria-busy');\n this.isLoading = false;\n };\n return Container;\n}());\n\nvar Input = /** @class */ (function () {\n function Input(_a) {\n var element = _a.element, type = _a.type, classNames = _a.classNames, preventPaste = _a.preventPaste;\n this.element = element;\n this.type = type;\n this.classNames = classNames;\n this.preventPaste = preventPaste;\n this.isFocussed = this.element.isEqualNode(document.activeElement);\n this.isDisabled = element.disabled;\n this._onPaste = this._onPaste.bind(this);\n this._onInput = this._onInput.bind(this);\n this._onFocus = this._onFocus.bind(this);\n this._onBlur = this._onBlur.bind(this);\n }\n Object.defineProperty(Input.prototype, \"placeholder\", {\n set: function (placeholder) {\n this.element.placeholder = placeholder;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Input.prototype, \"value\", {\n get: function () {\n return this.element.value;\n },\n set: function (value) {\n this.element.value = value;\n },\n enumerable: false,\n configurable: true\n });\n Input.prototype.addEventListeners = function () {\n var el = this.element;\n el.addEventListener('paste', this._onPaste);\n el.addEventListener('input', this._onInput, {\n passive: true,\n });\n el.addEventListener('focus', this._onFocus, {\n passive: true,\n });\n el.addEventListener('blur', this._onBlur, {\n passive: true,\n });\n };\n Input.prototype.removeEventListeners = function () {\n var el = this.element;\n el.removeEventListener('input', this._onInput);\n el.removeEventListener('paste', this._onPaste);\n el.removeEventListener('focus', this._onFocus);\n el.removeEventListener('blur', this._onBlur);\n };\n Input.prototype.enable = function () {\n var el = this.element;\n el.removeAttribute('disabled');\n this.isDisabled = false;\n };\n Input.prototype.disable = function () {\n var el = this.element;\n el.setAttribute('disabled', '');\n this.isDisabled = true;\n };\n Input.prototype.focus = function () {\n if (!this.isFocussed) {\n this.element.focus();\n }\n };\n Input.prototype.blur = function () {\n if (this.isFocussed) {\n this.element.blur();\n }\n };\n Input.prototype.clear = function (setWidth) {\n if (setWidth === void 0) { setWidth = true; }\n this.element.value = '';\n if (setWidth) {\n this.setWidth();\n }\n return this;\n };\n /**\n * Set the correct input width based on placeholder\n * value or input value\n */\n Input.prototype.setWidth = function () {\n // Resize input to contents or placeholder\n var element = this.element;\n element.style.minWidth = \"\".concat(element.placeholder.length + 1, \"ch\");\n element.style.width = \"\".concat(element.value.length + 1, \"ch\");\n };\n Input.prototype.setActiveDescendant = function (activeDescendantID) {\n this.element.setAttribute('aria-activedescendant', activeDescendantID);\n };\n Input.prototype.removeActiveDescendant = function () {\n this.element.removeAttribute('aria-activedescendant');\n };\n Input.prototype._onInput = function () {\n if (this.type !== PassedElementTypes.SelectOne) {\n this.setWidth();\n }\n };\n Input.prototype._onPaste = function (event) {\n if (this.preventPaste) {\n event.preventDefault();\n }\n };\n Input.prototype._onFocus = function () {\n this.isFocussed = true;\n };\n Input.prototype._onBlur = function () {\n this.isFocussed = false;\n };\n return Input;\n}());\n\nvar SCROLLING_SPEED = 4;\n\nvar List = /** @class */ (function () {\n function List(_a) {\n var element = _a.element;\n this.element = element;\n this.scrollPos = this.element.scrollTop;\n this.height = this.element.offsetHeight;\n }\n List.prototype.prepend = function (node) {\n var child = this.element.firstElementChild;\n if (child) {\n this.element.insertBefore(node, child);\n }\n else {\n this.element.append(node);\n }\n };\n List.prototype.scrollToTop = function () {\n this.element.scrollTop = 0;\n };\n List.prototype.scrollToChildElement = function (element, direction) {\n var _this = this;\n if (!element) {\n return;\n }\n var listHeight = this.element.offsetHeight;\n // Scroll position of dropdown\n var listScrollPosition = this.element.scrollTop + listHeight;\n var elementHeight = element.offsetHeight;\n // Distance from bottom of element to top of parent\n var elementPos = element.offsetTop + elementHeight;\n // Difference between the element and scroll position\n var destination = direction > 0 ? this.element.scrollTop + elementPos - listScrollPosition : element.offsetTop;\n requestAnimationFrame(function () {\n _this._animateScroll(destination, direction);\n });\n };\n List.prototype._scrollDown = function (scrollPos, strength, destination) {\n var easing = (destination - scrollPos) / strength;\n var distance = easing > 1 ? easing : 1;\n this.element.scrollTop = scrollPos + distance;\n };\n List.prototype._scrollUp = function (scrollPos, strength, destination) {\n var easing = (scrollPos - destination) / strength;\n var distance = easing > 1 ? easing : 1;\n this.element.scrollTop = scrollPos - distance;\n };\n List.prototype._animateScroll = function (destination, direction) {\n var _this = this;\n var strength = SCROLLING_SPEED;\n var choiceListScrollTop = this.element.scrollTop;\n var continueAnimation = false;\n if (direction > 0) {\n this._scrollDown(choiceListScrollTop, strength, destination);\n if (choiceListScrollTop < destination) {\n continueAnimation = true;\n }\n }\n else {\n this._scrollUp(choiceListScrollTop, strength, destination);\n if (choiceListScrollTop > destination) {\n continueAnimation = true;\n }\n }\n if (continueAnimation) {\n requestAnimationFrame(function () {\n _this._animateScroll(destination, direction);\n });\n }\n };\n return List;\n}());\n\nvar WrappedElement = /** @class */ (function () {\n function WrappedElement(_a) {\n var element = _a.element, classNames = _a.classNames;\n this.element = element;\n this.classNames = classNames;\n this.isDisabled = false;\n }\n Object.defineProperty(WrappedElement.prototype, \"isActive\", {\n get: function () {\n return this.element.dataset.choice === 'active';\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(WrappedElement.prototype, \"dir\", {\n get: function () {\n return this.element.dir;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(WrappedElement.prototype, \"value\", {\n get: function () {\n return this.element.value;\n },\n set: function (value) {\n this.element.setAttribute('value', value);\n this.element.value = value;\n },\n enumerable: false,\n configurable: true\n });\n WrappedElement.prototype.conceal = function () {\n var el = this.element;\n // Hide passed input\n addClassesToElement(el, this.classNames.input);\n el.hidden = true;\n // Remove element from tab index\n el.tabIndex = -1;\n // Backup original styles if any\n var origStyle = el.getAttribute('style');\n if (origStyle) {\n el.setAttribute('data-choice-orig-style', origStyle);\n }\n el.setAttribute('data-choice', 'active');\n };\n WrappedElement.prototype.reveal = function () {\n var el = this.element;\n // Reinstate passed element\n removeClassesFromElement(el, this.classNames.input);\n el.hidden = false;\n el.removeAttribute('tabindex');\n // Recover original styles if any\n var origStyle = el.getAttribute('data-choice-orig-style');\n if (origStyle) {\n el.removeAttribute('data-choice-orig-style');\n el.setAttribute('style', origStyle);\n }\n else {\n el.removeAttribute('style');\n }\n el.removeAttribute('data-choice');\n };\n WrappedElement.prototype.enable = function () {\n this.element.removeAttribute('disabled');\n this.element.disabled = false;\n this.isDisabled = false;\n };\n WrappedElement.prototype.disable = function () {\n this.element.setAttribute('disabled', '');\n this.element.disabled = true;\n this.isDisabled = true;\n };\n WrappedElement.prototype.triggerEvent = function (eventType, data) {\n dispatchEvent(this.element, eventType, data || {});\n };\n return WrappedElement;\n}());\n\nvar WrappedInput = /** @class */ (function (_super) {\n __extends(WrappedInput, _super);\n function WrappedInput() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return WrappedInput;\n}(WrappedElement));\n\nvar coerceBool = function (arg, defaultValue) {\n if (defaultValue === void 0) { defaultValue = true; }\n return typeof arg === 'undefined' ? defaultValue : !!arg;\n};\nvar stringToHtmlClass = function (input) {\n if (typeof input === 'string') {\n // eslint-disable-next-line no-param-reassign\n input = input.split(' ').filter(function (s) { return s.length; });\n }\n if (Array.isArray(input) && input.length) {\n return input;\n }\n return undefined;\n};\nvar mapInputToChoice = function (value, allowGroup, allowRawString) {\n if (allowRawString === void 0) { allowRawString = true; }\n if (typeof value === 'string') {\n var sanitisedValue = sanitise(value);\n var userValue = allowRawString || sanitisedValue === value ? value : { escaped: sanitisedValue, raw: value };\n var result_1 = mapInputToChoice({\n value: value,\n label: userValue,\n selected: true,\n }, false);\n return result_1;\n }\n var groupOrChoice = value;\n if ('choices' in groupOrChoice) {\n if (!allowGroup) {\n // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/optgroup\n throw new TypeError(\"optGroup is not allowed\");\n }\n var group = groupOrChoice;\n var choices = group.choices.map(function (e) { return mapInputToChoice(e, false); });\n var result_2 = {\n id: 0, // actual ID will be assigned during _addGroup\n label: unwrapStringForRaw(group.label) || group.value,\n active: !!choices.length,\n disabled: !!group.disabled,\n choices: choices,\n };\n return result_2;\n }\n var choice = groupOrChoice;\n var result = {\n id: 0, // actual ID will be assigned during _addChoice\n group: null, // actual group will be assigned during _addGroup but before _addChoice\n score: 0, // used in search\n rank: 0, // used in search, stable sort order\n value: choice.value,\n label: choice.label || choice.value,\n active: coerceBool(choice.active),\n selected: coerceBool(choice.selected, false),\n disabled: coerceBool(choice.disabled, false),\n placeholder: coerceBool(choice.placeholder, false),\n highlighted: false,\n labelClass: stringToHtmlClass(choice.labelClass),\n labelDescription: choice.labelDescription,\n customProperties: choice.customProperties,\n };\n return result;\n};\n\nvar isHtmlInputElement = function (e) { return e.tagName === 'INPUT'; };\nvar isHtmlSelectElement = function (e) { return e.tagName === 'SELECT'; };\nvar isHtmlOption = function (e) { return e.tagName === 'OPTION'; };\nvar isHtmlOptgroup = function (e) { return e.tagName === 'OPTGROUP'; };\n\nvar WrappedSelect = /** @class */ (function (_super) {\n __extends(WrappedSelect, _super);\n function WrappedSelect(_a) {\n var element = _a.element, classNames = _a.classNames, template = _a.template, extractPlaceholder = _a.extractPlaceholder;\n var _this = _super.call(this, { element: element, classNames: classNames }) || this;\n _this.template = template;\n _this.extractPlaceholder = extractPlaceholder;\n return _this;\n }\n Object.defineProperty(WrappedSelect.prototype, \"placeholderOption\", {\n get: function () {\n return (this.element.querySelector('option[value=\"\"]') ||\n // Backward compatibility layer for the non-standard placeholder attribute supported in older versions.\n this.element.querySelector('option[placeholder]'));\n },\n enumerable: false,\n configurable: true\n });\n WrappedSelect.prototype.addOptions = function (choices) {\n var _this = this;\n var fragment = document.createDocumentFragment();\n choices.forEach(function (obj) {\n var choice = obj;\n if (choice.element) {\n return;\n }\n var option = _this.template(choice);\n fragment.appendChild(option);\n choice.element = option;\n });\n this.element.appendChild(fragment);\n };\n WrappedSelect.prototype.optionsAsChoices = function () {\n var _this = this;\n var choices = [];\n this.element.querySelectorAll(':scope > option, :scope > optgroup').forEach(function (e) {\n if (isHtmlOption(e)) {\n choices.push(_this._optionToChoice(e));\n }\n else if (isHtmlOptgroup(e)) {\n choices.push(_this._optgroupToChoice(e));\n }\n // todo: hr as empty optgroup, requires displaying empty opt-groups to be useful\n });\n return choices;\n };\n // eslint-disable-next-line class-methods-use-this\n WrappedSelect.prototype._optionToChoice = function (option) {\n // option.value returns the label if there is no value attribute, which can break legacy placeholder attribute support\n if (!option.hasAttribute('value') && option.hasAttribute('placeholder')) {\n option.setAttribute('value', '');\n option.value = '';\n }\n return {\n id: 0,\n group: null,\n score: 0,\n rank: 0,\n value: option.value,\n // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option\n // This attribute is text for the label indicating the meaning of the option. If the `label` attribute isn't defined, its value is that of the element text content (ie `innerText`).\n label: option.label,\n element: option,\n active: true,\n // this returns true if nothing is selected on initial load, which will break placeholder support\n selected: this.extractPlaceholder ? option.selected : option.hasAttribute('selected'),\n disabled: option.disabled,\n highlighted: false,\n placeholder: this.extractPlaceholder && (!option.value || option.hasAttribute('placeholder')),\n labelClass: typeof option.dataset.labelClass !== 'undefined' ? stringToHtmlClass(option.dataset.labelClass) : undefined,\n labelDescription: typeof option.dataset.labelDescription !== 'undefined'\n ? { trusted: option.dataset.labelDescription }\n : undefined,\n customProperties: parseCustomProperties(option.dataset.customProperties),\n };\n };\n WrappedSelect.prototype._optgroupToChoice = function (optgroup) {\n var _this = this;\n var options = optgroup.querySelectorAll('option');\n var choices = Array.from(options).map(function (option) { return _this._optionToChoice(option); });\n return {\n id: 0,\n label: optgroup.label || '',\n element: optgroup,\n active: !!choices.length,\n disabled: optgroup.disabled,\n choices: choices,\n };\n };\n return WrappedSelect;\n}(WrappedElement));\n\nvar DEFAULT_CLASSNAMES = {\n containerOuter: ['choices'],\n containerInner: ['choices__inner'],\n input: ['choices__input'],\n inputCloned: ['choices__input--cloned'],\n list: ['choices__list'],\n listItems: ['choices__list--multiple'],\n listSingle: ['choices__list--single'],\n listDropdown: ['choices__list--dropdown'],\n item: ['choices__item'],\n itemSelectable: ['choices__item--selectable'],\n itemDisabled: ['choices__item--disabled'],\n itemChoice: ['choices__item--choice'],\n description: ['choices__description'],\n placeholder: ['choices__placeholder'],\n group: ['choices__group'],\n groupHeading: ['choices__heading'],\n button: ['choices__button'],\n activeState: ['is-active'],\n focusState: ['is-focused'],\n openState: ['is-open'],\n disabledState: ['is-disabled'],\n highlightedState: ['is-highlighted'],\n selectedState: ['is-selected'],\n flippedState: ['is-flipped'],\n loadingState: ['is-loading'],\n invalidState: ['is-invalid'],\n notice: ['choices__notice'],\n addChoice: ['choices__item--selectable', 'add-choice'],\n noResults: ['has-no-results'],\n noChoices: ['has-no-choices'],\n};\nvar DEFAULT_CONFIG = {\n items: [],\n choices: [],\n silent: false,\n renderChoiceLimit: -1,\n maxItemCount: -1,\n closeDropdownOnSelect: 'auto',\n singleModeForMultiSelect: false,\n addChoices: false,\n addItems: true,\n addItemFilter: function (value) { return !!value && value !== ''; },\n removeItems: true,\n removeItemButton: false,\n removeItemButtonAlignLeft: false,\n editItems: false,\n allowHTML: false,\n allowHtmlUserInput: false,\n duplicateItemsAllowed: true,\n delimiter: ',',\n paste: true,\n searchEnabled: true,\n searchChoices: true,\n searchDisabledChoices: false,\n searchFloor: 1,\n searchResultLimit: 4,\n searchFields: ['label', 'value'],\n position: 'auto',\n resetScrollPosition: true,\n shouldSort: true,\n shouldSortItems: false,\n sorter: sortByAlpha,\n shadowRoot: null,\n placeholder: true,\n placeholderValue: null,\n searchPlaceholderValue: null,\n prependValue: null,\n appendValue: null,\n renderSelectedChoices: 'auto',\n searchRenderSelectedChoices: true,\n loadingText: 'Loading...',\n noResultsText: 'No results found',\n noChoicesText: 'No choices to choose from',\n itemSelectText: 'Press to select',\n uniqueItemText: 'Only unique values can be added',\n customAddItemText: 'Only values matching specific conditions can be added',\n addItemText: function (value) { return \"Press Enter to add \\\"\".concat(value, \"\\\"\"); },\n removeItemIconText: function () { return \"Remove item\"; },\n removeItemLabelText: function (value, _valueRaw, i) {\n return \"Remove item: \".concat(i ? sanitise(i.label) : value);\n },\n maxItemText: function (maxItemCount) { return \"Only \".concat(maxItemCount, \" values can be added\"); },\n valueComparer: function (value1, value2) { return value1 === value2; },\n fuseOptions: {\n includeScore: true,\n },\n labelId: '',\n callbackOnInit: null,\n callbackOnCreateTemplates: null,\n classNames: DEFAULT_CLASSNAMES,\n appendGroupInSearch: false,\n};\n\nvar removeItem = function (item) {\n var itemEl = item.itemEl;\n if (itemEl) {\n itemEl.remove();\n item.itemEl = undefined;\n }\n};\nfunction items(s, action, context) {\n var state = s;\n var update = true;\n switch (action.type) {\n case ActionType.ADD_ITEM: {\n action.item.selected = true;\n var el = action.item.element;\n if (el) {\n el.selected = true;\n el.setAttribute('selected', '');\n }\n state.push(action.item);\n break;\n }\n case ActionType.REMOVE_ITEM: {\n action.item.selected = false;\n var el = action.item.element;\n if (el) {\n el.selected = false;\n el.removeAttribute('selected');\n // For a select-one, if all options are deselected, the first item is selected. To set a black value, select.value needs to be set\n var select = el.parentElement;\n if (select && isHtmlSelectElement(select) && select.type === PassedElementTypes.SelectOne) {\n select.value = '';\n }\n }\n // this is mixing concerns, but this is *so much faster*\n removeItem(action.item);\n state = state.filter(function (choice) { return choice.id !== action.item.id; });\n break;\n }\n case ActionType.REMOVE_CHOICE: {\n removeItem(action.choice);\n state = state.filter(function (item) { return item.id !== action.choice.id; });\n break;\n }\n case ActionType.HIGHLIGHT_ITEM: {\n var highlighted = action.highlighted;\n var item = state.find(function (obj) { return obj.id === action.item.id; });\n if (item && item.highlighted !== highlighted) {\n item.highlighted = highlighted;\n if (context) {\n updateClassList(item, highlighted ? context.classNames.highlightedState : context.classNames.selectedState, highlighted ? context.classNames.selectedState : context.classNames.highlightedState);\n }\n }\n break;\n }\n default: {\n update = false;\n break;\n }\n }\n return { state: state, update: update };\n}\n\nfunction groups(s, action) {\n var state = s;\n var update = true;\n switch (action.type) {\n case ActionType.ADD_GROUP: {\n state.push(action.group);\n break;\n }\n case ActionType.CLEAR_CHOICES: {\n state = [];\n break;\n }\n default: {\n update = false;\n break;\n }\n }\n return { state: state, update: update };\n}\n\n/* eslint-disable */\nfunction choices(s, action, context) {\n var state = s;\n var update = true;\n switch (action.type) {\n case ActionType.ADD_CHOICE: {\n state.push(action.choice);\n break;\n }\n case ActionType.REMOVE_CHOICE: {\n action.choice.choiceEl = undefined;\n if (action.choice.group) {\n action.choice.group.choices = action.choice.group.choices.filter(function (obj) { return obj.id !== action.choice.id; });\n }\n state = state.filter(function (obj) { return obj.id !== action.choice.id; });\n break;\n }\n case ActionType.ADD_ITEM:\n case ActionType.REMOVE_ITEM: {\n action.item.choiceEl = undefined;\n break;\n }\n case ActionType.FILTER_CHOICES: {\n // avoid O(n^2) algorithm complexity when searching/filtering choices\n var scoreLookup_1 = [];\n action.results.forEach(function (result) {\n scoreLookup_1[result.item.id] = result;\n });\n state.forEach(function (choice) {\n var result = scoreLookup_1[choice.id];\n if (result !== undefined) {\n choice.score = result.score;\n choice.rank = result.rank;\n choice.active = true;\n }\n else {\n choice.score = 0;\n choice.rank = 0;\n choice.active = false;\n }\n if (context && context.appendGroupInSearch) {\n choice.choiceEl = undefined;\n }\n });\n break;\n }\n case ActionType.ACTIVATE_CHOICES: {\n state.forEach(function (choice) {\n choice.active = action.active;\n if (context && context.appendGroupInSearch) {\n choice.choiceEl = undefined;\n }\n });\n break;\n }\n case ActionType.CLEAR_CHOICES: {\n state = [];\n break;\n }\n default: {\n update = false;\n break;\n }\n }\n return { state: state, update: update };\n}\n\nvar reducers = {\n groups: groups,\n items: items,\n choices: choices,\n};\nvar Store = /** @class */ (function () {\n function Store(context) {\n this._state = this.defaultState;\n this._listeners = [];\n this._txn = 0;\n this._context = context;\n }\n Object.defineProperty(Store.prototype, \"defaultState\", {\n // eslint-disable-next-line class-methods-use-this\n get: function () {\n return {\n groups: [],\n items: [],\n choices: [],\n };\n },\n enumerable: false,\n configurable: true\n });\n // eslint-disable-next-line class-methods-use-this\n Store.prototype.changeSet = function (init) {\n return {\n groups: init,\n items: init,\n choices: init,\n };\n };\n Store.prototype.reset = function () {\n this._state = this.defaultState;\n var changes = this.changeSet(true);\n if (this._txn) {\n this._changeSet = changes;\n }\n else {\n this._listeners.forEach(function (l) { return l(changes); });\n }\n };\n Store.prototype.subscribe = function (onChange) {\n this._listeners.push(onChange);\n return this;\n };\n Store.prototype.dispatch = function (action) {\n var _this = this;\n var state = this._state;\n var hasChanges = false;\n var changes = this._changeSet || this.changeSet(false);\n Object.keys(reducers).forEach(function (key) {\n var stateUpdate = reducers[key](state[key], action, _this._context);\n if (stateUpdate.update) {\n hasChanges = true;\n changes[key] = true;\n state[key] = stateUpdate.state;\n }\n });\n if (hasChanges) {\n if (this._txn) {\n this._changeSet = changes;\n }\n else {\n this._listeners.forEach(function (l) { return l(changes); });\n }\n }\n };\n Store.prototype.withTxn = function (func) {\n this._txn++;\n try {\n func();\n }\n finally {\n this._txn = Math.max(0, this._txn - 1);\n if (!this._txn) {\n var changeSet_1 = this._changeSet;\n if (changeSet_1) {\n this._changeSet = undefined;\n this._listeners.forEach(function (l) { return l(changeSet_1); });\n }\n }\n }\n };\n Object.defineProperty(Store.prototype, \"state\", {\n /**\n * Get store object\n */\n get: function () {\n return this._state;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Store.prototype, \"items\", {\n /**\n * Get items from store\n */\n get: function () {\n return this.state.items;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Store.prototype, \"highlightedActiveItems\", {\n /**\n * Get highlighted items from store\n */\n get: function () {\n return this.items.filter(function (item) { return item.active && item.highlighted; });\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Store.prototype, \"choices\", {\n /**\n * Get choices from store\n */\n get: function () {\n return this.state.choices;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Store.prototype, \"activeChoices\", {\n /**\n * Get active choices from store\n */\n get: function () {\n return this.choices.filter(function (choice) { return choice.active; });\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Store.prototype, \"searchableChoices\", {\n /**\n * Get choices that can be searched (excluding placeholders or disabled choices)\n */\n get: function () {\n var context = this._context;\n return this.choices.filter(function (choice) { return !choice.placeholder && (context.searchDisabledChoices || !choice.disabled); });\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Store.prototype, \"groups\", {\n /**\n * Get groups from store\n */\n get: function () {\n return this.state.groups;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Store.prototype, \"activeGroups\", {\n /**\n * Get active groups from store\n */\n get: function () {\n var _this = this;\n return this.state.groups.filter(function (group) {\n var isActive = group.active && !group.disabled;\n var hasActiveOptions = _this.state.choices.some(function (choice) { return choice.active && !choice.disabled; });\n return isActive && hasActiveOptions;\n }, []);\n },\n enumerable: false,\n configurable: true\n });\n Store.prototype.inTxn = function () {\n return this._txn > 0;\n };\n /**\n * Get single choice by it's ID\n */\n Store.prototype.getChoiceById = function (id) {\n return this.activeChoices.find(function (choice) { return choice.id === id; });\n };\n /**\n * Get group by group id\n */\n Store.prototype.getGroupById = function (id) {\n return this.groups.find(function (group) { return group.id === id; });\n };\n return Store;\n}());\n\nvar NoticeTypes = {\n noChoices: 'no-choices',\n noResults: 'no-results',\n addChoice: 'add-choice',\n generic: '',\n};\n\nfunction _defineProperty(e, r, t) {\n return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {\n value: t,\n enumerable: true,\n configurable: true,\n writable: true\n }) : e[r] = t, e;\n}\nfunction ownKeys(e, r) {\n var t = Object.keys(e);\n if (Object.getOwnPropertySymbols) {\n var o = Object.getOwnPropertySymbols(e);\n r && (o = o.filter(function (r) {\n return Object.getOwnPropertyDescriptor(e, r).enumerable;\n })), t.push.apply(t, o);\n }\n return t;\n}\nfunction _objectSpread2(e) {\n for (var r = 1; r < arguments.length; r++) {\n var t = null != arguments[r] ? arguments[r] : {};\n r % 2 ? ownKeys(Object(t), true).forEach(function (r) {\n _defineProperty(e, r, t[r]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {\n Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));\n });\n }\n return e;\n}\nfunction _toPrimitive(t, r) {\n if (\"object\" != typeof t || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r);\n if (\"object\" != typeof i) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nfunction _toPropertyKey(t) {\n var i = _toPrimitive(t, \"string\");\n return \"symbol\" == typeof i ? i : i + \"\";\n}\n\n/**\n * Fuse.js v7.0.0 - Lightweight fuzzy-search (http://fusejs.io)\n *\n * Copyright (c) 2023 Kiro Risk (http://kiro.me)\n * All Rights Reserved. Apache Software License 2.0\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n */\n\nfunction isArray(value) {\n return !Array.isArray ? getTag(value) === '[object Array]' : Array.isArray(value);\n}\nfunction baseToString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value;\n }\n let result = value + '';\n return result == '0' && 1 / value == -Infinity ? '-0' : result;\n}\nfunction toString(value) {\n return value == null ? '' : baseToString(value);\n}\nfunction isString(value) {\n return typeof value === 'string';\n}\nfunction isNumber(value) {\n return typeof value === 'number';\n}\n\n// Adapted from: https://github.com/lodash/lodash/blob/master/isBoolean.js\nfunction isBoolean(value) {\n return value === true || value === false || isObjectLike(value) && getTag(value) == '[object Boolean]';\n}\nfunction isObject(value) {\n return typeof value === 'object';\n}\n\n// Checks if `value` is object-like.\nfunction isObjectLike(value) {\n return isObject(value) && value !== null;\n}\nfunction isDefined(value) {\n return value !== undefined && value !== null;\n}\nfunction isBlank(value) {\n return !value.trim().length;\n}\n\n// Gets the `toStringTag` of `value`.\n// Adapted from: https://github.com/lodash/lodash/blob/master/.internal/getTag.js\nfunction getTag(value) {\n return value == null ? value === undefined ? '[object Undefined]' : '[object Null]' : Object.prototype.toString.call(value);\n}\nconst INCORRECT_INDEX_TYPE = \"Incorrect 'index' type\";\nconst LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY = key => `Invalid value for key ${key}`;\nconst PATTERN_LENGTH_TOO_LARGE = max => `Pattern length exceeds max of ${max}.`;\nconst MISSING_KEY_PROPERTY = name => `Missing ${name} property in key`;\nconst INVALID_KEY_WEIGHT_VALUE = key => `Property 'weight' in key '${key}' must be a positive integer`;\nconst hasOwn = Object.prototype.hasOwnProperty;\nclass KeyStore {\n constructor(keys) {\n this._keys = [];\n this._keyMap = {};\n let totalWeight = 0;\n keys.forEach(key => {\n let obj = createKey(key);\n this._keys.push(obj);\n this._keyMap[obj.id] = obj;\n totalWeight += obj.weight;\n });\n\n // Normalize weights so that their sum is equal to 1\n this._keys.forEach(key => {\n key.weight /= totalWeight;\n });\n }\n get(keyId) {\n return this._keyMap[keyId];\n }\n keys() {\n return this._keys;\n }\n toJSON() {\n return JSON.stringify(this._keys);\n }\n}\nfunction createKey(key) {\n let path = null;\n let id = null;\n let src = null;\n let weight = 1;\n let getFn = null;\n if (isString(key) || isArray(key)) {\n src = key;\n path = createKeyPath(key);\n id = createKeyId(key);\n } else {\n if (!hasOwn.call(key, 'name')) {\n throw new Error(MISSING_KEY_PROPERTY('name'));\n }\n const name = key.name;\n src = name;\n if (hasOwn.call(key, 'weight')) {\n weight = key.weight;\n if (weight <= 0) {\n throw new Error(INVALID_KEY_WEIGHT_VALUE(name));\n }\n }\n path = createKeyPath(name);\n id = createKeyId(name);\n getFn = key.getFn;\n }\n return {\n path,\n id,\n weight,\n src,\n getFn\n };\n}\nfunction createKeyPath(key) {\n return isArray(key) ? key : key.split('.');\n}\nfunction createKeyId(key) {\n return isArray(key) ? key.join('.') : key;\n}\nfunction get(obj, path) {\n let list = [];\n let arr = false;\n const deepGet = (obj, path, index) => {\n if (!isDefined(obj)) {\n return;\n }\n if (!path[index]) {\n // If there's no path left, we've arrived at the object we care about.\n list.push(obj);\n } else {\n let key = path[index];\n const value = obj[key];\n if (!isDefined(value)) {\n return;\n }\n\n // If we're at the last value in the path, and if it's a string/number/bool,\n // add it to the list\n if (index === path.length - 1 && (isString(value) || isNumber(value) || isBoolean(value))) {\n list.push(toString(value));\n } else if (isArray(value)) {\n arr = true;\n // Search each item in the array.\n for (let i = 0, len = value.length; i < len; i += 1) {\n deepGet(value[i], path, index + 1);\n }\n } else if (path.length) {\n // An object. Recurse further.\n deepGet(value, path, index + 1);\n }\n }\n };\n\n // Backwards compatibility (since path used to be a string)\n deepGet(obj, isString(path) ? path.split('.') : path, 0);\n return arr ? list : list[0];\n}\nconst MatchOptions = {\n // Whether the matches should be included in the result set. When `true`, each record in the result\n // set will include the indices of the matched characters.\n // These can consequently be used for highlighting purposes.\n includeMatches: false,\n // When `true`, the matching function will continue to the end of a search pattern even if\n // a perfect match has already been located in the string.\n findAllMatches: false,\n // Minimum number of characters that must be matched before a result is considered a match\n minMatchCharLength: 1\n};\nconst BasicOptions = {\n // When `true`, the algorithm continues searching to the end of the input even if a perfect\n // match is found before the end of the same input.\n isCaseSensitive: false,\n // When true, the matching function will continue to the end of a search pattern even if\n includeScore: false,\n // List of properties that will be searched. This also supports nested properties.\n keys: [],\n // Whether to sort the result list, by score\n shouldSort: true,\n // Default sort function: sort by ascending score, ascending index\n sortFn: (a, b) => a.score === b.score ? a.idx < b.idx ? -1 : 1 : a.score < b.score ? -1 : 1\n};\nconst FuzzyOptions = {\n // Approximately where in the text is the pattern expected to be found?\n location: 0,\n // At what point does the match algorithm give up. A threshold of '0.0' requires a perfect match\n // (of both letters and location), a threshold of '1.0' would match anything.\n threshold: 0.6,\n // Determines how close the match must be to the fuzzy location (specified above).\n // An exact letter match which is 'distance' characters away from the fuzzy location\n // would score as a complete mismatch. A distance of '0' requires the match be at\n // the exact location specified, a threshold of '1000' would require a perfect match\n // to be within 800 characters of the fuzzy location to be found using a 0.8 threshold.\n distance: 100\n};\nconst AdvancedOptions = {\n // When `true`, it enables the use of unix-like search commands\n useExtendedSearch: false,\n // The get function to use when fetching an object's properties.\n // The default will search nested paths *ie foo.bar.baz*\n getFn: get,\n // When `true`, search will ignore `location` and `distance`, so it won't matter\n // where in the string the pattern appears.\n // More info: https://fusejs.io/concepts/scoring-theory.html#fuzziness-score\n ignoreLocation: false,\n // When `true`, the calculation for the relevance score (used for sorting) will\n // ignore the field-length norm.\n // More info: https://fusejs.io/concepts/scoring-theory.html#field-length-norm\n ignoreFieldNorm: false,\n // The weight to determine how much field length norm effects scoring.\n fieldNormWeight: 1\n};\nvar Config = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, BasicOptions), MatchOptions), FuzzyOptions), AdvancedOptions);\nconst SPACE = /[^ ]+/g;\n\n// Field-length norm: the shorter the field, the higher the weight.\n// Set to 3 decimals to reduce index size.\nfunction norm(weight = 1, mantissa = 3) {\n const cache = new Map();\n const m = Math.pow(10, mantissa);\n return {\n get(value) {\n const numTokens = value.match(SPACE).length;\n if (cache.has(numTokens)) {\n return cache.get(numTokens);\n }\n\n // Default function is 1/sqrt(x), weight makes that variable\n const norm = 1 / Math.pow(numTokens, 0.5 * weight);\n\n // In place of `toFixed(mantissa)`, for faster computation\n const n = parseFloat(Math.round(norm * m) / m);\n cache.set(numTokens, n);\n return n;\n },\n clear() {\n cache.clear();\n }\n };\n}\nclass FuseIndex {\n constructor({\n getFn = Config.getFn,\n fieldNormWeight = Config.fieldNormWeight\n } = {}) {\n this.norm = norm(fieldNormWeight, 3);\n this.getFn = getFn;\n this.isCreated = false;\n this.setIndexRecords();\n }\n setSources(docs = []) {\n this.docs = docs;\n }\n setIndexRecords(records = []) {\n this.records = records;\n }\n setKeys(keys = []) {\n this.keys = keys;\n this._keysMap = {};\n keys.forEach((key, idx) => {\n this._keysMap[key.id] = idx;\n });\n }\n create() {\n if (this.isCreated || !this.docs.length) {\n return;\n }\n this.isCreated = true;\n\n // List is Array\n if (isString(this.docs[0])) {\n this.docs.forEach((doc, docIndex) => {\n this._addString(doc, docIndex);\n });\n } else {\n // List is Array