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AIC,eAI7B,OAFAH,EAAAA,GAAeD,EAAKE,GAEb,CAACC,EAAO,CAACA,KAGlBE,YAAY/7B,IACVA,EAAMg8B,QAECL,EAAAA,GAA0B37B,KAGrC27B,EAAAA,GAAAA,IAA6B,oBAAqBJ,I,gBCvB3C,SAASU,EAAmBC,EAAsBC,GAEvD,OAAOD,EAAa/zB,QADD,wBACqB,CAACi0B,EAAGC,IAAQF,EAAUE,GAAMF,EAAUE,GAAMA,I","sources":["webpack://grafana/./packages/grafana-data/src/datetime/parser.ts","webpack://grafana/./packages/grafana-data/src/events/eventFactory.ts","webpack://grafana/./packages/grafana-data/src/events/types.ts","webpack://grafana/./packages/grafana-data/src/field/FieldConfigOptionsRegistry.tsx","webpack://grafana/./packages/grafana-data/src/field/fieldComparers.ts","webpack://grafana/./packages/grafana-data/src/field/fieldState.ts","webpack://grafana/./packages/grafana-data/src/text/sanitize.ts","webpack://grafana/./packages/grafana-data/src/themes/createComponents.ts","webpack://grafana/./packages/grafana-data/src/themes/createV1Theme.ts","webpack://grafana/./packages/grafana-data/src/themes/createTheme.ts","webpack://grafana/./packages/grafana-data/src/themes/palette.ts","webpack://grafana/./packages/grafana-data/src/transformations/fieldReducer.ts","webpack://grafana/./packages/grafana-data/src/transformations/matchers/fieldTypeMatcher.ts","webpack://grafana/./packages/grafana-data/src/transformations/matchers/ids.ts","webpack://grafana/./packages/grafana-data/src/transformations/matchers/predicates.ts","webpack://grafana/./packages/grafana-data/src/transformations/matchers/refIdMatcher.ts","webpack://grafana/./packages/grafana-data/src/transformations/matchers/simpleFieldMatcher.ts","webpack://grafana/./packages/grafana-data/src/transformations/matchers/valueMatchers/equalMatchers.ts","webpack://grafana/./packages/grafana-data/src/transformations/matchers/valueMatchers/nullMatchers.ts","webpack://grafana/./packages/grafana-data/src/transformations/matchers/valueMatchers/numericMatchers.ts","webpack://grafana/./packages/grafana-data/src/transformations/matchers/valueMatchers/rangeMatchers.ts","webpack://grafana/./packages/grafana-data/src/transformations/matchers/valueMatchers/regexMatchers.ts","webpack://grafana/./packages/grafana-data/src/transformations/transformers/ensureColumns.ts","webpack://grafana/./packages/grafana-data/src/transformations/transformers/filter.ts","webpack://grafana/./packages/grafana-data/src/transformations/transformers/filterByName.ts","webpack://grafana/./packages/grafana-data/src/transformations/transformers/filterByRefId.ts","webpack://grafana/./packages/grafana-data/src/transformations/transformers/ids.ts","webpack://grafana/./packages/grafana-data/src/transformations/transformers/merge.ts","webpack://grafana/./packages/grafana-data/src/transformations/transformers/noop.ts","webpack://grafana/./packages/grafana-data/src/transformations/transformers/organize.ts","webpack://grafana/./packages/grafana-data/src/transformations/transformers/rename.ts","webpack://grafana/./packages/grafana-data/src/transformations/transformers/seriesToColumns.ts","webpack://grafana/./packages/grafana-data/src/transformations/transformers/seriesToRows.ts","webpack://grafana/./packages/grafana-data/src/transformations/transformers/sortBy.ts","webpack://grafana/./packages/grafana-data/src/types/dataFrame.ts","webpack://grafana/./packages/grafana-data/src/types/fieldColor.ts","webpack://grafana/./packages/grafana-data/src/types/theme.ts","webpack://grafana/./packages/grafana-data/src/types/thresholds.ts","webpack://grafana/./packages/grafana-data/src/types/valueMapping.ts","webpack://grafana/./packages/grafana-data/src/utils/Registry.ts","webpack://grafana/./packages/grafana-data/src/utils/anyToNumber.ts","webpack://grafana/./packages/grafana-data/src/utils/binaryOperators.ts","webpack://grafana/./packages/grafana-data/src/utils/fieldParser.ts","webpack://grafana/./packages/grafana-data/src/utils/makeClassES5Compatible.ts","webpack://grafana/./packages/grafana-data/src/valueFormats/arithmeticFormatters.ts","webpack://grafana/./packages/grafana-data/src/valueFormats/categories.ts","webpack://grafana/./packages/grafana-data/src/valueFormats/dateTimeFormatters.ts","webpack://grafana/./packages/grafana-data/src/valueFormats/symbolFormatters.ts","webpack://grafana/./packages/grafana-data/src/vector/ArrayVector.ts","webpack://grafana/./packages/grafana-data/src/vector/AsNumberVector.ts","webpack://grafana/./packages/grafana-data/src/vector/BinaryOperationVector.ts","webpack://grafana/./packages/grafana-data/src/vector/ConstantVector.ts","webpack://grafana/./packages/grafana-data/src/vector/RowVector.ts","webpack://grafana/./packages/grafana-data/src/vector/SortedVector.ts","webpack://grafana/./packages/grafana-data/src/vector/vectorToArray.ts","webpack://grafana/./packages/grafana-runtime/src/utils/toDataQueryError.ts","webpack://grafana/./public/app/features/live/centrifuge/LiveDataStream.ts","webpack://grafana/./public/app/features/live/centrifuge/channel.ts","webpack://grafana/./public/app/features/live/centrifuge/service.ts","webpack://grafana/./public/app/features/live/centrifuge/transferHandlers.ts","webpack://grafana/./public/app/plugins/datasource/prometheus/legend.ts"],"sourcesContent":["/* eslint-disable id-blacklist, no-restricted-imports, @typescript-eslint/ban-types */\nimport { lowerCase } from 'lodash';\nimport moment, { MomentInput } from 'moment-timezone';\n\nimport { DateTimeOptions, getTimeZone } from './common';\nimport { parse, isValid } from './datemath';\nimport { systemDateFormats } from './formats';\nimport { DateTimeInput, DateTime, isDateTime } from './moment_wrapper';\n\n/**\n * The type that describes options that can be passed when parsing a date and time value.\n * @public\n */\nexport interface DateTimeOptionsWhenParsing extends DateTimeOptions {\n /**\n * If the input is a Grafana quick date, e.g. now-6h, then you can specify this to control\n * whether the last part of the date and time value is included or excluded.\n *\n * Example: now-6h and the current time is 12:20:00 if roundUp is set to true\n * the returned DateTime value will be 06:00:00.\n */\n roundUp?: boolean;\n fiscalYearStartMonth?: number;\n}\n\ntype DateTimeParser<T extends DateTimeOptions = DateTimeOptions> = (value: DateTimeInput, options?: T) => DateTime;\n\n/**\n * Helper function to parse a number, text or Date to a DateTime value. If a timeZone is supplied the incoming value\n * is parsed with that timeZone as a base. The only exception to this is if the passed value is in a UTC-based\n * format. Then it will use UTC as the base. If no format is specified the current system format will be assumed.\n *\n * It can also parse the Grafana quick date and time format, e.g. now-6h will be parsed as Date.now() - 6 hours and\n * returned as a valid DateTime value.\n *\n * If no options are supplied, then default values are used. For more details please see {@link DateTimeOptions}.\n *\n * @param value - should be a parsable date and time value\n * @param options\n *\n * @public\n */\nexport const dateTimeParse: DateTimeParser<DateTimeOptionsWhenParsing> = (value, options?): DateTime => {\n if (isDateTime(value)) {\n return value;\n }\n\n if (typeof value === 'string') {\n return parseString(value, options);\n }\n\n return parseOthers(value, options);\n};\n\nconst parseString = (value: string, options?: DateTimeOptionsWhenParsing): DateTime => {\n if (value.indexOf('now') !== -1) {\n if (!isValid(value)) {\n return moment() as DateTime;\n }\n\n const parsed = parse(value, options?.roundUp, options?.timeZone, options?.fiscalYearStartMonth);\n return parsed || (moment() as DateTime);\n }\n\n const timeZone = getTimeZone(options);\n const zone = moment.tz.zone(timeZone);\n const format = options?.format ?? systemDateFormats.fullDate;\n\n if (zone && zone.name) {\n return moment.tz(value, format, zone.name) as DateTime;\n }\n\n switch (lowerCase(timeZone)) {\n case 'utc':\n return moment.utc(value, format) as DateTime;\n default:\n return moment(value, format) as DateTime;\n }\n};\n\nconst parseOthers = (value: DateTimeInput, options?: DateTimeOptionsWhenParsing): DateTime => {\n const date = value as MomentInput;\n const timeZone = getTimeZone(options);\n const zone = moment.tz.zone(timeZone);\n\n if (zone && zone.name) {\n return moment.tz(date, zone.name) as DateTime;\n }\n\n switch (lowerCase(timeZone)) {\n case 'utc':\n return moment.utc(date) as DateTime;\n default:\n return moment(date) as DateTime;\n }\n};\n","import { AppEvent } from './types';\n\nconst typeList: Set<string> = new Set();\n\nexport function eventFactory<T = undefined>(name: string): AppEvent<T> {\n if (typeList.has(name)) {\n throw new Error(`There is already an event defined with type '${name}'`);\n }\n\n typeList.add(name);\n return { name };\n}\n","import { Unsubscribable, Observable } from 'rxjs';\n\n/**\n * @alpha\n * internal interface\n */\nexport interface BusEvent {\n readonly type: string;\n readonly payload?: any;\n readonly origin?: EventBus;\n}\n\n/**\n * @alpha\n * Base event type\n */\nexport abstract class BusEventBase implements BusEvent {\n readonly type: string;\n readonly payload?: any;\n readonly origin?: EventBus;\n\n constructor() {\n //@ts-ignore\n this.type = this.__proto__.constructor.type;\n }\n}\n\n/**\n * @alpha\n * Base event type with payload\n */\nexport abstract class BusEventWithPayload<T> extends BusEventBase {\n readonly payload: T;\n\n constructor(payload: T) {\n super();\n this.payload = payload;\n }\n}\n\n/*\n * Interface for an event type constructor\n */\nexport interface BusEventType<T extends BusEvent> {\n type: string;\n new (...args: any[]): T;\n}\n\n/**\n * @alpha\n * Event callback/handler type\n */\nexport interface BusEventHandler<T extends BusEvent> {\n (event: T): void;\n}\n\n/**\n * @alpha\n * Main minimal interface\n */\nexport interface EventFilterOptions {\n onlyLocal: boolean;\n}\n\n/**\n * @alpha\n * Main minimal interface\n */\nexport interface EventBus {\n /**\n * Publish single vent\n */\n publish<T extends BusEvent>(event: T): void;\n\n /**\n * Get observable of events\n */\n getStream<T extends BusEvent>(eventType: BusEventType<T>): Observable<T>;\n\n /**\n * Subscribe to an event stream\n *\n * This function is a wrapper around the `getStream(...)` function\n */\n subscribe<T extends BusEvent>(eventType: BusEventType<T>, handler: BusEventHandler<T>): Unsubscribable;\n\n /**\n * Remove all event subscriptions\n */\n removeAllListeners(): void;\n\n /**\n * Returns a new bus scoped that knows where it exists in a heiarchy\n *\n * @internal -- This is included for internal use only should not be used directly\n */\n newScopedBus(key: string, filter: EventFilterOptions): EventBus;\n}\n\n/**\n * @public\n * @deprecated event type\n */\nexport interface AppEvent<T> {\n readonly name: string;\n payload?: T;\n}\n\n/** @public */\nexport interface LegacyEmitter {\n /**\n * @deprecated use $emit\n */\n emit<T>(event: AppEvent<T> | string, payload?: T): void;\n\n /**\n * @deprecated use $on\n */\n on<T>(event: AppEvent<T> | string, handler: LegacyEventHandler<T>, scope?: any): void;\n\n /**\n * @deprecated use $on\n */\n off<T>(event: AppEvent<T> | string, handler: (payload?: T | any) => void): void;\n}\n\n/** @public */\nexport interface LegacyEventHandler<T> {\n (payload: T): void;\n wrapper?: (event: BusEvent) => void;\n}\n\n/** @alpha */\nexport interface EventBusExtended extends EventBus, LegacyEmitter {}\n","import { FieldConfigPropertyItem } from '../types/fieldOverrides';\nimport { Registry } from '../utils/Registry';\n\nexport class FieldConfigOptionsRegistry extends Registry<FieldConfigPropertyItem> {}\n","import { isNumber } from 'lodash';\n\nimport { dateTime } from '../datetime';\nimport { Field, FieldType } from '../types/dataFrame';\nimport { Vector } from '../types/vector';\n\ntype IndexComparer = (a: number, b: number) => number;\n\n/** @public */\nexport const fieldIndexComparer = (field: Field, reverse = false): IndexComparer => {\n const values = field.values;\n\n switch (field.type) {\n case FieldType.number:\n return numericIndexComparer(values, reverse);\n case FieldType.string:\n return stringIndexComparer(values, reverse);\n case FieldType.boolean:\n return booleanIndexComparer(values, reverse);\n case FieldType.time:\n return timeIndexComparer(values, reverse);\n default:\n return naturalIndexComparer(reverse);\n }\n};\n\n/** @public */\nexport const timeComparer = (a: any, b: any): number => {\n if (!a || !b) {\n return falsyComparer(a, b);\n }\n\n if (isNumber(a) && isNumber(b)) {\n return numericComparer(a, b);\n }\n\n if (dateTime(a).isBefore(b)) {\n return -1;\n }\n\n if (dateTime(b).isBefore(a)) {\n return 1;\n }\n\n return 0;\n};\n\n/** @public */\nexport const numericComparer = (a: number, b: number): number => {\n return a - b;\n};\n\n/** @public */\nexport const stringComparer = (a: string, b: string): number => {\n if (!a || !b) {\n return falsyComparer(a, b);\n }\n return a.localeCompare(b);\n};\n\nexport const booleanComparer = (a: boolean, b: boolean): number => {\n return falsyComparer(a, b);\n};\n\nconst falsyComparer = (a: any, b: any): number => {\n if (!a && b) {\n return 1;\n }\n\n if (a && !b) {\n return -1;\n }\n\n return 0;\n};\n\nconst timeIndexComparer = (values: Vector<any>, reverse: boolean): IndexComparer => {\n return (a: number, b: number): number => {\n const vA = values.get(a);\n const vB = values.get(b);\n return reverse ? timeComparer(vB, vA) : timeComparer(vA, vB);\n };\n};\n\nconst booleanIndexComparer = (values: Vector<any>, reverse: boolean): IndexComparer => {\n return (a: number, b: number): number => {\n const vA: boolean = values.get(a);\n const vB: boolean = values.get(b);\n return reverse ? booleanComparer(vB, vA) : booleanComparer(vA, vB);\n };\n};\n\nconst numericIndexComparer = (values: Vector<any>, reverse: boolean): IndexComparer => {\n return (a: number, b: number): number => {\n const vA: number = values.get(a);\n const vB: number = values.get(b);\n return reverse ? numericComparer(vB, vA) : numericComparer(vA, vB);\n };\n};\n\nconst stringIndexComparer = (values: Vector<any>, reverse: boolean): IndexComparer => {\n return (a: number, b: number): number => {\n const vA: string = values.get(a);\n const vB: string = values.get(b);\n return reverse ? stringComparer(vB, vA) : stringComparer(vA, vB);\n };\n};\n\nconst naturalIndexComparer = (reverse: boolean): IndexComparer => {\n return (a: number, b: number): number => {\n return reverse ? numericComparer(b, a) : numericComparer(a, b);\n };\n};\n","import { DataFrame, Field, TIME_SERIES_VALUE_FIELD_NAME, FieldType, TIME_SERIES_TIME_FIELD_NAME } from '../types';\nimport { formatLabels } from '../utils/labels';\n\n/**\n * Get an appropriate display title\n */\nexport function getFrameDisplayName(frame: DataFrame, index?: number) {\n if (frame.name) {\n return frame.name;\n }\n\n // Single field with tags\n const valuesWithLabels: Field[] = [];\n for (const field of frame.fields) {\n if (field.labels && Object.keys(field.labels).length > 0) {\n valuesWithLabels.push(field);\n }\n }\n\n if (valuesWithLabels.length === 1) {\n return formatLabels(valuesWithLabels[0].labels!);\n }\n\n // list all the\n if (index === undefined) {\n return frame.fields\n .filter((f) => f.type !== FieldType.time)\n .map((f) => getFieldDisplayName(f, frame))\n .join(', ');\n }\n\n if (frame.refId) {\n return `Series (${frame.refId})`;\n }\n\n return `Series (${index})`;\n}\n\nexport function getFieldDisplayName(field: Field, frame?: DataFrame, allFrames?: DataFrame[]): string {\n const existingTitle = field.state?.displayName;\n const multipleFrames = Boolean(allFrames && allFrames.length > 1);\n\n if (existingTitle && multipleFrames === field.state?.multipleFrames) {\n return existingTitle;\n }\n\n const displayName = calculateFieldDisplayName(field, frame, allFrames);\n field.state = field.state || {};\n field.state.displayName = displayName;\n field.state.multipleFrames = multipleFrames;\n\n return displayName;\n}\n\n/**\n * Get an appropriate display name. If the 'displayName' field config is set, use that.\n */\nfunction calculateFieldDisplayName(field: Field, frame?: DataFrame, allFrames?: DataFrame[]): string {\n const hasConfigTitle = field.config?.displayName && field.config?.displayName.length;\n\n let displayName = hasConfigTitle ? field.config!.displayName! : field.name;\n\n if (hasConfigTitle) {\n return displayName;\n }\n\n if (frame && field.config?.displayNameFromDS) {\n return field.config.displayNameFromDS;\n }\n\n // This is an ugly exception for time field\n // For time series we should normally treat time field with same name\n // But in case it has a join source we should handle it as normal field\n if (field.type === FieldType.time && !field.labels) {\n return displayName ?? TIME_SERIES_TIME_FIELD_NAME;\n }\n\n let parts: string[] = [];\n let frameNamesDiffer = false;\n\n if (allFrames && allFrames.length > 1) {\n for (let i = 1; i < allFrames.length; i++) {\n const frame = allFrames[i];\n if (frame.name !== allFrames[i - 1].name) {\n frameNamesDiffer = true;\n break;\n }\n }\n }\n\n let frameNameAdded = false;\n let labelsAdded = false;\n\n if (frameNamesDiffer && frame?.name) {\n parts.push(frame.name);\n frameNameAdded = true;\n }\n\n if (field.name && field.name !== TIME_SERIES_VALUE_FIELD_NAME) {\n parts.push(field.name);\n }\n\n if (field.labels && frame) {\n let singleLabelName = getSingleLabelName(allFrames ?? [frame]);\n\n if (!singleLabelName) {\n let allLabels = formatLabels(field.labels);\n if (allLabels) {\n parts.push(allLabels);\n labelsAdded = true;\n }\n } else if (field.labels[singleLabelName]) {\n parts.push(field.labels[singleLabelName]);\n labelsAdded = true;\n }\n }\n\n // if we have not added frame name and no labels, and field name = Value, we should add frame name\n if (frame && !frameNameAdded && !labelsAdded && field.name === TIME_SERIES_VALUE_FIELD_NAME) {\n if (frame.name && frame.name.length > 0) {\n parts.push(frame.name);\n frameNameAdded = true;\n }\n }\n\n if (parts.length) {\n displayName = parts.join(' ');\n } else if (field.name) {\n displayName = field.name;\n } else {\n displayName = TIME_SERIES_VALUE_FIELD_NAME;\n }\n\n // Ensure unique field name\n if (displayName === field.name) {\n displayName = getUniqueFieldName(field, frame);\n }\n\n return displayName;\n}\n\nfunction getUniqueFieldName(field: Field, frame?: DataFrame) {\n let dupeCount = 0;\n let foundSelf = false;\n\n if (frame) {\n for (let i = 0; i < frame.fields.length; i++) {\n const otherField = frame.fields[i];\n\n if (field === otherField) {\n foundSelf = true;\n\n if (dupeCount > 0) {\n dupeCount++;\n break;\n }\n } else if (field.name === otherField.name) {\n dupeCount++;\n\n if (foundSelf) {\n break;\n }\n }\n }\n }\n\n if (dupeCount) {\n return `${field.name} ${dupeCount}`;\n }\n\n return field.name;\n}\n\n/**\n * Checks all data frames and return name of label if there is only one label name in all frames\n */\nfunction getSingleLabelName(frames: DataFrame[]): string | null {\n let singleName: string | null = null;\n\n for (let i = 0; i < frames.length; i++) {\n const frame = frames[i];\n\n for (const field of frame.fields) {\n if (!field.labels) {\n continue;\n }\n\n // yes this should be in!\n for (const labelKey in field.labels) {\n if (singleName === null) {\n singleName = labelKey;\n } else if (labelKey !== singleName) {\n return null;\n }\n }\n }\n }\n\n return singleName;\n}\n","import { sanitizeUrl as braintreeSanitizeUrl } from '@braintree/sanitize-url';\nimport * as xss from 'xss';\n\nconst XSSWL = Object.keys(xss.whiteList).reduce((acc, element) => {\n acc[element] = xss.whiteList[element]?.concat(['class', 'style']);\n return acc;\n}, {} as xss.IWhiteList);\n\nconst sanitizeXSS = new xss.FilterXSS({\n whiteList: XSSWL,\n});\n\nconst sanitizeTextPanelWhitelist = new xss.FilterXSS({\n whiteList: XSSWL,\n css: {\n whiteList: {\n ...xss.getDefaultCSSWhiteList(),\n 'flex-direction': true,\n 'flex-wrap': true,\n 'flex-basis': true,\n 'flex-grow': true,\n 'flex-shrink': true,\n 'flex-flow': true,\n gap: true,\n order: true,\n 'justify-content': true,\n 'justify-items': true,\n 'justify-self': true,\n 'align-items': true,\n 'align-content': true,\n 'align-self': true,\n },\n },\n});\n\n/**\n * Returns string safe from XSS attacks.\n *\n * Even though we allow the style-attribute, there's still default filtering applied to it\n * Info: https://github.com/leizongmin/js-xss#customize-css-filter\n * Whitelist: https://github.com/leizongmin/js-css-filter/blob/master/lib/default.js\n */\nexport function sanitize(unsanitizedString: string): string {\n try {\n return sanitizeXSS.process(unsanitizedString);\n } catch (error) {\n console.error('String could not be sanitized', unsanitizedString);\n return unsanitizedString;\n }\n}\n\nexport function sanitizeTextPanelContent(unsanitizedString: string): string {\n try {\n return sanitizeTextPanelWhitelist.process(unsanitizedString);\n } catch (error) {\n console.error('String could not be sanitized', unsanitizedString);\n return 'Text string could not be sanitized';\n }\n}\n\nexport function sanitizeUrl(url: string): string {\n return braintreeSanitizeUrl(url);\n}\n\nexport function hasAnsiCodes(input: string): boolean {\n return /\\u001b\\[\\d{1,2}m/.test(input);\n}\n\nexport function escapeHtml(str: string): string {\n return String(str).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\"/g, '&quot;');\n}\n","import { ThemeColors } from './createColors';\nimport { ThemeShadows } from './createShadows';\n\n/** @beta */\nexport interface ThemeComponents {\n /** Applies to normal buttons, inputs, radio buttons, etc */\n height: {\n sm: number;\n md: number;\n lg: number;\n };\n input: {\n background: string;\n borderColor: string;\n borderHover: string;\n text: string;\n };\n tooltip: {\n text: string;\n background: string;\n };\n panel: {\n padding: number;\n headerHeight: number;\n borderColor: string;\n boxShadow: string;\n background: string;\n };\n dropdown: {\n background: string;\n };\n overlay: {\n background: string;\n };\n dashboard: {\n background: string;\n padding: number;\n };\n textHighlight: {\n background: string;\n text: string;\n };\n sidemenu: {\n width: number;\n };\n menuTabs: {\n height: number;\n };\n horizontalDrawer: {\n defaultHeight: number;\n };\n}\n\nexport function createComponents(colors: ThemeColors, shadows: ThemeShadows): ThemeComponents {\n const panel = {\n padding: 1,\n headerHeight: 4,\n background: colors.background.primary,\n borderColor: colors.border.weak,\n boxShadow: 'none',\n };\n\n const input = {\n borderColor: colors.border.medium,\n borderHover: colors.border.strong,\n text: colors.text.primary,\n background: colors.mode === 'dark' ? colors.background.canvas : colors.background.primary,\n };\n\n return {\n height: {\n sm: 3,\n md: 4,\n lg: 6,\n },\n input,\n panel,\n dropdown: {\n background: input.background,\n },\n tooltip: {\n background: colors.background.secondary,\n text: colors.text.primary,\n },\n dashboard: {\n background: colors.background.canvas,\n padding: 1,\n },\n overlay: {\n background: colors.mode === 'dark' ? 'rgba(63, 62, 62, 0.45)' : 'rgba(208, 209, 211, 0.24)',\n },\n sidemenu: {\n width: 57,\n },\n menuTabs: {\n height: 41,\n },\n textHighlight: {\n text: colors.warning.contrastText,\n background: colors.warning.main,\n },\n horizontalDrawer: {\n defaultHeight: 400,\n },\n };\n}\n","import { GrafanaTheme, GrafanaThemeCommons, GrafanaThemeType } from '../types';\n\nimport { GrafanaTheme2 } from './types';\n\nexport function createV1Theme(theme: Omit<GrafanaTheme2, 'v1'>): GrafanaTheme {\n const oldCommon: GrafanaThemeCommons = {\n name: 'Grafana Default',\n typography: {\n fontFamily: {\n sansSerif: theme.typography.fontFamily,\n monospace: theme.typography.fontFamilyMonospace,\n },\n size: {\n base: `${theme.typography.fontSize}px`,\n xs: theme.typography.size.xs,\n sm: theme.typography.size.sm,\n md: theme.typography.size.md,\n lg: theme.typography.size.lg,\n },\n heading: {\n h1: theme.typography.h1.fontSize,\n h2: theme.typography.h2.fontSize,\n h3: theme.typography.h3.fontSize,\n h4: theme.typography.h4.fontSize,\n h5: theme.typography.h5.fontSize,\n h6: theme.typography.h6.fontSize,\n },\n weight: {\n light: theme.typography.fontWeightLight,\n regular: theme.typography.fontWeightRegular,\n semibold: theme.typography.fontWeightMedium,\n bold: theme.typography.fontWeightBold,\n },\n lineHeight: {\n xs: theme.typography.bodySmall.lineHeight,\n sm: theme.typography.bodySmall.lineHeight,\n md: theme.typography.body.lineHeight,\n lg: theme.typography.h2.lineHeight,\n },\n link: {\n decoration: 'none',\n hoverDecoration: 'none',\n },\n },\n breakpoints: {\n xs: `${theme.breakpoints.values.xs}px`,\n sm: `${theme.breakpoints.values.sm}px`,\n md: `${theme.breakpoints.values.md}px`,\n lg: `${theme.breakpoints.values.lg}px`,\n xl: `${theme.breakpoints.values.xl}px`,\n xxl: `${theme.breakpoints.values.xxl}px`,\n },\n spacing: {\n base: theme.spacing.gridSize,\n insetSquishMd: theme.spacing(0.5, 1),\n d: theme.spacing(2),\n xxs: theme.spacing(0.25),\n xs: theme.spacing(0.5),\n sm: theme.spacing(1),\n md: theme.spacing(2),\n lg: theme.spacing(3),\n xl: theme.spacing(4),\n gutter: theme.spacing(4),\n\n // Next-gen forms spacing variables\n // TODO: Move variables definition to respective components when implementing\n formSpacingBase: theme.spacing.gridSize,\n formMargin: `${theme.spacing.gridSize * 4}px`,\n formFieldsetMargin: `${theme.spacing.gridSize * 2}px`,\n formInputHeight: theme.spacing.gridSize * 4,\n formButtonHeight: theme.spacing.gridSize * 4,\n formInputPaddingHorizontal: `${theme.spacing.gridSize}px`,\n\n // Used for icons do define spacing between icon and input field\n // Applied on the right(prefix) or left(suffix)\n formInputAffixPaddingHorizontal: `${theme.spacing.gridSize / 2}px`,\n\n formInputMargin: `${theme.spacing.gridSize * 2}px`,\n formLabelPadding: '0 0 0 2px',\n formLabelMargin: `0 0 ${theme.spacing.gridSize / 2 + 'px'} 0`,\n formValidationMessagePadding: '4px 8px',\n formValidationMessageMargin: '4px 0 0 0',\n inlineFormMargin: '4px',\n },\n border: {\n radius: {\n sm: theme.shape.borderRadius(1),\n md: theme.shape.borderRadius(2),\n lg: theme.shape.borderRadius(3),\n },\n width: {\n sm: '1px',\n },\n },\n height: {\n sm: theme.spacing.gridSize * theme.components.height.sm,\n md: theme.spacing.gridSize * theme.components.height.md,\n lg: theme.spacing.gridSize * theme.components.height.lg,\n },\n panelPadding: theme.components.panel.padding * theme.spacing.gridSize,\n panelHeaderHeight: theme.spacing.gridSize * theme.components.panel.headerHeight,\n zIndex: theme.zIndex,\n };\n\n const basicColors = {\n ...commonColorsPalette,\n black: '#000000',\n white: '#ffffff',\n dark1: '#141414',\n dark2: '#161719',\n dark3: '#1f1f20',\n dark4: '#212124',\n dark5: '#222426',\n dark6: '#262628',\n dark7: '#292a2d',\n dark8: '#2f2f32',\n dark9: '#343436',\n dark10: '#424345',\n gray1: '#555555',\n gray2: '#8e8e8e',\n gray3: '#b3b3b3',\n gray4: '#d8d9da',\n gray5: '#ececec',\n gray6: '#f4f5f8', // not used in dark theme\n gray7: '#fbfbfb', // not used in dark theme\n redBase: '#e02f44',\n redShade: '#c4162a',\n greenBase: '#299c46',\n greenShade: '#23843b',\n red: '#d44a3a',\n yellow: '#ecbb13',\n purple: '#9933cc',\n variable: '#32d1df',\n orange: '#eb7b18',\n orangeDark: '#ff780a',\n };\n\n const backgrounds = {\n bg1: theme.colors.background.primary,\n bg2: theme.colors.background.secondary,\n bg3: theme.colors.action.hover,\n dashboardBg: theme.colors.background.canvas,\n bgBlue1: theme.colors.primary.main,\n bgBlue2: theme.colors.primary.shade,\n };\n\n const borders = {\n border1: theme.colors.border.weak,\n border2: theme.colors.border.medium,\n border3: theme.colors.border.strong,\n };\n\n const textColors = {\n textStrong: theme.colors.text.maxContrast,\n textHeading: theme.colors.text.primary,\n text: theme.colors.text.primary,\n textSemiWeak: theme.colors.text.secondary,\n textWeak: theme.colors.text.secondary,\n textFaint: theme.colors.text.disabled,\n textBlue: theme.colors.primary.text,\n };\n\n const form = {\n // Next-gen forms functional colors\n formLabel: theme.colors.text.primary,\n formDescription: theme.colors.text.secondary,\n formInputBg: theme.components.input.background,\n formInputBgDisabled: theme.colors.action.disabledBackground,\n formInputBorder: theme.components.input.borderColor,\n formInputBorderHover: theme.components.input.borderHover,\n formInputBorderActive: theme.colors.primary.border,\n formInputBorderInvalid: theme.colors.error.border,\n formInputPlaceholderText: theme.colors.text.disabled,\n formInputText: theme.components.input.text,\n formInputDisabledText: theme.colors.action.disabledText,\n formFocusOutline: theme.colors.primary.main,\n formValidationMessageText: theme.colors.error.contrastText,\n formValidationMessageBg: theme.colors.error.main,\n };\n\n return {\n ...oldCommon,\n type: theme.colors.mode === 'dark' ? GrafanaThemeType.Dark : GrafanaThemeType.Light,\n isDark: theme.isDark,\n isLight: theme.isLight,\n name: theme.name,\n palette: {\n ...basicColors,\n brandPrimary: basicColors.orange,\n brandSuccess: theme.colors.success.main,\n brandWarning: theme.colors.warning.main,\n brandDanger: theme.colors.error.main,\n queryRed: theme.colors.error.text,\n queryGreen: theme.colors.success.text,\n queryPurple: '#fe85fc',\n queryOrange: basicColors.orange,\n online: theme.colors.success.main,\n warn: theme.colors.success.main,\n critical: theme.colors.success.main,\n },\n colors: {\n ...backgrounds,\n ...borders,\n ...form,\n ...textColors,\n\n bodyBg: theme.colors.background.canvas,\n panelBg: theme.components.panel.background,\n panelBorder: theme.components.panel.borderColor,\n pageHeaderBg: theme.colors.background.canvas,\n pageHeaderBorder: theme.colors.background.canvas,\n\n dropdownBg: form.formInputBg,\n dropdownShadow: basicColors.black,\n dropdownOptionHoverBg: backgrounds.bg2,\n\n link: theme.colors.text.primary,\n linkDisabled: theme.colors.text.disabled,\n linkHover: theme.colors.text.maxContrast,\n linkExternal: theme.colors.text.link,\n },\n shadows: {\n listItem: 'none',\n },\n visualization: theme.visualization,\n };\n}\n\nconst commonColorsPalette = {\n // New greys palette used by next-gen form elements\n gray98: '#f7f8fa',\n gray97: '#f1f5f9',\n gray95: '#e9edf2',\n gray90: '#dce1e6',\n gray85: '#c7d0d9',\n gray70: '#9fa7b3',\n gray60: '#7b8087',\n gray33: '#464c54',\n gray25: '#2c3235',\n gray15: '#202226',\n gray10: '#141619',\n gray05: '#0b0c0e',\n\n // New blues palette used by next-gen form elements\n blue95: '#5794f2', // blue95\n blue85: '#33a2e5', // blueText\n blue80: '#3274d9', // blue80\n blue77: '#1f60c4', // blue77\n\n // New reds palette used by next-gen form elements\n red88: '#e02f44',\n};\n","import { createBreakpoints } from './breakpoints';\nimport { createColors, ThemeColorsInput } from './createColors';\nimport { createComponents } from './createComponents';\nimport { createShadows } from './createShadows';\nimport { createShape, ThemeShapeInput } from './createShape';\nimport { createSpacing, ThemeSpacingOptions } from './createSpacing';\nimport { createTransitions } from './createTransitions';\nimport { createTypography, ThemeTypographyInput } from './createTypography';\nimport { createV1Theme } from './createV1Theme';\nimport { createVisualizationColors } from './createVisualizationColors';\nimport { GrafanaTheme2 } from './types';\nimport { zIndex } from './zIndex';\n\n/** @internal */\nexport interface NewThemeOptions {\n name?: string;\n colors?: ThemeColorsInput;\n spacing?: ThemeSpacingOptions;\n shape?: ThemeShapeInput;\n typography?: ThemeTypographyInput;\n}\n\n/** @internal */\nexport function createTheme(options: NewThemeOptions = {}): GrafanaTheme2 {\n const {\n colors: colorsInput = {},\n spacing: spacingInput = {},\n shape: shapeInput = {},\n typography: typographyInput = {},\n } = options;\n\n const colors = createColors(colorsInput);\n const breakpoints = createBreakpoints();\n const spacing = createSpacing(spacingInput);\n const shape = createShape(shapeInput);\n const typography = createTypography(colors, typographyInput);\n const shadows = createShadows(colors);\n const transitions = createTransitions();\n const components = createComponents(colors, shadows);\n const visualization = createVisualizationColors(colors);\n\n const theme = {\n name: colors.mode === 'dark' ? 'Dark' : 'Light',\n isDark: colors.mode === 'dark',\n isLight: colors.mode === 'light',\n colors,\n breakpoints,\n spacing,\n shape,\n components,\n typography,\n shadows,\n transitions,\n visualization,\n zIndex: {\n ...zIndex,\n },\n };\n\n return {\n ...theme,\n v1: createV1Theme(theme),\n };\n}\n","export const palette = {\n white: '#FFFFFF',\n black: '#000000',\n\n gray25: '#2c3235',\n gray15: '#22252b', //'#202226',\n gray10: '#181b1f', // old '#141619',\n gray05: '#111217', // old '#0b0c0e',\n\n // new from figma,\n darkLayer0: '#18181A',\n darkLayer1: '#212124',\n darkLayer2: '#2a2a2f', // figma used #34343B but a bit too bright\n\n darkBorder1: '#34343B',\n darkBorder2: '#64646B',\n\n // Dashboard bg / layer 0 (light theme)\n gray90: '#F4F5F5',\n // Card bg / layer 1\n gray100: '#F4F5F5',\n // divider line\n gray80: '#D0D1D3',\n // from figma\n lightBorder1: '#E4E7E7',\n\n blueDarkMain: '#3D71D9', // '#4165F5',\n blueDarkText: '#6E9FFF', // '#58a6ff', //'#33a2e5', // '#5790FF',\n redDarkMain: '#D10E5C',\n redDarkText: '#FF5286',\n greenDarkMain: '#1A7F4B',\n greenDarkText: '#6CCF8E',\n orangeDarkMain: '#F5B73D',\n orangeDarkText: '#F8D06B',\n\n blueLightMain: '#3871DC',\n blueLightText: '#1F62E0',\n redLightMain: '#E0226E',\n redLightText: '#CF0E5B',\n greenLightMain: '#1B855E',\n greenLightText: '#0A764E',\n orangeLightMain: '#FAD34A',\n orangeLightText: '#8A6C00',\n};\n","// Libraries\nimport { isNumber } from 'lodash';\n\nimport { NullValueMode, Field, FieldState, FieldCalcs, FieldType } from '../types/index';\nimport { Registry, RegistryItem } from '../utils/Registry';\n\nexport enum ReducerID {\n sum = 'sum',\n max = 'max',\n min = 'min',\n logmin = 'logmin',\n mean = 'mean',\n last = 'last',\n first = 'first',\n count = 'count',\n range = 'range',\n diff = 'diff',\n diffperc = 'diffperc',\n delta = 'delta',\n step = 'step',\n firstNotNull = 'firstNotNull',\n lastNotNull = 'lastNotNull',\n changeCount = 'changeCount',\n distinctCount = 'distinctCount',\n allIsZero = 'allIsZero',\n allIsNull = 'allIsNull',\n allValues = 'allValues',\n uniqueValues = 'uniqueValues',\n}\n\n// Internal function\ntype FieldReducer = (field: Field, ignoreNulls: boolean, nullAsZero: boolean) => FieldCalcs;\n\nexport interface FieldReducerInfo extends RegistryItem {\n // Internal details\n emptyInputResult?: any; // typically null, but some things like 'count' & 'sum' should be zero\n standard: boolean; // The most common stats can all be calculated in a single pass\n reduce?: FieldReducer;\n}\n\ninterface ReduceFieldOptions {\n field: Field;\n reducers: string[]; // The stats to calculate\n}\n\n/**\n * @returns an object with a key for each selected stat\n * NOTE: This will also modify the 'field.state' object,\n * leaving values in a cache until cleared.\n */\nexport function reduceField(options: ReduceFieldOptions): FieldCalcs {\n const { field, reducers } = options;\n\n if (!field || !reducers || reducers.length < 1) {\n return {};\n }\n\n if (field.state?.calcs) {\n // Find the values we need to calculate\n const missing: string[] = [];\n for (const s of reducers) {\n if (!field.state.calcs.hasOwnProperty(s)) {\n missing.push(s);\n }\n }\n if (missing.length < 1) {\n return {\n ...field.state.calcs,\n };\n }\n }\n if (!field.state) {\n field.state = {} as FieldState;\n }\n\n const queue = fieldReducers.list(reducers);\n\n // Return early for empty series\n // This lets the concrete implementations assume at least one row\n const data = field.values;\n if (data.length < 1) {\n const calcs = { ...field.state.calcs } as FieldCalcs;\n for (const reducer of queue) {\n calcs[reducer.id] = reducer.emptyInputResult !== null ? reducer.emptyInputResult : null;\n }\n return (field.state.calcs = calcs);\n }\n\n const { nullValueMode } = field.config;\n const ignoreNulls = nullValueMode === NullValueMode.Ignore;\n const nullAsZero = nullValueMode === NullValueMode.AsZero;\n\n // Avoid calculating all the standard stats if possible\n if (queue.length === 1 && queue[0].reduce) {\n const values = queue[0].reduce(field, ignoreNulls, nullAsZero);\n field.state.calcs = {\n ...field.state.calcs,\n ...values,\n };\n return values;\n }\n\n // For now everything can use the standard stats\n let values = doStandardCalcs(field, ignoreNulls, nullAsZero);\n\n for (const reducer of queue) {\n if (!values.hasOwnProperty(reducer.id) && reducer.reduce) {\n values = {\n ...values,\n ...reducer.reduce(field, ignoreNulls, nullAsZero),\n };\n }\n }\n\n field.state.calcs = {\n ...field.state.calcs,\n ...values,\n };\n return values;\n}\n\n// ------------------------------------------------------------------------------\n//\n// No Exported symbols below here.\n//\n// ------------------------------------------------------------------------------\n\nexport const fieldReducers = new Registry<FieldReducerInfo>(() => [\n {\n id: ReducerID.lastNotNull,\n name: 'Last *',\n description: 'Last non-null value',\n standard: true,\n aliasIds: ['current'],\n reduce: calculateLastNotNull,\n },\n {\n id: ReducerID.last,\n name: 'Last',\n description: 'Last value',\n standard: true,\n reduce: calculateLast,\n },\n {\n id: ReducerID.firstNotNull,\n name: 'First *',\n description: 'First non-null value',\n standard: true,\n reduce: calculateFirstNotNull,\n },\n { id: ReducerID.first, name: 'First', description: 'First Value', standard: true, reduce: calculateFirst },\n { id: ReducerID.min, name: 'Min', description: 'Minimum Value', standard: true },\n { id: ReducerID.max, name: 'Max', description: 'Maximum Value', standard: true },\n { id: ReducerID.mean, name: 'Mean', description: 'Average Value', standard: true, aliasIds: ['avg'] },\n {\n id: ReducerID.sum,\n name: 'Total',\n description: 'The sum of all values',\n emptyInputResult: 0,\n standard: true,\n aliasIds: ['total'],\n },\n {\n id: ReducerID.count,\n name: 'Count',\n description: 'Number of values in response',\n emptyInputResult: 0,\n standard: true,\n },\n {\n id: ReducerID.range,\n name: 'Range',\n description: 'Difference between minimum and maximum values',\n standard: true,\n },\n {\n id: ReducerID.delta,\n name: 'Delta',\n description: 'Cumulative change in value',\n standard: true,\n },\n {\n id: ReducerID.step,\n name: 'Step',\n description: 'Minimum interval between values',\n standard: true,\n },\n {\n id: ReducerID.diff,\n name: 'Difference',\n description: 'Difference between first and last values',\n standard: true,\n },\n {\n id: ReducerID.logmin,\n name: 'Min (above zero)',\n description: 'Used for log min scale',\n standard: true,\n },\n {\n id: ReducerID.allIsZero,\n name: 'All Zeros',\n description: 'All values are zero',\n emptyInputResult: false,\n standard: true,\n },\n {\n id: ReducerID.allIsNull,\n name: 'All Nulls',\n description: 'All values are null',\n emptyInputResult: true,\n standard: true,\n },\n {\n id: ReducerID.changeCount,\n name: 'Change Count',\n description: 'Number of times the value changes',\n standard: false,\n reduce: calculateChangeCount,\n },\n {\n id: ReducerID.distinctCount,\n name: 'Distinct Count',\n description: 'Number of distinct values',\n standard: false,\n reduce: calculateDistinctCount,\n },\n {\n id: ReducerID.diffperc,\n name: 'Difference percent',\n description: 'Percentage difference between first and last values',\n standard: true,\n },\n {\n id: ReducerID.allValues,\n name: 'All values',\n description: 'Returns an array with all values',\n standard: false,\n reduce: (field: Field) => ({ allValues: field.values.toArray() }),\n },\n {\n id: ReducerID.uniqueValues,\n name: 'All unique values',\n description: 'Returns an array with all unique values',\n standard: false,\n reduce: (field: Field) => ({\n uniqueValues: [...new Set(field.values.toArray())],\n }),\n },\n]);\n\nexport function doStandardCalcs(field: Field, ignoreNulls: boolean, nullAsZero: boolean): FieldCalcs {\n const calcs = {\n sum: 0,\n max: -Number.MAX_VALUE,\n min: Number.MAX_VALUE,\n logmin: Number.MAX_VALUE,\n mean: null,\n last: null,\n first: null,\n lastNotNull: null,\n firstNotNull: null,\n count: 0,\n nonNullCount: 0,\n allIsNull: true,\n allIsZero: true,\n range: null,\n diff: null,\n delta: 0,\n step: Number.MAX_VALUE,\n diffperc: 0,\n\n // Just used for calculations -- not exposed as a stat\n previousDeltaUp: true,\n } as FieldCalcs;\n\n const data = field.values;\n calcs.count = data.length;\n\n const isNumberField = field.type === FieldType.number || FieldType.time;\n\n for (let i = 0; i < data.length; i++) {\n let currentValue = data.get(i);\n\n if (i === 0) {\n calcs.first = currentValue;\n }\n\n calcs.last = currentValue;\n\n if (currentValue === null) {\n if (ignoreNulls) {\n continue;\n }\n if (nullAsZero) {\n currentValue = 0;\n }\n }\n\n if (currentValue != null) {\n // null || undefined\n const isFirst = calcs.firstNotNull === null;\n if (isFirst) {\n calcs.firstNotNull = currentValue;\n }\n\n if (isNumberField) {\n calcs.sum += currentValue;\n calcs.allIsNull = false;\n calcs.nonNullCount++;\n\n if (!isFirst) {\n const step = currentValue - calcs.lastNotNull!;\n if (calcs.step > step) {\n calcs.step = step; // the minimum interval\n }\n\n if (calcs.lastNotNull! > currentValue) {\n // counter reset\n calcs.previousDeltaUp = false;\n if (i === data.length - 1) {\n // reset on last\n calcs.delta += currentValue;\n }\n } else {\n if (calcs.previousDeltaUp) {\n calcs.delta += step; // normal increment\n } else {\n calcs.delta += currentValue; // account for counter reset\n }\n calcs.previousDeltaUp = true;\n }\n }\n\n if (currentValue > calcs.max) {\n calcs.max = currentValue;\n }\n\n if (currentValue < calcs.min) {\n calcs.min = currentValue;\n }\n\n if (currentValue < calcs.logmin && currentValue > 0) {\n calcs.logmin = currentValue;\n }\n }\n\n if (currentValue !== 0) {\n calcs.allIsZero = false;\n }\n\n calcs.lastNotNull = currentValue;\n }\n }\n\n if (calcs.max === -Number.MAX_VALUE) {\n calcs.max = null;\n }\n\n if (calcs.min === Number.MAX_VALUE) {\n calcs.min = null;\n }\n\n if (calcs.step === Number.MAX_VALUE) {\n calcs.step = null;\n }\n\n if (calcs.nonNullCount > 0) {\n calcs.mean = calcs.sum! / calcs.nonNullCount;\n }\n\n if (calcs.allIsNull) {\n calcs.allIsZero = false;\n }\n\n if (calcs.max !== null && calcs.min !== null) {\n calcs.range = calcs.max - calcs.min;\n }\n\n if (isNumber(calcs.firstNotNull) && isNumber(calcs.lastNotNull)) {\n calcs.diff = calcs.lastNotNull - calcs.firstNotNull;\n }\n\n if (isNumber(calcs.firstNotNull) && isNumber(calcs.diff)) {\n calcs.diffperc = calcs.diff / calcs.firstNotNull;\n }\n return calcs;\n}\n\nfunction calculateFirst(field: Field, ignoreNulls: boolean, nullAsZero: boolean): FieldCalcs {\n return { first: field.values.get(0) };\n}\n\nfunction calculateFirstNotNull(field: Field, ignoreNulls: boolean, nullAsZero: boolean): FieldCalcs {\n const data = field.values;\n for (let idx = 0; idx < data.length; idx++) {\n const v = data.get(idx);\n if (v != null && v !== undefined) {\n return { firstNotNull: v };\n }\n }\n return { firstNotNull: null };\n}\n\nfunction calculateLast(field: Field, ignoreNulls: boolean, nullAsZero: boolean): FieldCalcs {\n const data = field.values;\n return { last: data.get(data.length - 1) };\n}\n\nfunction calculateLastNotNull(field: Field, ignoreNulls: boolean, nullAsZero: boolean): FieldCalcs {\n const data = field.values;\n let idx = data.length - 1;\n while (idx >= 0) {\n const v = data.get(idx--);\n if (v != null && v !== undefined) {\n return { lastNotNull: v };\n }\n }\n return { lastNotNull: null };\n}\n\nfunction calculateChangeCount(field: Field, ignoreNulls: boolean, nullAsZero: boolean): FieldCalcs {\n const data = field.values;\n let count = 0;\n let first = true;\n let last: any = null;\n for (let i = 0; i < data.length; i++) {\n let currentValue = data.get(i);\n if (currentValue === null) {\n if (ignoreNulls) {\n continue;\n }\n if (nullAsZero) {\n currentValue = 0;\n }\n }\n if (!first && last !== currentValue) {\n count++;\n }\n first = false;\n last = currentValue;\n }\n\n return { changeCount: count };\n}\n\nfunction calculateDistinctCount(field: Field, ignoreNulls: boolean, nullAsZero: boolean): FieldCalcs {\n const data = field.values;\n const distinct = new Set<any>();\n for (let i = 0; i < data.length; i++) {\n let currentValue = data.get(i);\n if (currentValue === null) {\n if (ignoreNulls) {\n continue;\n }\n if (nullAsZero) {\n currentValue = 0;\n }\n }\n distinct.add(currentValue);\n }\n return { distinctCount: distinct.size };\n}\n","import { Field, FieldType, DataFrame } from '../../types/dataFrame';\nimport { FieldMatcherInfo } from '../../types/transformations';\n\nimport { FieldMatcherID } from './ids';\n\n// General Field matcher\nconst fieldTypeMatcher: FieldMatcherInfo<FieldType> = {\n id: FieldMatcherID.byType,\n name: 'Field Type',\n description: 'match based on the field type',\n defaultOptions: FieldType.number,\n\n get: (type: FieldType) => {\n return (field: Field, frame: DataFrame, allFrames: DataFrame[]) => {\n return type === field.type;\n };\n },\n\n getOptionsDisplayText: (type: FieldType) => {\n return `Field type: ${type}`;\n },\n};\n\n// Numeric Field matcher\n// This gets its own entry so it shows up in the dropdown\nconst numericMatcher: FieldMatcherInfo = {\n id: FieldMatcherID.numeric,\n name: 'Numeric Fields',\n description: 'Fields with type number',\n\n get: () => {\n return fieldTypeMatcher.get(FieldType.number);\n },\n\n getOptionsDisplayText: () => {\n return 'Numeric Fields';\n },\n};\n\n// Time Field matcher\nconst timeMatcher: FieldMatcherInfo = {\n id: FieldMatcherID.time,\n name: 'Time Fields',\n description: 'Fields with type time',\n\n get: () => {\n return fieldTypeMatcher.get(FieldType.time);\n },\n\n getOptionsDisplayText: () => {\n return 'Time Fields';\n },\n};\n\n/**\n * Registry Initialization\n */\nexport function getFieldTypeMatchers(): FieldMatcherInfo[] {\n return [fieldTypeMatcher, numericMatcher, timeMatcher];\n}\n","// This needs to be in its own file to avoid circular references\n\n// Builtin Predicates\n// not using 'any' and 'never' since they are reserved keywords\nexport enum MatcherID {\n anyMatch = 'anyMatch', // checks children\n allMatch = 'allMatch', // checks children\n invertMatch = 'invertMatch', // checks child\n alwaysMatch = 'alwaysMatch',\n neverMatch = 'neverMatch',\n}\n\nexport enum FieldMatcherID {\n // Specific Types\n numeric = 'numeric',\n time = 'time', // Can be multiple times\n first = 'first',\n firstTimeField = 'firstTimeField', // Only the first fime field\n\n // With arguments\n byType = 'byType',\n byName = 'byName',\n byNames = 'byNames',\n byRegexp = 'byRegexp',\n byRegexpOrNames = 'byRegexpOrNames',\n byFrameRefID = 'byFrameRefID',\n // byIndex = 'byIndex',\n // byLabel = 'byLabel',\n}\n\n/**\n * Field name matchers\n */\nexport enum FrameMatcherID {\n byName = 'byName',\n byRefId = 'byRefId',\n byIndex = 'byIndex',\n byLabel = 'byLabel',\n}\n\n/**\n * @public\n */\nexport enum ValueMatcherID {\n regex = 'regex',\n isNull = 'isNull',\n isNotNull = 'isNotNull',\n greater = 'greater',\n greaterOrEqual = 'greaterOrEqual',\n lower = 'lower',\n lowerOrEqual = 'lowerOrEqual',\n equal = 'equal',\n notEqual = 'notEqual',\n between = 'between',\n}\n","import { Field, DataFrame, FieldType } from '../../types/dataFrame';\nimport { FieldMatcherInfo, MatcherConfig, FrameMatcherInfo } from '../../types/transformations';\nimport { getFieldMatcher, fieldMatchers, getFrameMatchers, frameMatchers } from '../matchers';\n\nimport { MatcherID } from './ids';\n\nconst anyFieldMatcher: FieldMatcherInfo<MatcherConfig[]> = {\n id: MatcherID.anyMatch,\n name: 'Any',\n description: 'Any child matches (OR)',\n excludeFromPicker: true,\n defaultOptions: [], // empty array\n\n get: (options: MatcherConfig[]) => {\n const children = options.map((option) => {\n return getFieldMatcher(option);\n });\n return (field: Field, frame: DataFrame, allFrames: DataFrame[]) => {\n for (const child of children) {\n if (child(field, frame, allFrames)) {\n return true;\n }\n }\n return false;\n };\n },\n\n getOptionsDisplayText: (options: MatcherConfig[]) => {\n let text = '';\n for (const sub of options) {\n if (text.length > 0) {\n text += ' OR ';\n }\n const matcher = fieldMatchers.get(sub.id);\n text += matcher.getOptionsDisplayText ? matcher.getOptionsDisplayText(sub) : matcher.name;\n }\n return text;\n },\n};\n\nconst anyFrameMatcher: FrameMatcherInfo<MatcherConfig[]> = {\n id: MatcherID.anyMatch,\n name: 'Any',\n description: 'Any child matches (OR)',\n excludeFromPicker: true,\n defaultOptions: [], // empty array\n\n get: (options: MatcherConfig[]) => {\n const children = options.map((option) => {\n return getFrameMatchers(option);\n });\n return (frame: DataFrame) => {\n for (const child of children) {\n if (child(frame)) {\n return true;\n }\n }\n return false;\n };\n },\n\n getOptionsDisplayText: (options: MatcherConfig[]) => {\n let text = '';\n for (const sub of options) {\n if (text.length > 0) {\n text += ' OR ';\n }\n const matcher = frameMatchers.get(sub.id);\n text += matcher.getOptionsDisplayText ? matcher.getOptionsDisplayText(sub) : matcher.name;\n }\n return text;\n },\n};\n\nconst allFieldsMatcher: FieldMatcherInfo<MatcherConfig[]> = {\n id: MatcherID.allMatch,\n name: 'All',\n description: 'Everything matches (AND)',\n excludeFromPicker: true,\n defaultOptions: [], // empty array\n\n get: (options: MatcherConfig[]) => {\n const children = options.map((option) => {\n return getFieldMatcher(option);\n });\n return (field: Field, frame: DataFrame, allFrames: DataFrame[]) => {\n for (const child of children) {\n if (!child(field, frame, allFrames)) {\n return false;\n }\n }\n return true;\n };\n },\n\n getOptionsDisplayText: (options: MatcherConfig[]) => {\n let text = '';\n for (const sub of options) {\n if (text.length > 0) {\n text += ' AND ';\n }\n const matcher = fieldMatchers.get(sub.id); // Ugho what about frame\n text += matcher.getOptionsDisplayText ? matcher.getOptionsDisplayText(sub) : matcher.name;\n }\n return text;\n },\n};\n\nconst allFramesMatcher: FrameMatcherInfo<MatcherConfig[]> = {\n id: MatcherID.allMatch,\n name: 'All',\n description: 'Everything matches (AND)',\n excludeFromPicker: true,\n defaultOptions: [], // empty array\n\n get: (options: MatcherConfig[]) => {\n const children = options.map((option) => {\n return getFrameMatchers(option);\n });\n return (frame: DataFrame) => {\n for (const child of children) {\n if (!child(frame)) {\n return false;\n }\n }\n return true;\n };\n },\n\n getOptionsDisplayText: (options: MatcherConfig[]) => {\n let text = '';\n for (const sub of options) {\n if (text.length > 0) {\n text += ' AND ';\n }\n const matcher = frameMatchers.get(sub.id);\n text += matcher.getOptionsDisplayText ? matcher.getOptionsDisplayText(sub) : matcher.name;\n }\n return text;\n },\n};\n\nconst notFieldMatcher: FieldMatcherInfo<MatcherConfig> = {\n id: MatcherID.invertMatch,\n name: 'NOT',\n description: 'Inverts other matchers',\n excludeFromPicker: true,\n\n get: (option: MatcherConfig) => {\n const check = getFieldMatcher(option);\n return (field: Field, frame: DataFrame, allFrames: DataFrame[]) => {\n return !check(field, frame, allFrames);\n };\n },\n\n getOptionsDisplayText: (options: MatcherConfig) => {\n const matcher = fieldMatchers.get(options.id);\n const text = matcher.getOptionsDisplayText ? matcher.getOptionsDisplayText(options.options) : matcher.name;\n return 'NOT ' + text;\n },\n};\n\nconst notFrameMatcher: FrameMatcherInfo<MatcherConfig> = {\n id: MatcherID.invertMatch,\n name: 'NOT',\n description: 'Inverts other matchers',\n excludeFromPicker: true,\n\n get: (option: MatcherConfig) => {\n const check = getFrameMatchers(option);\n return (frame: DataFrame) => {\n return !check(frame);\n };\n },\n\n getOptionsDisplayText: (options: MatcherConfig) => {\n const matcher = frameMatchers.get(options.id);\n const text = matcher.getOptionsDisplayText ? matcher.getOptionsDisplayText(options.options) : matcher.name;\n return 'NOT ' + text;\n },\n};\n\nexport const alwaysFieldMatcher = (field: Field) => {\n return true;\n};\n\nexport const alwaysFrameMatcher = (frame: DataFrame) => {\n return true;\n};\n\nexport const neverFieldMatcher = (field: Field) => {\n return false;\n};\n\nexport const notTimeFieldMatcher = (field: Field) => {\n return field.type !== FieldType.time;\n};\n\nexport const neverFrameMatcher = (frame: DataFrame) => {\n return false;\n};\n\nconst alwaysFieldMatcherInfo: FieldMatcherInfo = {\n id: MatcherID.alwaysMatch,\n name: 'All Fields',\n description: 'Always Match',\n\n get: (option: any) => {\n return alwaysFieldMatcher;\n },\n\n getOptionsDisplayText: (options: any) => {\n return 'Always';\n },\n};\n\nconst alwaysFrameMatcherInfo: FrameMatcherInfo = {\n id: MatcherID.alwaysMatch,\n name: 'All Frames',\n description: 'Always Match',\n\n get: (option: any) => {\n return alwaysFrameMatcher;\n },\n\n getOptionsDisplayText: (options: any) => {\n return 'Always';\n },\n};\n\nconst neverFieldMatcherInfo: FieldMatcherInfo = {\n id: MatcherID.neverMatch,\n name: 'No Fields',\n description: 'Never Match',\n excludeFromPicker: true,\n\n get: (option: any) => {\n return neverFieldMatcher;\n },\n\n getOptionsDisplayText: (options: any) => {\n return 'Never';\n },\n};\n\nconst neverFrameMatcherInfo: FrameMatcherInfo = {\n id: MatcherID.neverMatch,\n name: 'No Frames',\n description: 'Never Match',\n\n get: (option: any) => {\n return neverFrameMatcher;\n },\n\n getOptionsDisplayText: (options: any) => {\n return 'Never';\n },\n};\n\nexport function getFieldPredicateMatchers(): FieldMatcherInfo[] {\n return [anyFieldMatcher, allFieldsMatcher, notFieldMatcher, alwaysFieldMatcherInfo, neverFieldMatcherInfo];\n}\n\nexport function getFramePredicateMatchers(): FrameMatcherInfo[] {\n return [anyFrameMatcher, allFramesMatcher, notFrameMatcher, alwaysFrameMatcherInfo, neverFrameMatcherInfo];\n}\n","import { stringToJsRegex } from '../../text';\nimport { DataFrame } from '../../types/dataFrame';\nimport { FrameMatcherInfo } from '../../types/transformations';\n\nimport { FrameMatcherID } from './ids';\n\n// General Field matcher\nconst refIdMacher: FrameMatcherInfo<string> = {\n id: FrameMatcherID.byRefId,\n name: 'Query refId',\n description: 'match the refId',\n defaultOptions: 'A',\n\n get: (pattern: string) => {\n const regex = stringToJsRegex(pattern);\n return (frame: DataFrame) => {\n return regex.test(frame.refId || '');\n };\n },\n\n getOptionsDisplayText: (pattern: string) => {\n return `RefID: ${pattern}`;\n },\n};\n\nexport function getRefIdMatchers(): FrameMatcherInfo[] {\n return [refIdMacher];\n}\n","import { Field, FieldType, DataFrame } from '../../types/dataFrame';\nimport { FieldMatcherInfo } from '../../types/transformations';\n\nimport { FieldMatcherID } from './ids';\n\nconst firstFieldMatcher: FieldMatcherInfo = {\n id: FieldMatcherID.first,\n name: 'First Field',\n description: 'The first field in the frame',\n\n get: (type: FieldType) => {\n return (field: Field, frame: DataFrame, allFrames: DataFrame[]) => {\n return field === frame.fields[0];\n };\n },\n\n getOptionsDisplayText: () => {\n return `First field`;\n },\n};\n\nconst firstTimeFieldMatcher: FieldMatcherInfo = {\n id: FieldMatcherID.firstTimeField,\n name: 'First time field',\n description: 'The first field of type time in a frame',\n\n get: (type: FieldType) => {\n return (field: Field, frame: DataFrame, allFrames: DataFrame[]) => {\n return field.type === FieldType.time && field === frame.fields.find((f) => f.type === FieldType.time);\n };\n },\n\n getOptionsDisplayText: () => {\n return `First time field`;\n },\n};\n\n/**\n * Registry Initialization\n */\nexport function getSimpleFieldMatchers(): FieldMatcherInfo[] {\n return [firstFieldMatcher, firstTimeFieldMatcher];\n}\n","import { Field } from '../../../types/dataFrame';\nimport { ValueMatcherInfo } from '../../../types/transformations';\nimport { ValueMatcherID } from '../ids';\n\nimport { BasicValueMatcherOptions } from './types';\n\nconst isEqualValueMatcher: ValueMatcherInfo<BasicValueMatcherOptions> = {\n id: ValueMatcherID.equal,\n name: 'Is equal',\n description: 'Match where value for given field is equal to options value.',\n get: (options) => {\n return (valueIndex: number, field: Field) => {\n const value = field.values.get(valueIndex);\n // eslint-disable-next-line eqeqeq\n return value == options.value;\n };\n },\n getOptionsDisplayText: () => {\n return `Matches all rows where field is null.`;\n },\n isApplicable: () => true,\n getDefaultOptions: () => ({ value: '' }),\n};\n\nconst isNotEqualValueMatcher: ValueMatcherInfo<BasicValueMatcherOptions> = {\n id: ValueMatcherID.notEqual,\n name: 'Is not equal',\n description: 'Match where value for given field is not equal to options value.',\n get: (options) => {\n return (valueIndex: number, field: Field) => {\n const value = field.values.get(valueIndex);\n // eslint-disable-next-line eqeqeq\n return value != options.value;\n };\n },\n getOptionsDisplayText: () => {\n return `Matches all rows where field is not null.`;\n },\n isApplicable: () => true,\n getDefaultOptions: () => ({ value: '' }),\n};\n\nexport const getEqualValueMatchers = (): ValueMatcherInfo[] => [isEqualValueMatcher, isNotEqualValueMatcher];\n","import { Field } from '../../../types/dataFrame';\nimport { ValueMatcherInfo } from '../../../types/transformations';\nimport { ValueMatcherID } from '../ids';\n\nimport { ValueMatcherOptions } from './types';\n\nconst isNullValueMatcher: ValueMatcherInfo<ValueMatcherOptions> = {\n id: ValueMatcherID.isNull,\n name: 'Is null',\n description: 'Match where value for given field is null.',\n get: () => {\n return (valueIndex: number, field: Field) => {\n const value = field.values.get(valueIndex);\n return value == null;\n };\n },\n getOptionsDisplayText: () => {\n return `Matches all rows where field is null.`;\n },\n isApplicable: () => true,\n getDefaultOptions: () => ({}),\n};\n\nconst isNotNullValueMatcher: ValueMatcherInfo<ValueMatcherOptions> = {\n id: ValueMatcherID.isNotNull,\n name: 'Is not null',\n description: 'Match where value for given field is not null.',\n get: () => {\n return (valueIndex: number, field: Field) => {\n const value = field.values.get(valueIndex);\n return value != null;\n };\n },\n getOptionsDisplayText: () => {\n return `Matches all rows where field is not null.`;\n },\n isApplicable: () => true,\n getDefaultOptions: () => ({}),\n};\n\nexport const getNullValueMatchers = (): ValueMatcherInfo[] => [isNullValueMatcher, isNotNullValueMatcher];\n","import { Field, FieldType } from '../../../types/dataFrame';\nimport { ValueMatcherInfo } from '../../../types/transformations';\nimport { ValueMatcherID } from '../ids';\n\nimport { BasicValueMatcherOptions } from './types';\n\nconst isGreaterValueMatcher: ValueMatcherInfo<BasicValueMatcherOptions<number>> = {\n id: ValueMatcherID.greater,\n name: 'Is greater',\n description: 'Match when field value is greater than option.',\n get: (options) => {\n return (valueIndex: number, field: Field) => {\n const value = field.values.get(valueIndex);\n if (isNaN(value)) {\n return false;\n }\n return value > options.value;\n };\n },\n getOptionsDisplayText: (options) => {\n return `Matches all rows where field value is greater than: ${options.value}.`;\n },\n isApplicable: (field) => field.type === FieldType.number,\n getDefaultOptions: () => ({ value: 0 }),\n};\n\nconst isGreaterOrEqualValueMatcher: ValueMatcherInfo<BasicValueMatcherOptions<number>> = {\n id: ValueMatcherID.greaterOrEqual,\n name: 'Is greater or equal',\n description: 'Match when field value is greater than or equal to option.',\n get: (options) => {\n return (valueIndex: number, field: Field) => {\n const value = field.values.get(valueIndex);\n if (isNaN(value)) {\n return false;\n }\n return value >= options.value;\n };\n },\n getOptionsDisplayText: (options) => {\n return `Matches all rows where field value is greater than or equal to: ${options.value}.`;\n },\n isApplicable: (field) => field.type === FieldType.number,\n getDefaultOptions: () => ({ value: 0 }),\n};\n\nconst isLowerValueMatcher: ValueMatcherInfo<BasicValueMatcherOptions<number>> = {\n id: ValueMatcherID.lower,\n name: 'Is lower',\n description: 'Match when field value is lower than option.',\n get: (options) => {\n return (valueIndex: number, field: Field) => {\n const value = field.values.get(valueIndex);\n if (isNaN(value)) {\n return false;\n }\n return value < options.value;\n };\n },\n getOptionsDisplayText: (options) => {\n return `Matches all rows where field value is lower than: ${options.value}.`;\n },\n isApplicable: (field) => field.type === FieldType.number,\n getDefaultOptions: () => ({ value: 0 }),\n};\n\nconst isLowerOrEqualValueMatcher: ValueMatcherInfo<BasicValueMatcherOptions<number>> = {\n id: ValueMatcherID.lowerOrEqual,\n name: 'Is lower or equal',\n description: 'Match when field value is lower or equal than option.',\n get: (options) => {\n return (valueIndex: number, field: Field) => {\n const value = field.values.get(valueIndex);\n if (isNaN(value)) {\n return false;\n }\n return value <= options.value;\n };\n },\n getOptionsDisplayText: (options) => {\n return `Matches all rows where field value is lower or equal than: ${options.value}.`;\n },\n isApplicable: (field) => field.type === FieldType.number,\n getDefaultOptions: () => ({ value: 0 }),\n};\n\nexport const getNumericValueMatchers = (): ValueMatcherInfo[] => [\n isGreaterValueMatcher,\n isGreaterOrEqualValueMatcher,\n isLowerValueMatcher,\n isLowerOrEqualValueMatcher,\n];\n","import { Field, FieldType } from '../../../types/dataFrame';\nimport { ValueMatcherInfo } from '../../../types/transformations';\nimport { ValueMatcherID } from '../ids';\n\nimport { RangeValueMatcherOptions } from './types';\n\nconst isBetweenValueMatcher: ValueMatcherInfo<RangeValueMatcherOptions<number>> = {\n id: ValueMatcherID.between,\n name: 'Is between',\n description: 'Match when field value is between given option values.',\n get: (options) => {\n return (valueIndex: number, field: Field) => {\n const value = field.values.get(valueIndex);\n if (isNaN(value)) {\n return false;\n }\n return value > options.from && value < options.to;\n };\n },\n getOptionsDisplayText: (options) => {\n return `Matches all rows where field value is between ${options.from} and ${options.to}.`;\n },\n isApplicable: (field) => field.type === FieldType.number,\n getDefaultOptions: () => ({ from: 0, to: 100 }),\n};\n\nexport const getRangeValueMatchers = (): ValueMatcherInfo[] => [isBetweenValueMatcher];\n","import { Field } from '../../../types/dataFrame';\nimport { ValueMatcherInfo } from '../../../types/transformations';\nimport { ValueMatcherID } from '../ids';\n\nimport { BasicValueMatcherOptions } from './types';\n\nconst regexValueMatcher: ValueMatcherInfo<BasicValueMatcherOptions<string>> = {\n id: ValueMatcherID.regex,\n name: 'Regex',\n description: 'Match when field value is matching regex.',\n get: (options) => {\n const regex = new RegExp(options.value);\n\n return (valueIndex: number, field: Field) => {\n const value = field.values.get(valueIndex);\n return regex.test(value);\n };\n },\n getOptionsDisplayText: (options) => {\n return `Matches all rows where field value is matching regex: ${options.value}`;\n },\n isApplicable: () => true,\n getDefaultOptions: () => ({ value: '.*' }),\n};\n\nexport const getRegexValueMatcher = (): ValueMatcherInfo[] => [regexValueMatcher];\n","import { map } from 'rxjs/operators';\n\nimport { getTimeField } from '../../dataframe/processDataFrame';\nimport { DataFrame } from '../../types/dataFrame';\nimport { SynchronousDataTransformerInfo } from '../../types/transformations';\n\nimport { DataTransformerID } from './ids';\nimport { seriesToColumnsTransformer } from './seriesToColumns';\n\nexport const ensureColumnsTransformer: SynchronousDataTransformerInfo = {\n id: DataTransformerID.ensureColumns,\n name: 'Ensure Columns Transformer',\n description: 'Will check if current data frames is series or columns. If in series it will convert to columns.',\n\n operator: (options) => (source) => source.pipe(map((data) => ensureColumnsTransformer.transformer(options)(data))),\n\n transformer: (options: any) => (frames: DataFrame[]) => {\n // Assume timeseries should first be joined by time\n const timeFieldName = findConsistentTimeFieldName(frames);\n\n if (frames.length > 1 && timeFieldName) {\n return seriesToColumnsTransformer.transformer({\n byField: timeFieldName,\n })(frames);\n }\n return frames;\n },\n};\n\n/**\n * Find the name for the time field used in all frames (if one exists)\n */\nfunction findConsistentTimeFieldName(data: DataFrame[]): string | undefined {\n let name: string | undefined = undefined;\n for (const frame of data) {\n const { timeField } = getTimeField(frame);\n if (!timeField) {\n return undefined; // Not timeseries\n }\n if (!name) {\n name = timeField.name;\n } else if (name !== timeField.name) {\n // Second frame has a different time column?!\n return undefined;\n }\n }\n return name;\n}\n","import { map } from 'rxjs/operators';\n\nimport { DataFrame, Field } from '../../types/dataFrame';\nimport { DataTransformerInfo, MatcherConfig } from '../../types/transformations';\nimport { getFieldMatcher, getFrameMatchers } from '../matchers';\n\nimport { DataTransformerID } from './ids';\nimport { noopTransformer } from './noop';\n\nexport interface FilterOptions {\n include?: MatcherConfig;\n exclude?: MatcherConfig;\n}\n\nexport const filterFieldsTransformer: DataTransformerInfo<FilterOptions> = {\n id: DataTransformerID.filterFields,\n name: 'Filter Fields',\n description: 'select a subset of fields',\n defaultOptions: {},\n\n /**\n * Return a modified copy of the series. If the transform is not or should not\n * be applied, just return the input series\n */\n operator: (options: FilterOptions) => (source) => {\n if (!options.include && !options.exclude) {\n return source.pipe(noopTransformer.operator({}));\n }\n\n return source.pipe(\n map((data) => {\n const include = options.include ? getFieldMatcher(options.include) : null;\n const exclude = options.exclude ? getFieldMatcher(options.exclude) : null;\n\n const processed: DataFrame[] = [];\n for (const series of data) {\n // Find the matching field indexes\n const fields: Field[] = [];\n for (let i = 0; i < series.fields.length; i++) {\n const field = series.fields[i];\n\n if (exclude) {\n if (exclude(field, series, data)) {\n continue;\n }\n if (!include) {\n fields.push(field);\n }\n }\n if (include && include(field, series, data)) {\n fields.push(field);\n }\n }\n\n if (!fields.length) {\n continue;\n }\n const copy = {\n ...series, // all the other properties\n fields, // but a different set of fields\n };\n processed.push(copy);\n }\n return processed;\n })\n );\n },\n};\n\nexport const filterFramesTransformer: DataTransformerInfo<FilterOptions> = {\n id: DataTransformerID.filterFrames,\n name: 'Filter Frames',\n description: 'select a subset of frames',\n defaultOptions: {},\n\n /**\n * Return a modified copy of the series. If the transform is not or should not\n * be applied, just return the input series\n */\n operator: (options) => (source) => {\n if (!options.include && !options.exclude) {\n return source.pipe(noopTransformer.operator({}));\n }\n\n return source.pipe(\n map((data) => {\n const include = options.include ? getFrameMatchers(options.include) : null;\n const exclude = options.exclude ? getFrameMatchers(options.exclude) : null;\n\n const processed: DataFrame[] = [];\n for (const series of data) {\n if (exclude) {\n if (exclude(series)) {\n continue;\n }\n if (!include) {\n processed.push(series);\n }\n }\n if (include && include(series)) {\n processed.push(series);\n }\n }\n return processed;\n })\n );\n },\n};\n","import { DataTransformerInfo, MatcherConfig } from '../../types/transformations';\nimport { FieldMatcherID } from '../matchers/ids';\nimport { RegexpOrNamesMatcherOptions } from '../matchers/nameMatcher';\n\nimport { filterFieldsTransformer } from './filter';\nimport { DataTransformerID } from './ids';\n\nexport interface FilterFieldsByNameTransformerOptions {\n include?: RegexpOrNamesMatcherOptions;\n exclude?: RegexpOrNamesMatcherOptions;\n}\n\nexport const filterFieldsByNameTransformer: DataTransformerInfo<FilterFieldsByNameTransformerOptions> = {\n id: DataTransformerID.filterFieldsByName,\n name: 'Filter fields by name',\n description: 'select a subset of fields',\n defaultOptions: {},\n\n /**\n * Return a modified copy of the series. If the transform is not or should not\n * be applied, just return the input series\n */\n operator: (options) => (source) =>\n source.pipe(\n filterFieldsTransformer.operator({\n include: getMatcherConfig(options.include),\n exclude: getMatcherConfig(options.exclude),\n })\n ),\n};\n\nconst getMatcherConfig = (options?: RegexpOrNamesMatcherOptions): MatcherConfig | undefined => {\n if (!options) {\n return undefined;\n }\n\n const { names, pattern } = options;\n\n if ((!Array.isArray(names) || names.length === 0) && !pattern) {\n return undefined;\n }\n\n if (!pattern) {\n return { id: FieldMatcherID.byNames, options: { names } };\n }\n\n if (!Array.isArray(names) || names.length === 0) {\n return { id: FieldMatcherID.byRegexp, options: pattern };\n }\n\n return { id: FieldMatcherID.byRegexpOrNames, options };\n};\n","import { DataTransformerInfo } from '../../types/transformations';\nimport { FrameMatcherID } from '../matchers/ids';\n\nimport { filterFramesTransformer, FilterOptions } from './filter';\nimport { DataTransformerID } from './ids';\n\nexport interface FilterFramesByRefIdTransformerOptions {\n include?: string;\n exclude?: string;\n}\n\nexport const filterFramesByRefIdTransformer: DataTransformerInfo<FilterFramesByRefIdTransformerOptions> = {\n id: DataTransformerID.filterByRefId,\n name: 'Filter data by query refId',\n description: 'select a subset of results',\n defaultOptions: {},\n\n /**\n * Return a modified copy of the series. If the transform is not or should not\n * be applied, just return the input series\n */\n operator: (options) => (source) => {\n const filterOptions: FilterOptions = {};\n if (options.include) {\n filterOptions.include = {\n id: FrameMatcherID.byRefId,\n options: options.include,\n };\n }\n if (options.exclude) {\n filterOptions.exclude = {\n id: FrameMatcherID.byRefId,\n options: options.exclude,\n };\n }\n\n return source.pipe(filterFramesTransformer.operator(filterOptions));\n },\n};\n","export enum DataTransformerID {\n // join = 'join', // Pick a field and merge all series based on that field\n append = 'append',\n // rotate = 'rotate', // Columns to rows\n reduce = 'reduce',\n order = 'order',\n organize = 'organize',\n rename = 'rename',\n calculateField = 'calculateField',\n seriesToColumns = 'seriesToColumns',\n seriesToRows = 'seriesToRows',\n merge = 'merge',\n concatenate = 'concatenate',\n labelsToFields = 'labelsToFields',\n filterFields = 'filterFields',\n filterFieldsByName = 'filterFieldsByName',\n filterFrames = 'filterFrames',\n filterByRefId = 'filterByRefId',\n renameByRegex = 'renameByRegex',\n filterByValue = 'filterByValue',\n noop = 'noop',\n ensureColumns = 'ensureColumns',\n groupBy = 'groupBy',\n sortBy = 'sortBy',\n histogram = 'histogram',\n configFromData = 'configFromData',\n rowsToFields = 'rowsToFields',\n prepareTimeSeries = 'prepareTimeSeries',\n convertFieldType = 'convertFieldType',\n fieldLookup = 'fieldLookup',\n heatmap = 'heatmap',\n spatial = 'spatial',\n extractFields = 'extractFields',\n groupingToMatrix = 'groupingToMatrix',\n}\n","import { omit } from 'lodash';\nimport { map } from 'rxjs/operators';\n\nimport { MutableDataFrame } from '../../dataframe';\nimport { DataFrame, Field } from '../../types/dataFrame';\nimport { DataTransformerInfo } from '../../types/transformations';\nimport { ArrayVector } from '../../vector/ArrayVector';\n\nimport { DataTransformerID } from './ids';\n\ninterface ValuePointer {\n key: string;\n index: number;\n}\n\nexport interface MergeTransformerOptions {}\n\nexport const mergeTransformer: DataTransformerInfo<MergeTransformerOptions> = {\n id: DataTransformerID.merge,\n name: 'Merge series/tables',\n description: 'Merges multiple series/tables into a single serie/table',\n defaultOptions: {},\n operator: (options) => (source) =>\n source.pipe(\n map((dataFrames) => {\n if (!Array.isArray(dataFrames) || dataFrames.length <= 1) {\n return dataFrames;\n }\n\n const data = dataFrames.filter((frame) => frame.fields.length > 0);\n\n if (data.length === 0) {\n return [dataFrames[0]];\n }\n\n const fieldNames = new Set<string>();\n const fieldIndexByName: Record<string, Record<number, number>> = {};\n const fieldNamesForKey: string[] = [];\n const dataFrame = new MutableDataFrame();\n\n for (let frameIndex = 0; frameIndex < data.length; frameIndex++) {\n const frame = data[frameIndex];\n\n for (let fieldIndex = 0; fieldIndex < frame.fields.length; fieldIndex++) {\n const field = frame.fields[fieldIndex];\n\n if (!fieldNames.has(field.name)) {\n dataFrame.addField(copyFieldStructure(field));\n fieldNames.add(field.name);\n }\n\n fieldIndexByName[field.name] = fieldIndexByName[field.name] || {};\n fieldIndexByName[field.name][frameIndex] = fieldIndex;\n\n if (data.length - 1 !== frameIndex) {\n continue;\n }\n\n if (fieldExistsInAllFrames(fieldIndexByName, field, data)) {\n fieldNamesForKey.push(field.name);\n }\n }\n }\n\n if (fieldNamesForKey.length === 0) {\n return dataFrames;\n }\n\n const valuesByKey: Record<string, Array<Record<string, any>>> = {};\n const valuesInOrder: ValuePointer[] = [];\n const keyFactory = createKeyFactory(data, fieldIndexByName, fieldNamesForKey);\n const valueMapper = createValueMapper(data, fieldNames, fieldIndexByName);\n\n for (let frameIndex = 0; frameIndex < data.length; frameIndex++) {\n const frame = data[frameIndex];\n\n for (let valueIndex = 0; valueIndex < frame.length; valueIndex++) {\n const key = keyFactory(frameIndex, valueIndex);\n const value = valueMapper(frameIndex, valueIndex);\n\n if (!Array.isArray(valuesByKey[key])) {\n valuesByKey[key] = [value];\n valuesInOrder.push(createPointer(key, valuesByKey));\n continue;\n }\n\n let valueWasMerged = false;\n\n valuesByKey[key] = valuesByKey[key].map((existing) => {\n if (!isMergable(existing, value)) {\n return existing;\n }\n valueWasMerged = true;\n return { ...existing, ...value };\n });\n\n if (!valueWasMerged) {\n valuesByKey[key].push(value);\n valuesInOrder.push(createPointer(key, valuesByKey));\n }\n }\n }\n\n for (const pointer of valuesInOrder) {\n const value = valuesByKey[pointer.key][pointer.index];\n\n if (value) {\n dataFrame.add(value);\n }\n }\n\n return [dataFrame];\n })\n ),\n};\n\nconst copyFieldStructure = (field: Field): Field => {\n return {\n ...omit(field, ['values', 'state', 'labels', 'config']),\n values: new ArrayVector(),\n config: {\n ...omit(field.config, 'displayName'),\n },\n };\n};\n\nconst createKeyFactory = (\n data: DataFrame[],\n fieldPointerByName: Record<string, Record<string, number>>,\n keyFieldNames: string[]\n) => {\n const factoryIndex = keyFieldNames.reduce((index: Record<string, number[]>, fieldName) => {\n return Object.keys(fieldPointerByName[fieldName]).reduce((index: Record<string, number[]>, frameIndex) => {\n index[frameIndex] = index[frameIndex] || [];\n index[frameIndex].push(fieldPointerByName[fieldName][frameIndex]);\n return index;\n }, index);\n }, {});\n\n return (frameIndex: number, valueIndex: number): string => {\n return factoryIndex[frameIndex].reduce((key: string, fieldIndex: number) => {\n return key + data[frameIndex].fields[fieldIndex].values.get(valueIndex);\n }, '');\n };\n};\n\nconst createValueMapper = (\n data: DataFrame[],\n fieldByName: Set<string>,\n fieldIndexByName: Record<string, Record<number, number>>\n) => {\n return (frameIndex: number, valueIndex: number) => {\n const value: Record<string, any> = {};\n const fieldNames = Array.from(fieldByName);\n\n for (const fieldName of fieldNames) {\n const fieldIndexByFrameIndex = fieldIndexByName[fieldName];\n if (!fieldIndexByFrameIndex) {\n continue;\n }\n\n const fieldIndex = fieldIndexByFrameIndex[frameIndex];\n if (typeof fieldIndex !== 'number') {\n continue;\n }\n\n const frame = data[frameIndex];\n if (!frame || !frame.fields) {\n continue;\n }\n\n const field = frame.fields[fieldIndex];\n if (!field || !field.values) {\n continue;\n }\n\n value[fieldName] = field.values.get(valueIndex);\n }\n\n return value;\n };\n};\n\nconst isMergable = (existing: Record<string, any>, value: Record<string, any>): boolean => {\n let mergable = true;\n\n for (const prop in value) {\n if (typeof existing[prop] === 'undefined') {\n continue;\n }\n\n if (existing[prop] === null) {\n continue;\n }\n\n if (existing[prop] !== value[prop]) {\n mergable = false;\n break;\n }\n }\n\n return mergable;\n};\n\nconst fieldExistsInAllFrames = (\n fieldIndexByName: Record<string, Record<number, number>>,\n field: Field,\n data: DataFrame[]\n) => {\n return Object.keys(fieldIndexByName[field.name]).length === data.length;\n};\n\nconst createPointer = (key: string, valuesByKey: Record<string, Array<Record<string, any>>>): ValuePointer => {\n return {\n key,\n index: valuesByKey[key].length - 1,\n };\n};\n","import { DataTransformerInfo } from '../../types/transformations';\n\nimport { DataTransformerID } from './ids';\n\nexport interface NoopTransformerOptions {\n include?: string;\n exclude?: string;\n}\n\nexport const noopTransformer: DataTransformerInfo<NoopTransformerOptions> = {\n id: DataTransformerID.noop,\n name: 'noop',\n description: 'No-operation transformer',\n defaultOptions: {},\n\n /**\n * Return a modified copy of the series. If the transform is not or should not\n * be applied, just return the input series\n */\n operator: (options: NoopTransformerOptions) => (source) => source,\n};\n","import { DataTransformerInfo } from '../../types/transformations';\n\nimport { filterFieldsByNameTransformer } from './filterByName';\nimport { DataTransformerID } from './ids';\nimport { orderFieldsTransformer, OrderFieldsTransformerOptions } from './order';\nimport { renameFieldsTransformer, RenameFieldsTransformerOptions } from './rename';\n\nexport interface OrganizeFieldsTransformerOptions\n extends OrderFieldsTransformerOptions,\n RenameFieldsTransformerOptions {\n excludeByName: Record<string, boolean>;\n}\n\nexport const organizeFieldsTransformer: DataTransformerInfo<OrganizeFieldsTransformerOptions> = {\n id: DataTransformerID.organize,\n name: 'Organize fields by name',\n description: 'Order, filter and rename fields based on configuration given by user',\n defaultOptions: {\n excludeByName: {},\n indexByName: {},\n renameByName: {},\n },\n\n /**\n * Return a modified copy of the series. If the transform is not or should not\n * be applied, just return the input series\n */\n operator: (options) => (source) =>\n source.pipe(\n filterFieldsByNameTransformer.operator({\n exclude: { names: mapToExcludeArray(options.excludeByName) },\n }),\n orderFieldsTransformer.operator(options),\n renameFieldsTransformer.operator(options)\n ),\n};\n\nconst mapToExcludeArray = (excludeByName: Record<string, boolean>): string[] => {\n if (!excludeByName) {\n return [];\n }\n\n return Object.keys(excludeByName).filter((name) => excludeByName[name]);\n};\n","import { map } from 'rxjs/operators';\n\nimport { getFieldDisplayName } from '../../field/fieldState';\nimport { DataFrame, Field } from '../../types/dataFrame';\nimport { DataTransformerInfo } from '../../types/transformations';\n\nimport { DataTransformerID } from './ids';\n\nexport interface RenameFieldsTransformerOptions {\n renameByName: Record<string, string>;\n}\n\nexport const renameFieldsTransformer: DataTransformerInfo<RenameFieldsTransformerOptions> = {\n id: DataTransformerID.rename,\n name: 'Rename fields by name',\n description: 'Rename fields based on configuration given by user',\n defaultOptions: {\n renameByName: {},\n },\n\n /**\n * Return a modified copy of the series. If the transform is not or should not\n * be applied, just return the input series\n */\n operator: (options) => (source) =>\n source.pipe(\n map((data) => {\n const renamer = createRenamer(options.renameByName);\n\n if (!Array.isArray(data) || data.length === 0) {\n return data;\n }\n\n return data.map((frame) => ({\n ...frame,\n fields: renamer(frame),\n }));\n })\n ),\n};\n\nconst createRenamer =\n (renameByName: Record<string, string>) =>\n (frame: DataFrame): Field[] => {\n if (!renameByName || Object.keys(renameByName).length === 0) {\n return frame.fields;\n }\n\n return frame.fields.map((field) => {\n const displayName = getFieldDisplayName(field, frame);\n const renameTo = renameByName[displayName];\n\n if (typeof renameTo !== 'string' || renameTo.length === 0) {\n return field;\n }\n\n return {\n ...field,\n config: {\n ...field.config,\n displayName: renameTo,\n },\n state: {\n ...field.state,\n displayName: renameTo,\n },\n };\n });\n };\n","import { map } from 'rxjs/operators';\n\nimport { DataFrame, SynchronousDataTransformerInfo, FieldMatcher } from '../../types';\nimport { fieldMatchers } from '../matchers';\nimport { FieldMatcherID } from '../matchers/ids';\n\nimport { DataTransformerID } from './ids';\nimport { outerJoinDataFrames } from './joinDataFrames';\n\nexport interface SeriesToColumnsOptions {\n byField?: string; // empty will pick the field automatically\n}\n\nexport const seriesToColumnsTransformer: SynchronousDataTransformerInfo<SeriesToColumnsOptions> = {\n id: DataTransformerID.seriesToColumns,\n name: 'Series as columns', // Called 'Outer join' in the UI!\n description: 'Groups series by field and returns values as columns',\n defaultOptions: {\n byField: undefined, // DEFAULT_KEY_FIELD,\n },\n\n operator: (options) => (source) => source.pipe(map((data) => seriesToColumnsTransformer.transformer(options)(data))),\n\n transformer: (options: SeriesToColumnsOptions) => {\n let joinBy: FieldMatcher | undefined = undefined;\n return (data: DataFrame[]) => {\n if (data.length > 1) {\n if (options.byField && !joinBy) {\n joinBy = fieldMatchers.get(FieldMatcherID.byName).get(options.byField);\n }\n const joined = outerJoinDataFrames({ frames: data, joinBy });\n if (joined) {\n return [joined];\n }\n }\n return data;\n };\n },\n};\n","import { omit } from 'lodash';\nimport { map } from 'rxjs/operators';\n\nimport { MutableDataFrame, sortDataFrame } from '../../dataframe';\nimport { isTimeSeries } from '../../dataframe/utils';\nimport { getFrameDisplayName } from '../../field/fieldState';\nimport {\n Field,\n FieldType,\n TIME_SERIES_METRIC_FIELD_NAME,\n TIME_SERIES_TIME_FIELD_NAME,\n TIME_SERIES_VALUE_FIELD_NAME,\n} from '../../types/dataFrame';\nimport { DataTransformerInfo } from '../../types/transformations';\nimport { ArrayVector } from '../../vector';\n\nimport { DataTransformerID } from './ids';\n\nexport interface SeriesToRowsTransformerOptions {}\n\nexport const seriesToRowsTransformer: DataTransformerInfo<SeriesToRowsTransformerOptions> = {\n id: DataTransformerID.seriesToRows,\n name: 'Series to rows',\n description: 'Combines multiple series into a single serie and appends a column with metric name per value.',\n defaultOptions: {},\n operator: (options) => (source) =>\n source.pipe(\n map((data) => {\n if (!Array.isArray(data) || data.length <= 1) {\n return data;\n }\n\n if (!isTimeSeries(data)) {\n return data;\n }\n\n const timeFieldByIndex: Record<number, number> = {};\n const targetFields = new Set<string>();\n const dataFrame = new MutableDataFrame();\n const metricField: Field = {\n name: TIME_SERIES_METRIC_FIELD_NAME,\n values: new ArrayVector(),\n config: {},\n type: FieldType.string,\n };\n\n for (let frameIndex = 0; frameIndex < data.length; frameIndex++) {\n const frame = data[frameIndex];\n\n for (let fieldIndex = 0; fieldIndex < frame.fields.length; fieldIndex++) {\n const field = frame.fields[fieldIndex];\n\n if (field.type === FieldType.time) {\n timeFieldByIndex[frameIndex] = fieldIndex;\n\n if (!targetFields.has(TIME_SERIES_TIME_FIELD_NAME)) {\n dataFrame.addField(copyFieldStructure(field, TIME_SERIES_TIME_FIELD_NAME));\n dataFrame.addField(metricField);\n targetFields.add(TIME_SERIES_TIME_FIELD_NAME);\n }\n continue;\n }\n\n if (!targetFields.has(TIME_SERIES_VALUE_FIELD_NAME)) {\n dataFrame.addField(copyFieldStructure(field, TIME_SERIES_VALUE_FIELD_NAME));\n targetFields.add(TIME_SERIES_VALUE_FIELD_NAME);\n }\n }\n }\n\n for (let frameIndex = 0; frameIndex < data.length; frameIndex++) {\n const frame = data[frameIndex];\n\n for (let valueIndex = 0; valueIndex < frame.length; valueIndex++) {\n const timeFieldIndex = timeFieldByIndex[frameIndex];\n const valueFieldIndex = timeFieldIndex === 0 ? 1 : 0;\n\n dataFrame.add({\n [TIME_SERIES_TIME_FIELD_NAME]: frame.fields[timeFieldIndex].values.get(valueIndex),\n [TIME_SERIES_METRIC_FIELD_NAME]: getFrameDisplayName(frame),\n [TIME_SERIES_VALUE_FIELD_NAME]: frame.fields[valueFieldIndex].values.get(valueIndex),\n });\n }\n }\n\n return [sortDataFrame(dataFrame, 0, true)];\n })\n ),\n};\n\nconst copyFieldStructure = (field: Field, name: string): Field => {\n return {\n ...omit(field, ['values', 'state', 'labels', 'config', 'name']),\n name: name,\n values: new ArrayVector(),\n config: {\n ...omit(field.config, ['displayName', 'displayNameFromDS']),\n },\n };\n};\n","import { map } from 'rxjs/operators';\n\nimport { sortDataFrame } from '../../dataframe';\nimport { getFieldDisplayName } from '../../field';\nimport { DataFrame } from '../../types';\nimport { DataTransformerInfo } from '../../types/transformations';\n\nimport { DataTransformerID } from './ids';\n\nexport interface SortByField {\n field: string;\n desc?: boolean;\n index?: number;\n}\n\nexport interface SortByTransformerOptions {\n // NOTE: this structure supports an array, however only the first entry is used\n // future versions may support multi-sort options\n sort: SortByField[];\n}\n\nexport const sortByTransformer: DataTransformerInfo<SortByTransformerOptions> = {\n id: DataTransformerID.sortBy,\n name: 'Sort by',\n description: 'Sort fields in a frame',\n defaultOptions: {\n fields: {},\n },\n\n /**\n * Return a modified copy of the series. If the transform is not or should not\n * be applied, just return the input series\n */\n operator: (options) => (source) =>\n source.pipe(\n map((data) => {\n if (!Array.isArray(data) || data.length === 0 || !options?.sort?.length) {\n return data;\n }\n return sortDataFrames(data, options.sort);\n })\n ),\n};\n\nexport function sortDataFrames(data: DataFrame[], sort: SortByField[]): DataFrame[] {\n return data.map((frame) => {\n const s = attachFieldIndex(frame, sort);\n if (s.length && s[0].index != null) {\n return sortDataFrame(frame, s[0].index, s[0].desc);\n }\n return frame;\n });\n}\n\nfunction attachFieldIndex(frame: DataFrame, sort: SortByField[]): SortByField[] {\n return sort.map((s) => {\n if (s.index != null) {\n // null or undefined\n return s;\n }\n return {\n ...s,\n index: frame.fields.findIndex((f) => s.field === getFieldDisplayName(f, frame)),\n };\n });\n}\n","import { ScopedVars } from './ScopedVars';\nimport { QueryResultBase, Labels, NullValueMode } from './data';\nimport { DataLink, LinkModel } from './dataLink';\nimport { DisplayProcessor, DisplayValue } from './displayValue';\nimport { FieldColor } from './fieldColor';\nimport { ThresholdsConfig } from './thresholds';\nimport { ValueMapping } from './valueMapping';\nimport { Vector } from './vector';\n\n/** @public */\nexport enum FieldType {\n time = 'time', // or date\n number = 'number',\n string = 'string',\n boolean = 'boolean',\n // Used to detect that the value is some kind of trace data to help with the visualisation and processing.\n trace = 'trace',\n geo = 'geo',\n other = 'other', // Object, Array, etc\n}\n\n/**\n * @public\n * Every property is optional\n *\n * Plugins may extend this with additional properties. Something like series overrides\n */\nexport interface FieldConfig<TOptions = any> {\n /**\n * The display value for this field. This supports template variables blank is auto\n */\n displayName?: string;\n\n /**\n * This can be used by data sources that return and explicit naming structure for values and labels\n * When this property is configured, this value is used rather than the default naming strategy.\n */\n displayNameFromDS?: string;\n\n /**\n * Human readable field metadata\n */\n description?: string;\n\n /**\n * An explict path to the field in the datasource. When the frame meta includes a path,\n * This will default to `${frame.meta.path}/${field.name}\n *\n * When defined, this value can be used as an identifier within the datasource scope, and\n * may be used to update the results\n */\n path?: string;\n\n /**\n * True if data source can write a value to the path. Auth/authz are supported separately\n */\n writeable?: boolean;\n\n /**\n * True if data source field supports ad-hoc filters\n */\n filterable?: boolean;\n\n // Numeric Options\n unit?: string;\n decimals?: number | null; // Significant digits (for display)\n min?: number | null;\n max?: number | null;\n\n // Interval indicates the expected regular step between values in the series.\n // When an interval exists, consumers can identify \"missing\" values when the expected value is not present.\n // The grafana timeseries visualization will render disconnected values when missing values are found it the time field.\n // The interval uses the same units as the values. For time.Time, this is defined in milliseconds.\n interval?: number | null;\n\n // Convert input values into a display string\n mappings?: ValueMapping[];\n\n // Map numeric values to states\n thresholds?: ThresholdsConfig;\n\n // Map values to a display color\n color?: FieldColor;\n\n // Used when reducing field values\n nullValueMode?: NullValueMode;\n\n // The behavior when clicking on a result\n links?: DataLink[];\n\n // Alternative to empty string\n noValue?: string;\n\n // Panel Specific Values\n custom?: TOptions;\n}\n\n/** @public */\nexport interface ValueLinkConfig {\n /**\n * Result of field reduction\n */\n calculatedValue?: DisplayValue;\n /**\n * Index of the value row within Field. Should be provided only when value is not a result of a reduction\n */\n valueRowIndex?: number;\n}\n\nexport interface Field<T = any, V = Vector<T>> {\n /**\n * Name of the field (column)\n */\n name: string;\n /**\n * Field value type (string, number, etc)\n */\n type: FieldType;\n /**\n * Meta info about how field and how to display it\n */\n config: FieldConfig;\n values: V; // The raw field values\n labels?: Labels;\n\n /**\n * Cached values with appropriate display and id values\n */\n state?: FieldState | null;\n\n /**\n * Convert a value for display\n */\n display?: DisplayProcessor;\n\n /**\n * Get value data links with variables interpolated\n */\n getLinks?: (config: ValueLinkConfig) => Array<LinkModel<Field>>;\n}\n\n/** @alpha */\nexport interface FieldState {\n /**\n * An appropriate name for the field (does not include frame info)\n */\n displayName?: string | null;\n\n /**\n * Cache of reduced values\n */\n calcs?: FieldCalcs;\n\n /**\n * The numeric range for values in this field. This value will respect the min/max\n * set in field config, or when set to `auto` this will have the min/max for all data\n * in the response\n */\n range?: NumericRange;\n\n /**\n * Appropriate values for templating\n */\n scopedVars?: ScopedVars;\n\n /**\n * Series index is index for this field in a larger data set that can span multiple DataFrames\n * Useful for assigning color to series by looking up a color in a palette using this index\n */\n seriesIndex?: number;\n\n /**\n * Location of this field within the context frames results\n *\n * @internal -- we will try to make this unnecessary\n */\n origin?: DataFrameFieldIndex;\n\n /**\n * Boolean value is true if field is in a larger data set with multiple frames.\n * This is only related to the cached displayName property above.\n */\n multipleFrames?: boolean;\n\n /**\n * Boolean value is true if a null filling threshold has been applied\n * against the frame of the field. This is used to avoid cases in which\n * this would applied more than one time.\n */\n nullThresholdApplied?: boolean;\n}\n\n/** @public */\nexport interface NumericRange {\n min?: number | null;\n max?: number | null;\n delta: number;\n}\n\nexport interface DataFrame extends QueryResultBase {\n name?: string;\n fields: Field[]; // All fields of equal length\n\n // The number of rows\n length: number;\n}\n\n/**\n * @public\n * Like a field, but properties are optional and values may be a simple array\n */\nexport interface FieldDTO<T = any> {\n name: string; // The column name\n type?: FieldType;\n config?: FieldConfig;\n values?: Vector<T> | T[]; // toJSON will always be T[], input could be either\n labels?: Labels;\n}\n\n/**\n * @public\n * Like a DataFrame, but fields may be a FieldDTO\n */\nexport interface DataFrameDTO extends QueryResultBase {\n name?: string;\n fields: Array<FieldDTO | Field>;\n}\n\nexport interface FieldCalcs extends Record<string, any> {}\n\nexport const TIME_SERIES_VALUE_FIELD_NAME = 'Value';\nexport const TIME_SERIES_TIME_FIELD_NAME = 'Time';\nexport const TIME_SERIES_METRIC_FIELD_NAME = 'Metric';\n\n/**\n * Describes where a specific data frame field is located within a\n * dataset of type DataFrame[]\n *\n * @internal -- we will try to make this unnecessary\n */\nexport interface DataFrameFieldIndex {\n frameIndex: number;\n fieldIndex: number;\n}\n","/**\n * @public\n */\nexport enum FieldColorModeId {\n Thresholds = 'thresholds',\n PaletteClassic = 'palette-classic',\n PaletteSaturated = 'palette-saturated',\n ContinuousGrYlRd = 'continuous-GrYlRd',\n Fixed = 'fixed',\n}\n\n/**\n * @public\n */\nexport interface FieldColor {\n /** The main color scheme mode */\n mode: FieldColorModeId | string;\n /** Stores the fixed color value if mode is fixed */\n fixedColor?: string;\n /** Some visualizations need to know how to assign a series color from by value color schemes */\n seriesBy?: FieldColorSeriesByMode;\n}\n\n/**\n * @beta\n */\nexport type FieldColorSeriesByMode = 'min' | 'max' | 'last';\n\nexport const FALLBACK_COLOR = 'gray';\n","import { ThemeVisualizationColors } from '../themes';\n\nexport enum GrafanaThemeType {\n Light = 'light',\n Dark = 'dark',\n}\n\nexport interface GrafanaThemeCommons {\n name: string;\n // TODO: not sure if should be a part of theme\n breakpoints: {\n xs: string;\n sm: string;\n md: string;\n lg: string;\n xl: string;\n xxl: string;\n };\n typography: {\n fontFamily: {\n sansSerif: string;\n monospace: string;\n };\n size: {\n base: string;\n xs: string;\n sm: string;\n md: string;\n lg: string;\n };\n weight: {\n light: number;\n regular: number;\n semibold: number;\n bold: number;\n };\n lineHeight: {\n xs: number; //1\n sm: number; //1.1\n md: number; // 4/3\n lg: number; // 1.5\n };\n // TODO: Refactor to use size instead of custom defs\n heading: {\n h1: string;\n h2: string;\n h3: string;\n h4: string;\n h5: string;\n h6: string;\n };\n link: {\n decoration: string;\n hoverDecoration: string;\n };\n };\n spacing: {\n base: number;\n insetSquishMd: string;\n d: string;\n xxs: string;\n xs: string;\n sm: string;\n md: string;\n lg: string;\n xl: string;\n gutter: string;\n\n // Next-gen forms spacing variables\n // TODO: Move variables definition to respective components when implementing\n formSpacingBase: number;\n formMargin: string;\n formFieldsetMargin: string;\n formInputHeight: number;\n formButtonHeight: number;\n formInputPaddingHorizontal: string;\n // Used for icons do define spacing between icon and input field\n // Applied on the right(prefix) or left(suffix)\n formInputAffixPaddingHorizontal: string;\n formInputMargin: string;\n formLabelPadding: string;\n formLabelMargin: string;\n formValidationMessagePadding: string;\n formValidationMessageMargin: string;\n inlineFormMargin: string;\n };\n border: {\n radius: {\n sm: string;\n md: string;\n lg: string;\n };\n width: {\n sm: string;\n };\n };\n height: {\n sm: number;\n md: number;\n lg: number;\n };\n panelPadding: number;\n panelHeaderHeight: number;\n zIndex: {\n dropdown: number;\n navbarFixed: number;\n sidemenu: number;\n tooltip: number;\n modalBackdrop: number;\n modal: number;\n portal: number;\n typeahead: number;\n };\n}\n\nexport interface GrafanaTheme extends GrafanaThemeCommons {\n type: GrafanaThemeType;\n isDark: boolean;\n isLight: boolean;\n palette: {\n black: string;\n white: string;\n dark1: string;\n dark2: string;\n dark3: string;\n dark4: string;\n dark5: string;\n dark6: string;\n dark7: string;\n dark8: string;\n dark9: string;\n dark10: string;\n gray1: string;\n gray2: string;\n gray3: string;\n gray4: string;\n gray5: string;\n gray6: string;\n gray7: string;\n\n // New greys palette used by next-gen form elements\n gray98: string;\n gray97: string;\n gray95: string;\n gray90: string;\n gray85: string;\n gray70: string;\n gray60: string;\n gray33: string;\n gray25: string;\n gray15: string;\n gray10: string;\n gray05: string;\n\n // New blues palette used by next-gen form elements\n blue95: string;\n blue85: string;\n blue80: string;\n blue77: string;\n\n // New reds palette used by next-gen form elements\n red88: string;\n\n // Accent colors\n redBase: string;\n redShade: string;\n greenBase: string;\n greenShade: string;\n red: string;\n yellow: string;\n purple: string;\n orange: string;\n orangeDark: string;\n queryRed: string;\n queryGreen: string;\n queryPurple: string;\n queryOrange: string;\n brandPrimary: string;\n brandSuccess: string;\n brandWarning: string;\n brandDanger: string;\n\n // Status colors\n online: string;\n warn: string;\n critical: string;\n };\n colors: {\n bg1: string;\n bg2: string;\n bg3: string;\n border1: string;\n border2: string;\n border3: string;\n\n bgBlue1: string;\n bgBlue2: string;\n\n dashboardBg: string;\n bodyBg: string;\n panelBg: string;\n panelBorder: string;\n pageHeaderBg: string;\n pageHeaderBorder: string;\n\n dropdownBg: string;\n dropdownShadow: string;\n dropdownOptionHoverBg: string;\n\n // Link colors\n link: string;\n linkDisabled: string;\n linkHover: string;\n linkExternal: string;\n\n // Text colors\n textStrong: string;\n textHeading: string;\n text: string;\n textSemiWeak: string;\n textWeak: string;\n textFaint: string;\n textBlue: string;\n\n // Next-gen forms functional colors\n formLabel: string;\n formDescription: string;\n formInputBg: string;\n formInputBgDisabled: string;\n formInputBorder: string;\n formInputBorderHover: string;\n formInputBorderActive: string;\n formInputBorderInvalid: string;\n formFocusOutline: string;\n formInputText: string;\n formInputDisabledText: string;\n formInputPlaceholderText: string;\n formValidationMessageText: string;\n formValidationMessageBg: string;\n };\n shadows: {\n listItem: string;\n };\n visualization: ThemeVisualizationColors;\n}\n","export interface Threshold {\n value: number;\n color: string;\n /**\n * Warning, Error, LowLow, Low, OK, High, HighHigh etc\n */\n state?: string;\n}\n\n/**\n * Display mode\n */\nexport enum ThresholdsMode {\n Absolute = 'absolute',\n /**\n * between 0 and 1 (based on min/max)\n */\n Percentage = 'percentage',\n}\n\n/**\n * Config that is passed to the ThresholdsEditor\n */\nexport interface ThresholdsConfig {\n mode: ThresholdsMode;\n\n /**\n * Must be sorted by 'value', first value is always -Infinity\n */\n steps: Threshold[];\n}\n","/**\n * @alpha\n */\nexport enum MappingType {\n ValueToText = 'value', // was 1\n RangeToText = 'range', // was 2\n RegexToText = 'regex',\n SpecialValue = 'special',\n}\n\n/**\n * @alpha\n */\nexport interface ValueMappingResult {\n text?: string;\n color?: string;\n icon?: string;\n index?: number;\n}\n\n/**\n * @alpha\n */\ninterface BaseValueMap<T> {\n type: MappingType;\n options: T;\n}\n\n/**\n * @alpha\n */\nexport interface ValueMap extends BaseValueMap<Record<string, ValueMappingResult>> {\n type: MappingType.ValueToText;\n}\n\n/**\n * @alpha\n */\nexport interface RangeMapOptions {\n from: number | null; // changed from string\n to: number | null;\n result: ValueMappingResult;\n}\n\n/**\n * @alpha\n */\nexport interface RangeMap extends BaseValueMap<RangeMapOptions> {\n type: MappingType.RangeToText;\n}\n\n/**\n * @alpha\n */\nexport interface RegexMapOptions {\n pattern: string;\n result: ValueMappingResult;\n}\n\n/**\n * @alpha\n */\nexport interface RegexMap extends BaseValueMap<RegexMapOptions> {\n type: MappingType.RegexToText;\n}\n\n/**\n * @alpha\n */\nexport interface SpecialValueOptions {\n match: SpecialValueMatch;\n result: ValueMappingResult;\n}\n\n/**\n * @alpha\n */\nexport enum SpecialValueMatch {\n True = 'true',\n False = 'false',\n Null = 'null',\n NaN = 'nan',\n NullAndNaN = 'null+nan',\n Empty = 'empty',\n}\n\n/**\n * @alpha\n */\nexport interface SpecialValueMap extends BaseValueMap<SpecialValueOptions> {\n type: MappingType.SpecialValue;\n}\n\n/**\n * @alpha\n */\nexport type ValueMapping = ValueMap | RangeMap | RegexMap | SpecialValueMap;\n","import { PluginState } from '../types';\nimport { SelectableValue } from '../types/select';\n\nexport interface RegistryItem {\n id: string; // Unique Key -- saved in configs\n name: string; // Display Name, can change without breaking configs\n description?: string;\n aliasIds?: string[]; // when the ID changes, we may want backwards compatibility ('current' => 'last')\n\n /**\n * Some extensions should not be user selectable\n * like: 'all' and 'any' matchers;\n */\n excludeFromPicker?: boolean;\n\n /**\n * Optional feature state\n */\n state?: PluginState;\n}\n\nexport interface RegistryItemWithOptions<TOptions = any> extends RegistryItem {\n /**\n * Convert the options to a string\n */\n getOptionsDisplayText?: (options: TOptions) => string;\n\n /**\n * Default options used if nothing else is specified\n */\n defaultOptions?: TOptions;\n}\n\ninterface RegistrySelectInfo {\n options: Array<SelectableValue<string>>;\n current: Array<SelectableValue<string>>;\n}\n\nexport class Registry<T extends RegistryItem> {\n private ordered: T[] = [];\n private byId = new Map<string, T>();\n private initialized = false;\n\n constructor(private init?: () => T[]) {}\n\n setInit = (init: () => T[]) => {\n if (this.initialized) {\n throw new Error('Registry already initialized');\n }\n this.init = init;\n };\n\n getIfExists(id: string | undefined): T | undefined {\n if (!this.initialized) {\n this.initialize();\n }\n\n if (id) {\n return this.byId.get(id);\n }\n\n return undefined;\n }\n\n private initialize() {\n if (this.init) {\n for (const ext of this.init()) {\n this.register(ext);\n }\n }\n this.sort();\n this.initialized = true;\n }\n\n get(id: string): T {\n const v = this.getIfExists(id);\n if (!v) {\n throw new Error(`\"${id}\" not found in: ${this.list().map((v) => v.id)}`);\n }\n return v;\n }\n\n selectOptions(current?: string[], filter?: (ext: T) => boolean): RegistrySelectInfo {\n if (!this.initialized) {\n this.initialize();\n }\n\n const select = {\n options: [],\n current: [],\n } as RegistrySelectInfo;\n\n const currentOptions: Record<string, SelectableValue<string>> = {};\n if (current) {\n for (const id of current) {\n currentOptions[id] = {};\n }\n }\n\n for (const ext of this.ordered) {\n if (ext.excludeFromPicker) {\n continue;\n }\n if (filter && !filter(ext)) {\n continue;\n }\n\n const option = {\n value: ext.id,\n label: ext.name,\n description: ext.description,\n };\n\n if (ext.state === PluginState.alpha) {\n option.label += ' (alpha)';\n }\n\n select.options.push(option);\n if (currentOptions[ext.id]) {\n currentOptions[ext.id] = option;\n }\n }\n\n if (current) {\n // this makes sure we preserve the order of ids\n select.current = Object.values(currentOptions);\n }\n\n return select;\n }\n\n /**\n * Return a list of values by ID, or all values if not specified\n */\n list(ids?: any[]): T[] {\n if (!this.initialized) {\n this.initialize();\n }\n\n if (ids) {\n const found: T[] = [];\n for (const id of ids) {\n const v = this.getIfExists(id);\n if (v) {\n found.push(v);\n }\n }\n return found;\n }\n\n return this.ordered;\n }\n\n isEmpty(): boolean {\n if (!this.initialized) {\n this.initialize();\n }\n\n return this.ordered.length === 0;\n }\n\n register(ext: T) {\n if (this.byId.has(ext.id)) {\n throw new Error('Duplicate Key:' + ext.id);\n }\n\n this.byId.set(ext.id, ext);\n this.ordered.push(ext);\n\n if (ext.aliasIds) {\n for (const alias of ext.aliasIds) {\n if (!this.byId.has(alias)) {\n this.byId.set(alias, ext);\n }\n }\n }\n\n if (this.initialized) {\n this.sort();\n }\n }\n\n private sort() {\n // TODO sort the list\n }\n}\n","import { toNumber } from 'lodash';\n\n/**\n * Will return any value as a number or NaN\n *\n * @internal\n * */\nexport function anyToNumber(value: any): number {\n if (typeof value === 'number') {\n return value;\n }\n\n if (value === '' || value === null || value === undefined || Array.isArray(value)) {\n return NaN; // lodash calls them 0\n }\n\n if (typeof value === 'boolean') {\n return value ? 1 : 0;\n }\n\n return toNumber(value);\n}\n","import { RegistryItem, Registry } from './Registry';\n\nexport enum BinaryOperationID {\n Add = '+',\n Subtract = '-',\n Divide = '/',\n Multiply = '*',\n}\n\nexport type BinaryOperation = (left: number, right: number) => number;\n\ninterface BinaryOperatorInfo extends RegistryItem {\n operation: BinaryOperation;\n}\n\nexport const binaryOperators = new Registry<BinaryOperatorInfo>(() => {\n return [\n {\n id: BinaryOperationID.Add,\n name: 'Add',\n operation: (a: number, b: number) => a + b,\n },\n {\n id: BinaryOperationID.Subtract,\n name: 'Subtract',\n operation: (a: number, b: number) => a - b,\n },\n {\n id: BinaryOperationID.Multiply,\n name: 'Multiply',\n operation: (a: number, b: number) => a * b,\n },\n {\n id: BinaryOperationID.Divide,\n name: 'Divide',\n operation: (a: number, b: number) => a / b,\n },\n ];\n});\n","import { guessFieldTypeFromValue } from '../dataframe/processDataFrame';\nimport { Field, FieldType } from '../types/dataFrame';\n\nexport function makeFieldParser(value: any, field: Field): (value: string) => any {\n if (!field.type) {\n if (field.name === 'time' || field.name === 'Time') {\n field.type = FieldType.time;\n } else {\n field.type = guessFieldTypeFromValue(value);\n }\n }\n\n if (field.type === FieldType.number) {\n return (value: string) => {\n return parseFloat(value);\n };\n }\n\n // Will convert anything that starts with \"T\" to true\n if (field.type === FieldType.boolean) {\n return (value: string) => {\n return !(value[0] === 'F' || value[0] === 'f' || value[0] === '0');\n };\n }\n\n // Just pass the string back\n return (value: string) => value;\n}\n","/**\n * @beta\n * Proxies a ES6 class so that it can be used as a base class for an ES5 class\n */\nexport function makeClassES5Compatible<T>(ES6Class: T): T {\n return new Proxy(ES6Class as any, {\n // ES5 code will call it like a function using super\n apply(target, self, argumentsList) {\n if (typeof Reflect === 'undefined' || !Reflect.construct) {\n alert('Browser is too old');\n }\n\n return Reflect.construct(target, argumentsList, self.constructor);\n },\n }) as unknown as T;\n}\n","import { DecimalCount } from '../types/displayValue';\n\nimport { toFixed, FormattedValue } from './valueFormats';\n\nexport function toPercent(size: number, decimals: DecimalCount): FormattedValue {\n if (size === null) {\n return { text: '' };\n }\n return { text: toFixed(size, decimals), suffix: '%' };\n}\n\nexport function toPercentUnit(size: number, decimals: DecimalCount): FormattedValue {\n if (size === null) {\n return { text: '' };\n }\n return { text: toFixed(100 * size, decimals), suffix: '%' };\n}\n\nexport function toHex0x(value: number, decimals: DecimalCount): FormattedValue {\n if (value == null) {\n return { text: '' };\n }\n const asHex = toHex(value, decimals);\n if (asHex.text.substring(0, 1) === '-') {\n asHex.text = '-0x' + asHex.text.substring(1);\n } else {\n asHex.text = '0x' + asHex.text;\n }\n return asHex;\n}\n\nexport function toHex(value: number, decimals: DecimalCount): FormattedValue {\n if (value == null) {\n return { text: '' };\n }\n return {\n text: parseFloat(toFixed(value, decimals)).toString(16).toUpperCase(),\n };\n}\n\nexport function sci(value: number, decimals: DecimalCount): FormattedValue {\n if (value == null) {\n return { text: '' };\n }\n return { text: value.toExponential(decimals as number) };\n}\n","import { toHex, sci, toHex0x, toPercent, toPercentUnit } from './arithmeticFormatters';\nimport {\n dateTimeAsIso,\n dateTimeAsIsoNoDateIfToday,\n dateTimeAsUS,\n dateTimeAsUSNoDateIfToday,\n getDateTimeAsLocalFormat,\n getDateTimeAsLocalFormatNoDateIfToday,\n dateTimeFromNow,\n toClockMilliseconds,\n toClockSeconds,\n toDays,\n toDurationInDaysHoursMinutesSeconds,\n toDurationInHoursMinutesSeconds,\n toDurationInMilliseconds,\n toDurationInSeconds,\n toHours,\n toMicroSeconds,\n toMilliSeconds,\n toMinutes,\n toNanoSeconds,\n toSeconds,\n toTimeTicks,\n dateTimeSystemFormatter,\n} from './dateTimeFormatters';\nimport { binaryPrefix, currency, SIPrefix } from './symbolFormatters';\nimport {\n locale,\n scaledUnits,\n simpleCountUnit,\n toFixedUnit,\n ValueFormatCategory,\n stringFormater,\n booleanValueFormatter,\n} from './valueFormats';\n\nexport const getCategories = (): ValueFormatCategory[] => [\n {\n name: 'Misc',\n formats: [\n { name: 'Number', id: 'none', fn: toFixedUnit('') },\n { name: 'String', id: 'string', fn: stringFormater },\n {\n name: 'short',\n id: 'short',\n fn: scaledUnits(1000, ['', ' K', ' Mil', ' Bil', ' Tri', ' Quadr', ' Quint', ' Sext', ' Sept']),\n },\n { name: 'Percent (0-100)', id: 'percent', fn: toPercent },\n { name: 'Percent (0.0-1.0)', id: 'percentunit', fn: toPercentUnit },\n { name: 'Humidity (%H)', id: 'humidity', fn: toFixedUnit('%H') },\n { name: 'Decibel', id: 'dB', fn: toFixedUnit('dB') },\n { name: 'Hexadecimal (0x)', id: 'hex0x', fn: toHex0x },\n { name: 'Hexadecimal', id: 'hex', fn: toHex },\n { name: 'Scientific notation', id: 'sci', fn: sci },\n { name: 'Locale format', id: 'locale', fn: locale },\n { name: 'Pixels', id: 'pixel', fn: toFixedUnit('px') },\n ],\n },\n {\n name: 'Acceleration',\n formats: [\n { name: 'Meters/sec²', id: 'accMS2', fn: toFixedUnit('m/sec²') },\n { name: 'Feet/sec²', id: 'accFS2', fn: toFixedUnit('f/sec²') },\n { name: 'G unit', id: 'accG', fn: toFixedUnit('g') },\n ],\n },\n {\n name: 'Angle',\n formats: [\n { name: 'Degrees (°)', id: 'degree', fn: toFixedUnit('°') },\n { name: 'Radians', id: 'radian', fn: toFixedUnit('rad') },\n { name: 'Gradian', id: 'grad', fn: toFixedUnit('grad') },\n { name: 'Arc Minutes', id: 'arcmin', fn: toFixedUnit('arcmin') },\n { name: 'Arc Seconds', id: 'arcsec', fn: toFixedUnit('arcsec') },\n ],\n },\n {\n name: 'Area',\n formats: [\n { name: 'Square Meters (m²)', id: 'areaM2', fn: toFixedUnit('m²') },\n { name: 'Square Feet (ft²)', id: 'areaF2', fn: toFixedUnit('ft²') },\n { name: 'Square Miles (mi²)', id: 'areaMI2', fn: toFixedUnit('mi²') },\n ],\n },\n {\n name: 'Computation',\n formats: [\n { name: 'FLOP/s', id: 'flops', fn: SIPrefix('FLOPS') },\n { name: 'MFLOP/s', id: 'mflops', fn: SIPrefix('FLOPS', 2) },\n { name: 'GFLOP/s', id: 'gflops', fn: SIPrefix('FLOPS', 3) },\n { name: 'TFLOP/s', id: 'tflops', fn: SIPrefix('FLOPS', 4) },\n { name: 'PFLOP/s', id: 'pflops', fn: SIPrefix('FLOPS', 5) },\n { name: 'EFLOP/s', id: 'eflops', fn: SIPrefix('FLOPS', 6) },\n { name: 'ZFLOP/s', id: 'zflops', fn: SIPrefix('FLOPS', 7) },\n { name: 'YFLOP/s', id: 'yflops', fn: SIPrefix('FLOPS', 8) },\n ],\n },\n {\n name: 'Concentration',\n formats: [\n { name: 'parts-per-million (ppm)', id: 'ppm', fn: toFixedUnit('ppm') },\n { name: 'parts-per-billion (ppb)', id: 'conppb', fn: toFixedUnit('ppb') },\n { name: 'nanogram per cubic meter (ng/m³)', id: 'conngm3', fn: toFixedUnit('ng/m³') },\n { name: 'nanogram per normal cubic meter (ng/Nm³)', id: 'conngNm3', fn: toFixedUnit('ng/Nm³') },\n { name: 'microgram per cubic meter (μg/m³)', id: 'conμgm3', fn: toFixedUnit('μg/m³') },\n { name: 'microgram per normal cubic meter (μg/Nm³)', id: 'conμgNm3', fn: toFixedUnit('μg/Nm³') },\n { name: 'milligram per cubic meter (mg/m³)', id: 'conmgm3', fn: toFixedUnit('mg/m³') },\n { name: 'milligram per normal cubic meter (mg/Nm³)', id: 'conmgNm3', fn: toFixedUnit('mg/Nm³') },\n { name: 'gram per cubic meter (g/m³)', id: 'congm3', fn: toFixedUnit('g/m³') },\n { name: 'gram per normal cubic meter (g/Nm³)', id: 'congNm3', fn: toFixedUnit('g/Nm³') },\n { name: 'milligrams per decilitre (mg/dL)', id: 'conmgdL', fn: toFixedUnit('mg/dL') },\n { name: 'millimoles per litre (mmol/L)', id: 'conmmolL', fn: toFixedUnit('mmol/L') },\n ],\n },\n {\n name: 'Currency',\n formats: [\n { name: 'Dollars ($)', id: 'currencyUSD', fn: currency('$') },\n { name: 'Pounds (£)', id: 'currencyGBP', fn: currency('£') },\n { name: 'Euro (€)', id: 'currencyEUR', fn: currency('€') },\n { name: 'Yen (¥)', id: 'currencyJPY', fn: currency('¥') },\n { name: 'Rubles (₽)', id: 'currencyRUB', fn: currency('₽') },\n { name: 'Hryvnias (₴)', id: 'currencyUAH', fn: currency('₴') },\n { name: 'Real (R$)', id: 'currencyBRL', fn: currency('R$') },\n { name: 'Danish Krone (kr)', id: 'currencyDKK', fn: currency('kr', true) },\n { name: 'Icelandic Króna (kr)', id: 'currencyISK', fn: currency('kr', true) },\n { name: 'Norwegian Krone (kr)', id: 'currencyNOK', fn: currency('kr', true) },\n { name: 'Swedish Krona (kr)', id: 'currencySEK', fn: currency('kr', true) },\n { name: 'Czech koruna (czk)', id: 'currencyCZK', fn: currency('czk') },\n { name: 'Swiss franc (CHF)', id: 'currencyCHF', fn: currency('CHF') },\n { name: 'Polish Złoty (PLN)', id: 'currencyPLN', fn: currency('PLN') },\n { name: 'Bitcoin (฿)', id: 'currencyBTC', fn: currency('฿') },\n { name: 'Milli Bitcoin (฿)', id: 'currencymBTC', fn: currency('mBTC') },\n { name: 'Micro Bitcoin (฿)', id: 'currencyμBTC', fn: currency('μBTC') },\n { name: 'South African Rand (R)', id: 'currencyZAR', fn: currency('R') },\n { name: 'Indian Rupee (₹)', id: 'currencyINR', fn: currency('₹') },\n { name: 'South Korean Won (₩)', id: 'currencyKRW', fn: currency('₩') },\n { name: 'Indonesian Rupiah (Rp)', id: 'currencyIDR', fn: currency('Rp') },\n { name: 'Philippine Peso (PHP)', id: 'currencyPHP', fn: currency('PHP') },\n { name: 'Vietnamese Dong (VND)', id: 'currencyVND', fn: currency('đ', true) },\n ],\n },\n {\n name: 'Data',\n formats: [\n { name: 'bytes(IEC)', id: 'bytes', fn: binaryPrefix('B') },\n { name: 'bytes(SI)', id: 'decbytes', fn: SIPrefix('B') },\n { name: 'bits(IEC)', id: 'bits', fn: binaryPrefix('b') },\n { name: 'bits(SI)', id: 'decbits', fn: SIPrefix('b') },\n { name: 'kibibytes', id: 'kbytes', fn: binaryPrefix('B', 1) },\n { name: 'kilobytes', id: 'deckbytes', fn: SIPrefix('B', 1) },\n { name: 'mebibytes', id: 'mbytes', fn: binaryPrefix('B', 2) },\n { name: 'megabytes', id: 'decmbytes', fn: SIPrefix('B', 2) },\n { name: 'gibibytes', id: 'gbytes', fn: binaryPrefix('B', 3) },\n { name: 'gigabytes', id: 'decgbytes', fn: SIPrefix('B', 3) },\n { name: 'tebibytes', id: 'tbytes', fn: binaryPrefix('B', 4) },\n { name: 'terabytes', id: 'dectbytes', fn: SIPrefix('B', 4) },\n { name: 'pebibytes', id: 'pbytes', fn: binaryPrefix('B', 5) },\n { name: 'petabytes', id: 'decpbytes', fn: SIPrefix('B', 5) },\n ],\n },\n {\n name: 'Data rate',\n formats: [\n { name: 'packets/sec', id: 'pps', fn: SIPrefix('p/s') },\n { name: 'bytes/sec(IEC)', id: 'binBps', fn: binaryPrefix('B/s') },\n { name: 'bytes/sec(SI)', id: 'Bps', fn: SIPrefix('B/s') },\n { name: 'bits/sec(IEC)', id: 'binbps', fn: binaryPrefix('b/s') },\n { name: 'bits/sec(SI)', id: 'bps', fn: SIPrefix('b/s') },\n { name: 'kibibytes/sec', id: 'KiBs', fn: binaryPrefix('B/s', 1) },\n { name: 'kibibits/sec', id: 'Kibits', fn: binaryPrefix('b/s', 1) },\n { name: 'kilobytes/sec', id: 'KBs', fn: SIPrefix('B/s', 1) },\n { name: 'kilobits/sec', id: 'Kbits', fn: SIPrefix('b/s', 1) },\n { name: 'mebibytes/sec', id: 'MiBs', fn: binaryPrefix('B/s', 2) },\n { name: 'mebibits/sec', id: 'Mibits', fn: binaryPrefix('b/s', 2) },\n { name: 'megabytes/sec', id: 'MBs', fn: SIPrefix('B/s', 2) },\n { name: 'megabits/sec', id: 'Mbits', fn: SIPrefix('b/s', 2) },\n { name: 'gibibytes/sec', id: 'GiBs', fn: binaryPrefix('B/s', 3) },\n { name: 'gibibits/sec', id: 'Gibits', fn: binaryPrefix('b/s', 3) },\n { name: 'gigabytes/sec', id: 'GBs', fn: SIPrefix('B/s', 3) },\n { name: 'gigabits/sec', id: 'Gbits', fn: SIPrefix('b/s', 3) },\n { name: 'tebibytes/sec', id: 'TiBs', fn: binaryPrefix('B/s', 4) },\n { name: 'tebibits/sec', id: 'Tibits', fn: binaryPrefix('b/s', 4) },\n { name: 'terabytes/sec', id: 'TBs', fn: SIPrefix('B/s', 4) },\n { name: 'terabits/sec', id: 'Tbits', fn: SIPrefix('b/s', 4) },\n { name: 'pebibytes/sec', id: 'PiBs', fn: binaryPrefix('B/s', 5) },\n { name: 'pebibits/sec', id: 'Pibits', fn: binaryPrefix('b/s', 5) },\n { name: 'petabytes/sec', id: 'PBs', fn: SIPrefix('B/s', 5) },\n { name: 'petabits/sec', id: 'Pbits', fn: SIPrefix('b/s', 5) },\n ],\n },\n {\n name: 'Date & time',\n formats: [\n { name: 'Datetime ISO', id: 'dateTimeAsIso', fn: dateTimeAsIso },\n { name: 'Datetime ISO (No date if today)', id: 'dateTimeAsIsoNoDateIfToday', fn: dateTimeAsIsoNoDateIfToday },\n { name: 'Datetime US', id: 'dateTimeAsUS', fn: dateTimeAsUS },\n { name: 'Datetime US (No date if today)', id: 'dateTimeAsUSNoDateIfToday', fn: dateTimeAsUSNoDateIfToday },\n { name: 'Datetime local', id: 'dateTimeAsLocal', fn: getDateTimeAsLocalFormat() },\n {\n name: 'Datetime local (No date if today)',\n id: 'dateTimeAsLocalNoDateIfToday',\n fn: getDateTimeAsLocalFormatNoDateIfToday(),\n },\n { name: 'Datetime default', id: 'dateTimeAsSystem', fn: dateTimeSystemFormatter },\n { name: 'From Now', id: 'dateTimeFromNow', fn: dateTimeFromNow },\n ],\n },\n {\n name: 'Energy',\n formats: [\n { name: 'Watt (W)', id: 'watt', fn: SIPrefix('W') },\n { name: 'Kilowatt (kW)', id: 'kwatt', fn: SIPrefix('W', 1) },\n { name: 'Megawatt (MW)', id: 'megwatt', fn: SIPrefix('W', 2) },\n { name: 'Gigawatt (GW)', id: 'gwatt', fn: SIPrefix('W', 3) },\n { name: 'Milliwatt (mW)', id: 'mwatt', fn: SIPrefix('W', -1) },\n { name: 'Watt per square meter (W/m²)', id: 'Wm2', fn: toFixedUnit('W/m²') },\n { name: 'Volt-Ampere (VA)', id: 'voltamp', fn: SIPrefix('VA') },\n { name: 'Kilovolt-Ampere (kVA)', id: 'kvoltamp', fn: SIPrefix('VA', 1) },\n { name: 'Volt-Ampere reactive (VAr)', id: 'voltampreact', fn: SIPrefix('VAr') },\n { name: 'Kilovolt-Ampere reactive (kVAr)', id: 'kvoltampreact', fn: SIPrefix('VAr', 1) },\n { name: 'Watt-hour (Wh)', id: 'watth', fn: SIPrefix('Wh') },\n { name: 'Watt-hour per Kilogram (Wh/kg)', id: 'watthperkg', fn: SIPrefix('Wh/kg') },\n { name: 'Kilowatt-hour (kWh)', id: 'kwatth', fn: SIPrefix('Wh', 1) },\n { name: 'Kilowatt-min (kWm)', id: 'kwattm', fn: SIPrefix('W-Min', 1) },\n { name: 'Ampere-hour (Ah)', id: 'amph', fn: SIPrefix('Ah') },\n { name: 'Kiloampere-hour (kAh)', id: 'kamph', fn: SIPrefix('Ah', 1) },\n { name: 'Milliampere-hour (mAh)', id: 'mamph', fn: SIPrefix('Ah', -1) },\n { name: 'Joule (J)', id: 'joule', fn: SIPrefix('J') },\n { name: 'Electron volt (eV)', id: 'ev', fn: SIPrefix('eV') },\n { name: 'Ampere (A)', id: 'amp', fn: SIPrefix('A') },\n { name: 'Kiloampere (kA)', id: 'kamp', fn: SIPrefix('A', 1) },\n { name: 'Milliampere (mA)', id: 'mamp', fn: SIPrefix('A', -1) },\n { name: 'Volt (V)', id: 'volt', fn: SIPrefix('V') },\n { name: 'Kilovolt (kV)', id: 'kvolt', fn: SIPrefix('V', 1) },\n { name: 'Millivolt (mV)', id: 'mvolt', fn: SIPrefix('V', -1) },\n { name: 'Decibel-milliwatt (dBm)', id: 'dBm', fn: SIPrefix('dBm') },\n { name: 'Ohm (Ω)', id: 'ohm', fn: SIPrefix('Ω') },\n { name: 'Kiloohm (kΩ)', id: 'kohm', fn: SIPrefix('Ω', 1) },\n { name: 'Megaohm (MΩ)', id: 'Mohm', fn: SIPrefix('Ω', 2) },\n { name: 'Farad (F)', id: 'farad', fn: SIPrefix('F') },\n { name: 'Microfarad (µF)', id: 'µfarad', fn: SIPrefix('F', -2) },\n { name: 'Nanofarad (nF)', id: 'nfarad', fn: SIPrefix('F', -3) },\n { name: 'Picofarad (pF)', id: 'pfarad', fn: SIPrefix('F', -4) },\n { name: 'Femtofarad (fF)', id: 'ffarad', fn: SIPrefix('F', -5) },\n { name: 'Henry (H)', id: 'henry', fn: SIPrefix('H') },\n { name: 'Millihenry (mH)', id: 'mhenry', fn: SIPrefix('H', -1) },\n { name: 'Microhenry (µH)', id: 'µhenry', fn: SIPrefix('H', -2) },\n { name: 'Lumens (Lm)', id: 'lumens', fn: SIPrefix('Lm') },\n ],\n },\n {\n name: 'Flow',\n formats: [\n { name: 'Gallons/min (gpm)', id: 'flowgpm', fn: toFixedUnit('gpm') },\n { name: 'Cubic meters/sec (cms)', id: 'flowcms', fn: toFixedUnit('cms') },\n { name: 'Cubic feet/sec (cfs)', id: 'flowcfs', fn: toFixedUnit('cfs') },\n { name: 'Cubic feet/min (cfm)', id: 'flowcfm', fn: toFixedUnit('cfm') },\n { name: 'Litre/hour', id: 'litreh', fn: toFixedUnit('L/h') },\n { name: 'Litre/min (L/min)', id: 'flowlpm', fn: toFixedUnit('L/min') },\n { name: 'milliLitre/min (mL/min)', id: 'flowmlpm', fn: toFixedUnit('mL/min') },\n { name: 'Lux (lx)', id: 'lux', fn: toFixedUnit('lux') },\n ],\n },\n {\n name: 'Force',\n formats: [\n { name: 'Newton-meters (Nm)', id: 'forceNm', fn: SIPrefix('Nm') },\n { name: 'Kilonewton-meters (kNm)', id: 'forcekNm', fn: SIPrefix('Nm', 1) },\n { name: 'Newtons (N)', id: 'forceN', fn: SIPrefix('N') },\n { name: 'Kilonewtons (kN)', id: 'forcekN', fn: SIPrefix('N', 1) },\n ],\n },\n {\n name: 'Hash rate',\n formats: [\n { name: 'hashes/sec', id: 'Hs', fn: SIPrefix('H/s') },\n { name: 'kilohashes/sec', id: 'KHs', fn: SIPrefix('H/s', 1) },\n { name: 'megahashes/sec', id: 'MHs', fn: SIPrefix('H/s', 2) },\n { name: 'gigahashes/sec', id: 'GHs', fn: SIPrefix('H/s', 3) },\n { name: 'terahashes/sec', id: 'THs', fn: SIPrefix('H/s', 4) },\n { name: 'petahashes/sec', id: 'PHs', fn: SIPrefix('H/s', 5) },\n { name: 'exahashes/sec', id: 'EHs', fn: SIPrefix('H/s', 6) },\n ],\n },\n {\n name: 'Mass',\n formats: [\n { name: 'milligram (mg)', id: 'massmg', fn: SIPrefix('g', -1) },\n { name: 'gram (g)', id: 'massg', fn: SIPrefix('g') },\n { name: 'pound (lb)', id: 'masslb', fn: toFixedUnit('lb') },\n { name: 'kilogram (kg)', id: 'masskg', fn: SIPrefix('g', 1) },\n { name: 'metric ton (t)', id: 'masst', fn: toFixedUnit('t') },\n ],\n },\n {\n name: 'Length',\n formats: [\n { name: 'millimeter (mm)', id: 'lengthmm', fn: SIPrefix('m', -1) },\n { name: 'inch (in)', id: 'lengthin', fn: toFixedUnit('in') },\n { name: 'feet (ft)', id: 'lengthft', fn: toFixedUnit('ft') },\n { name: 'meter (m)', id: 'lengthm', fn: SIPrefix('m') },\n { name: 'kilometer (km)', id: 'lengthkm', fn: SIPrefix('m', 1) },\n { name: 'mile (mi)', id: 'lengthmi', fn: toFixedUnit('mi') },\n ],\n },\n {\n name: 'Pressure',\n formats: [\n { name: 'Millibars', id: 'pressurembar', fn: SIPrefix('bar', -1) },\n { name: 'Bars', id: 'pressurebar', fn: SIPrefix('bar') },\n { name: 'Kilobars', id: 'pressurekbar', fn: SIPrefix('bar', 1) },\n { name: 'Pascals', id: 'pressurepa', fn: SIPrefix('Pa') },\n { name: 'Hectopascals', id: 'pressurehpa', fn: toFixedUnit('hPa') },\n { name: 'Kilopascals', id: 'pressurekpa', fn: toFixedUnit('kPa') },\n { name: 'Inches of mercury', id: 'pressurehg', fn: toFixedUnit('\"Hg') },\n { name: 'PSI', id: 'pressurepsi', fn: scaledUnits(1000, ['psi', 'ksi', 'Mpsi']) },\n ],\n },\n {\n name: 'Radiation',\n formats: [\n { name: 'Becquerel (Bq)', id: 'radbq', fn: SIPrefix('Bq') },\n { name: 'curie (Ci)', id: 'radci', fn: SIPrefix('Ci') },\n { name: 'Gray (Gy)', id: 'radgy', fn: SIPrefix('Gy') },\n { name: 'rad', id: 'radrad', fn: SIPrefix('rad') },\n { name: 'Sievert (Sv)', id: 'radsv', fn: SIPrefix('Sv') },\n { name: 'milliSievert (mSv)', id: 'radmsv', fn: SIPrefix('Sv', -1) },\n { name: 'microSievert (µSv)', id: 'radusv', fn: SIPrefix('Sv', -2) },\n { name: 'rem', id: 'radrem', fn: SIPrefix('rem') },\n { name: 'Exposure (C/kg)', id: 'radexpckg', fn: SIPrefix('C/kg') },\n { name: 'roentgen (R)', id: 'radr', fn: SIPrefix('R') },\n { name: 'Sievert/hour (Sv/h)', id: 'radsvh', fn: SIPrefix('Sv/h') },\n { name: 'milliSievert/hour (mSv/h)', id: 'radmsvh', fn: SIPrefix('Sv/h', -1) },\n { name: 'microSievert/hour (µSv/h)', id: 'radusvh', fn: SIPrefix('Sv/h', -2) },\n ],\n },\n {\n name: 'Rotational Speed',\n formats: [\n { name: 'Revolutions per minute (rpm)', id: 'rotrpm', fn: toFixedUnit('rpm') },\n { name: 'Hertz (Hz)', id: 'rothz', fn: SIPrefix('Hz') },\n { name: 'Radians per second (rad/s)', id: 'rotrads', fn: toFixedUnit('rad/s') },\n { name: 'Degrees per second (°/s)', id: 'rotdegs', fn: toFixedUnit('°/s') },\n ],\n },\n {\n name: 'Temperature',\n formats: [\n { name: 'Celsius (°C)', id: 'celsius', fn: toFixedUnit('°C') },\n { name: 'Fahrenheit (°F)', id: 'fahrenheit', fn: toFixedUnit('°F') },\n { name: 'Kelvin (K)', id: 'kelvin', fn: toFixedUnit('K') },\n ],\n },\n {\n name: 'Time',\n formats: [\n { name: 'Hertz (1/s)', id: 'hertz', fn: SIPrefix('Hz') },\n { name: 'nanoseconds (ns)', id: 'ns', fn: toNanoSeconds },\n { name: 'microseconds (µs)', id: 'µs', fn: toMicroSeconds },\n { name: 'milliseconds (ms)', id: 'ms', fn: toMilliSeconds },\n { name: 'seconds (s)', id: 's', fn: toSeconds },\n { name: 'minutes (m)', id: 'm', fn: toMinutes },\n { name: 'hours (h)', id: 'h', fn: toHours },\n { name: 'days (d)', id: 'd', fn: toDays },\n { name: 'duration (ms)', id: 'dtdurationms', fn: toDurationInMilliseconds },\n { name: 'duration (s)', id: 'dtdurations', fn: toDurationInSeconds },\n { name: 'duration (hh:mm:ss)', id: 'dthms', fn: toDurationInHoursMinutesSeconds },\n { name: 'duration (d hh:mm:ss)', id: 'dtdhms', fn: toDurationInDaysHoursMinutesSeconds },\n { name: 'Timeticks (s/100)', id: 'timeticks', fn: toTimeTicks },\n { name: 'clock (ms)', id: 'clockms', fn: toClockMilliseconds },\n { name: 'clock (s)', id: 'clocks', fn: toClockSeconds },\n ],\n },\n {\n name: 'Throughput',\n formats: [\n { name: 'counts/sec (cps)', id: 'cps', fn: simpleCountUnit('c/s') },\n { name: 'ops/sec (ops)', id: 'ops', fn: simpleCountUnit('ops/s') },\n { name: 'requests/sec (rps)', id: 'reqps', fn: simpleCountUnit('req/s') },\n { name: 'reads/sec (rps)', id: 'rps', fn: simpleCountUnit('rd/s') },\n { name: 'writes/sec (wps)', id: 'wps', fn: simpleCountUnit('wr/s') },\n { name: 'I/O ops/sec (iops)', id: 'iops', fn: simpleCountUnit('io/s') },\n { name: 'counts/min (cpm)', id: 'cpm', fn: simpleCountUnit('c/m') },\n { name: 'ops/min (opm)', id: 'opm', fn: simpleCountUnit('ops/m') },\n { name: 'reads/min (rpm)', id: 'rpm', fn: simpleCountUnit('rd/m') },\n { name: 'writes/min (wpm)', id: 'wpm', fn: simpleCountUnit('wr/m') },\n ],\n },\n {\n name: 'Velocity',\n formats: [\n { name: 'meters/second (m/s)', id: 'velocityms', fn: toFixedUnit('m/s') },\n { name: 'kilometers/hour (km/h)', id: 'velocitykmh', fn: toFixedUnit('km/h') },\n { name: 'miles/hour (mph)', id: 'velocitymph', fn: toFixedUnit('mph') },\n { name: 'knot (kn)', id: 'velocityknot', fn: toFixedUnit('kn') },\n ],\n },\n {\n name: 'Volume',\n formats: [\n { name: 'millilitre (mL)', id: 'mlitre', fn: SIPrefix('L', -1) },\n { name: 'litre (L)', id: 'litre', fn: SIPrefix('L') },\n { name: 'cubic meter', id: 'm3', fn: toFixedUnit('m³') },\n { name: 'Normal cubic meter', id: 'Nm3', fn: toFixedUnit('Nm³') },\n { name: 'cubic decimeter', id: 'dm3', fn: toFixedUnit('dm³') },\n { name: 'gallons', id: 'gallons', fn: toFixedUnit('gal') },\n ],\n },\n {\n name: 'Boolean',\n formats: [\n { name: 'True / False', id: 'bool', fn: booleanValueFormatter('True', 'False') },\n { name: 'Yes / No', id: 'bool_yes_no', fn: booleanValueFormatter('Yes', 'No') },\n { name: 'On / Off', id: 'bool_on_off', fn: booleanValueFormatter('On', 'Off') },\n ],\n },\n];\n","import { dateTimeFormat, dateTimeFormatTimeAgo, localTimeFormat, systemDateFormats } from '../datetime';\nimport { toDuration as duration, toUtc, dateTime } from '../datetime/moment_wrapper';\nimport { TimeZone } from '../types';\nimport { DecimalCount } from '../types/displayValue';\n\nimport { toFixed, toFixedScaled, FormattedValue, ValueFormatter } from './valueFormats';\n\ninterface IntervalsInSeconds {\n [interval: string]: number;\n}\n\nexport enum Interval {\n Year = 'year',\n Month = 'month',\n Week = 'week',\n Day = 'day',\n Hour = 'hour',\n Minute = 'minute',\n Second = 'second',\n Millisecond = 'millisecond',\n}\n\nconst UNITS = [\n Interval.Year,\n Interval.Month,\n Interval.Week,\n Interval.Day,\n Interval.Hour,\n Interval.Minute,\n Interval.Second,\n Interval.Millisecond,\n];\n\nconst INTERVALS_IN_SECONDS: IntervalsInSeconds = {\n [Interval.Year]: 31536000,\n [Interval.Month]: 2592000,\n [Interval.Week]: 604800,\n [Interval.Day]: 86400,\n [Interval.Hour]: 3600,\n [Interval.Minute]: 60,\n [Interval.Second]: 1,\n [Interval.Millisecond]: 0.001,\n};\n\nexport function toNanoSeconds(size: number, decimals?: DecimalCount): FormattedValue {\n if (size === null) {\n return { text: '' };\n }\n\n if (Math.abs(size) < 1000) {\n return { text: toFixed(size, decimals), suffix: ' ns' };\n } else if (Math.abs(size) < 1000000) {\n return toFixedScaled(size / 1000, decimals, ' µs');\n } else if (Math.abs(size) < 1000000000) {\n return toFixedScaled(size / 1000000, decimals, ' ms');\n } else if (Math.abs(size) < 60000000000) {\n return toFixedScaled(size / 1000000000, decimals, ' s');\n } else if (Math.abs(size) < 3600000000000) {\n return toFixedScaled(size / 60000000000, decimals, ' min');\n } else if (Math.abs(size) < 86400000000000) {\n return toFixedScaled(size / 3600000000000, decimals, ' hour');\n } else {\n return toFixedScaled(size / 86400000000000, decimals, ' day');\n }\n}\n\nexport function toMicroSeconds(size: number, decimals?: DecimalCount): FormattedValue {\n if (size === null) {\n return { text: '' };\n }\n\n if (Math.abs(size) < 1000) {\n return { text: toFixed(size, decimals), suffix: ' µs' };\n } else if (Math.abs(size) < 1000000) {\n return toFixedScaled(size / 1000, decimals, ' ms');\n } else {\n return toFixedScaled(size / 1000000, decimals, ' s');\n }\n}\n\nexport function toMilliSeconds(size: number, decimals?: DecimalCount, scaledDecimals?: DecimalCount): FormattedValue {\n if (size === null) {\n return { text: '' };\n }\n\n if (Math.abs(size) < 1000) {\n return { text: toFixed(size, decimals), suffix: ' ms' };\n } else if (Math.abs(size) < 60000) {\n // Less than 1 min\n return toFixedScaled(size / 1000, decimals, ' s');\n } else if (Math.abs(size) < 3600000) {\n // Less than 1 hour, divide in minutes\n return toFixedScaled(size / 60000, decimals, ' min');\n } else if (Math.abs(size) < 86400000) {\n // Less than one day, divide in hours\n return toFixedScaled(size / 3600000, decimals, ' hour');\n } else if (Math.abs(size) < 31536000000) {\n // Less than one year, divide in days\n return toFixedScaled(size / 86400000, decimals, ' day');\n }\n\n return toFixedScaled(size / 31536000000, decimals, ' year');\n}\n\nexport function trySubstract(value1: DecimalCount, value2: DecimalCount): DecimalCount {\n if (value1 !== null && value1 !== undefined && value2 !== null && value2 !== undefined) {\n return value1 - value2;\n }\n return undefined;\n}\n\nexport function toSeconds(size: number, decimals?: DecimalCount): FormattedValue {\n if (size === null) {\n return { text: '' };\n }\n\n // If 0, use s unit instead of ns\n if (size === 0) {\n return { text: '0', suffix: ' s' };\n }\n\n // Less than 1 µs, divide in ns\n if (Math.abs(size) < 0.000001) {\n return toFixedScaled(size * 1e9, decimals, ' ns');\n }\n // Less than 1 ms, divide in µs\n if (Math.abs(size) < 0.001) {\n return toFixedScaled(size * 1e6, decimals, ' µs');\n }\n // Less than 1 second, divide in ms\n if (Math.abs(size) < 1) {\n return toFixedScaled(size * 1e3, decimals, ' ms');\n }\n\n if (Math.abs(size) < 60) {\n return { text: toFixed(size, decimals), suffix: ' s' };\n } else if (Math.abs(size) < 3600) {\n // Less than 1 hour, divide in minutes\n return toFixedScaled(size / 60, decimals, ' min');\n } else if (Math.abs(size) < 86400) {\n // Less than one day, divide in hours\n return toFixedScaled(size / 3600, decimals, ' hour');\n } else if (Math.abs(size) < 604800) {\n // Less than one week, divide in days\n return toFixedScaled(size / 86400, decimals, ' day');\n } else if (Math.abs(size) < 31536000) {\n // Less than one year, divide in week\n return toFixedScaled(size / 604800, decimals, ' week');\n }\n\n return toFixedScaled(size / 3.15569e7, decimals, ' year');\n}\n\nexport function toMinutes(size: number, decimals?: DecimalCount): FormattedValue {\n if (size === null) {\n return { text: '' };\n }\n\n if (Math.abs(size) < 60) {\n return { text: toFixed(size, decimals), suffix: ' min' };\n } else if (Math.abs(size) < 1440) {\n return toFixedScaled(size / 60, decimals, ' hour');\n } else if (Math.abs(size) < 10080) {\n return toFixedScaled(size / 1440, decimals, ' day');\n } else if (Math.abs(size) < 604800) {\n return toFixedScaled(size / 10080, decimals, ' week');\n } else {\n return toFixedScaled(size / 5.25948e5, decimals, ' year');\n }\n}\n\nexport function toHours(size: number, decimals?: DecimalCount): FormattedValue {\n if (size === null) {\n return { text: '' };\n }\n\n if (Math.abs(size) < 24) {\n return { text: toFixed(size, decimals), suffix: ' hour' };\n } else if (Math.abs(size) < 168) {\n return toFixedScaled(size / 24, decimals, ' day');\n } else if (Math.abs(size) < 8760) {\n return toFixedScaled(size / 168, decimals, ' week');\n } else {\n return toFixedScaled(size / 8760, decimals, ' year');\n }\n}\n\nexport function toDays(size: number, decimals?: DecimalCount): FormattedValue {\n if (size === null) {\n return { text: '' };\n }\n\n if (Math.abs(size) < 7) {\n return { text: toFixed(size, decimals), suffix: ' day' };\n } else if (Math.abs(size) < 365) {\n return toFixedScaled(size / 7, decimals, ' week');\n } else {\n return toFixedScaled(size / 365, decimals, ' year');\n }\n}\n\nexport function toDuration(size: number, decimals: DecimalCount, timeScale: Interval): FormattedValue {\n if (size === null) {\n return { text: '' };\n }\n\n if (size === 0) {\n return { text: '0', suffix: ' ' + timeScale + 's' };\n }\n\n if (size < 0) {\n const v = toDuration(-size, decimals, timeScale);\n if (!v.suffix) {\n v.suffix = '';\n }\n v.suffix += ' ago';\n return v;\n }\n\n // convert $size to milliseconds\n // intervals_in_seconds uses seconds (duh), convert them to milliseconds here to minimize floating point errors\n size *= INTERVALS_IN_SECONDS[timeScale] * 1000;\n\n const strings = [];\n\n // after first value >= 1 print only $decimals more\n let decrementDecimals = false;\n let decimalsCount = 0;\n\n if (decimals !== null && decimals !== undefined) {\n decimalsCount = decimals as number;\n }\n\n for (let i = 0; i < UNITS.length && decimalsCount >= 0; i++) {\n const interval = INTERVALS_IN_SECONDS[UNITS[i]] * 1000;\n const value = size / interval;\n if (value >= 1 || decrementDecimals) {\n decrementDecimals = true;\n const floor = Math.floor(value);\n const unit = UNITS[i] + (floor !== 1 ? 's' : '');\n strings.push(floor + ' ' + unit);\n size = size % interval;\n decimalsCount--;\n }\n }\n\n return { text: strings.join(', ') };\n}\n\nexport function toClock(size: number, decimals?: DecimalCount): FormattedValue {\n if (size === null) {\n return { text: '' };\n }\n\n // < 1 second\n if (size < 1000) {\n return {\n text: toUtc(size).format('SSS\\\\m\\\\s'),\n };\n }\n\n // < 1 minute\n if (size < 60000) {\n let format = 'ss\\\\s:SSS\\\\m\\\\s';\n if (decimals === 0) {\n format = 'ss\\\\s';\n }\n return { text: toUtc(size).format(format) };\n }\n\n // < 1 hour\n if (size < 3600000) {\n let format = 'mm\\\\m:ss\\\\s:SSS\\\\m\\\\s';\n if (decimals === 0) {\n format = 'mm\\\\m';\n } else if (decimals === 1) {\n format = 'mm\\\\m:ss\\\\s';\n }\n return { text: toUtc(size).format(format) };\n }\n\n let format = 'mm\\\\m:ss\\\\s:SSS\\\\m\\\\s';\n\n const hours = `${('0' + Math.floor(duration(size, 'milliseconds').asHours())).slice(-2)}h`;\n\n if (decimals === 0) {\n format = '';\n } else if (decimals === 1) {\n format = 'mm\\\\m';\n } else if (decimals === 2) {\n format = 'mm\\\\m:ss\\\\s';\n }\n\n const text = format ? `${hours}:${toUtc(size).format(format)}` : hours;\n return { text };\n}\n\nexport function toDurationInMilliseconds(size: number, decimals: DecimalCount): FormattedValue {\n return toDuration(size, decimals, Interval.Millisecond);\n}\n\nexport function toDurationInSeconds(size: number, decimals: DecimalCount): FormattedValue {\n return toDuration(size, decimals, Interval.Second);\n}\n\nexport function toDurationInHoursMinutesSeconds(size: number): FormattedValue {\n if (size < 0) {\n const v = toDurationInHoursMinutesSeconds(-size);\n if (!v.suffix) {\n v.suffix = '';\n }\n v.suffix += ' ago';\n return v;\n }\n const strings = [];\n const numHours = Math.floor(size / 3600);\n const numMinutes = Math.floor((size % 3600) / 60);\n const numSeconds = Math.floor((size % 3600) % 60);\n numHours > 9 ? strings.push('' + numHours) : strings.push('0' + numHours);\n numMinutes > 9 ? strings.push('' + numMinutes) : strings.push('0' + numMinutes);\n numSeconds > 9 ? strings.push('' + numSeconds) : strings.push('0' + numSeconds);\n return { text: strings.join(':') };\n}\n\nexport function toDurationInDaysHoursMinutesSeconds(size: number): FormattedValue {\n if (size < 0) {\n const v = toDurationInDaysHoursMinutesSeconds(-size);\n if (!v.suffix) {\n v.suffix = '';\n }\n v.suffix += ' ago';\n return v;\n }\n let dayString = '';\n const numDays = Math.floor(size / (24 * 3600));\n if (numDays > 0) {\n dayString = numDays + ' d ';\n }\n const hmsString = toDurationInHoursMinutesSeconds(size - numDays * 24 * 3600);\n return { text: dayString + hmsString.text };\n}\n\nexport function toTimeTicks(size: number, decimals: DecimalCount): FormattedValue {\n return toSeconds(size / 100, decimals);\n}\n\nexport function toClockMilliseconds(size: number, decimals: DecimalCount): FormattedValue {\n return toClock(size, decimals);\n}\n\nexport function toClockSeconds(size: number, decimals: DecimalCount): FormattedValue {\n return toClock(size * 1000, decimals);\n}\n\nexport function toDateTimeValueFormatter(pattern: string, todayPattern?: string): ValueFormatter {\n return (value: number, decimals: DecimalCount, scaledDecimals: DecimalCount, timeZone?: TimeZone): FormattedValue => {\n if (todayPattern) {\n if (dateTime().isSame(value, 'day')) {\n return {\n text: dateTimeFormat(value, { format: todayPattern, timeZone }),\n };\n }\n }\n return { text: dateTimeFormat(value, { format: pattern, timeZone }) };\n };\n}\n\nexport const dateTimeAsIso = toDateTimeValueFormatter('YYYY-MM-DD HH:mm:ss');\nexport const dateTimeAsIsoNoDateIfToday = toDateTimeValueFormatter('YYYY-MM-DD HH:mm:ss', 'HH:mm:ss');\nexport const dateTimeAsUS = toDateTimeValueFormatter('MM/DD/YYYY h:mm:ss a');\nexport const dateTimeAsUSNoDateIfToday = toDateTimeValueFormatter('MM/DD/YYYY h:mm:ss a', 'h:mm:ss a');\n\nexport function getDateTimeAsLocalFormat() {\n return toDateTimeValueFormatter(\n localTimeFormat({\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n })\n );\n}\n\nexport function getDateTimeAsLocalFormatNoDateIfToday() {\n return toDateTimeValueFormatter(\n localTimeFormat({\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n }),\n localTimeFormat({\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n })\n );\n}\n\nexport function dateTimeSystemFormatter(\n value: number,\n decimals: DecimalCount,\n scaledDecimals: DecimalCount,\n timeZone?: TimeZone,\n showMs?: boolean\n): FormattedValue {\n return {\n text: dateTimeFormat(value, {\n format: showMs ? systemDateFormats.fullDateMS : systemDateFormats.fullDate,\n timeZone,\n }),\n };\n}\n\nexport function dateTimeFromNow(\n value: number,\n decimals: DecimalCount,\n scaledDecimals: DecimalCount,\n timeZone?: TimeZone\n): FormattedValue {\n return { text: dateTimeFormatTimeAgo(value, { timeZone }) };\n}\n","import { DecimalCount } from '../types/displayValue';\n\nimport { scaledUnits, ValueFormatter } from './valueFormats';\n\nexport function currency(symbol: string, asSuffix?: boolean): ValueFormatter {\n const units = ['', 'K', 'M', 'B', 'T'];\n const scaler = scaledUnits(1000, units);\n return (size: number, decimals?: DecimalCount, scaledDecimals?: DecimalCount) => {\n if (size === null) {\n return { text: '' };\n }\n const scaled = scaler(size, decimals, scaledDecimals);\n if (asSuffix) {\n scaled.suffix = scaled.suffix !== undefined ? `${scaled.suffix}${symbol}` : undefined;\n } else {\n scaled.prefix = symbol;\n }\n return scaled;\n };\n}\n\nconst SI_PREFIXES = ['f', 'p', 'n', 'µ', 'm', '', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'];\nconst SI_BASE_INDEX = SI_PREFIXES.indexOf('');\n\nexport function getOffsetFromSIPrefix(c: string): number {\n const charIndex = SI_PREFIXES.findIndex((prefix) => prefix.normalize('NFKD') === c.normalize('NFKD'));\n return charIndex < 0 ? 0 : charIndex - SI_BASE_INDEX;\n}\n\nconst BIN_PREFIXES = ['', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi', 'Yi'];\n\nexport function binaryPrefix(unit: string, offset = 0): ValueFormatter {\n const units = BIN_PREFIXES.map((p) => ' ' + p + unit);\n return scaledUnits(1024, units, offset);\n}\n\nexport function SIPrefix(unit: string, offset = 0): ValueFormatter {\n const units = SI_PREFIXES.map((p) => ' ' + p + unit);\n return scaledUnits(1000, units, SI_BASE_INDEX + offset);\n}\n","import { MutableVector } from '../types/vector';\n\nimport { FunctionalVector } from './FunctionalVector';\n\n/**\n * @public\n */\nexport class ArrayVector<T = any> extends FunctionalVector<T> implements MutableVector<T> {\n buffer: T[];\n\n constructor(buffer?: T[]) {\n super();\n this.buffer = buffer ? buffer : [];\n }\n\n get length() {\n return this.buffer.length;\n }\n\n add(value: T) {\n this.buffer.push(value);\n }\n\n get(index: number): T {\n return this.buffer[index];\n }\n\n set(index: number, value: T) {\n this.buffer[index] = value;\n }\n\n reverse() {\n this.buffer.reverse();\n }\n\n toArray(): T[] {\n return this.buffer;\n }\n\n toJSON(): T[] {\n return this.buffer;\n }\n}\n","import { Vector } from '../types';\n\nimport { FunctionalVector } from './FunctionalVector';\n\n/**\n * This will force all values to be numbers\n *\n * @public\n */\nexport class AsNumberVector extends FunctionalVector<number> {\n constructor(private field: Vector) {\n super();\n }\n\n get length() {\n return this.field.length;\n }\n\n get(index: number) {\n return +this.field.get(index);\n }\n}\n","import { Vector } from '../types/vector';\nimport { BinaryOperation } from '../utils/binaryOperators';\n\nimport { vectorToArray } from './vectorToArray';\n\n/**\n * @public\n */\nexport class BinaryOperationVector implements Vector<number> {\n constructor(private left: Vector<number>, private right: Vector<number>, private operation: BinaryOperation) {}\n\n get length(): number {\n return this.left.length;\n }\n\n get(index: number): number {\n return this.operation(this.left.get(index), this.right.get(index));\n }\n\n toArray(): number[] {\n return vectorToArray(this);\n }\n\n toJSON(): number[] {\n return vectorToArray(this);\n }\n}\n","import { Vector } from '../types/vector';\n\n/**\n * @public\n */\nexport class ConstantVector<T = any> implements Vector<T> {\n constructor(private value: T, private len: number) {}\n\n get length() {\n return this.len;\n }\n\n get(index: number): T {\n return this.value;\n }\n\n toArray(): T[] {\n const arr = new Array<T>(this.length);\n return arr.fill(this.value);\n }\n\n toJSON(): T[] {\n return this.toArray();\n }\n}\n","import { Vector } from '../types';\n\nimport { vectorToArray } from './vectorToArray';\n\n/**\n * RowVector makes the row values look like a vector\n * @internal\n */\nexport class RowVector implements Vector {\n constructor(private columns: Vector[]) {}\n\n rowIndex = 0;\n\n get length(): number {\n return this.columns.length;\n }\n\n get(index: number): number {\n return this.columns[index].get(this.rowIndex);\n }\n\n toArray(): number[] {\n return vectorToArray(this);\n }\n\n toJSON(): number[] {\n return vectorToArray(this);\n }\n}\n","import { Vector } from '../types/vector';\n\nimport { vectorToArray } from './vectorToArray';\n\n/**\n * Values are returned in the order defined by the input parameter\n */\nexport class SortedVector<T = any> implements Vector<T> {\n constructor(private source: Vector<T>, private order: number[]) {}\n\n get length(): number {\n return this.source.length;\n }\n\n get(index: number): T {\n return this.source.get(this.order[index]);\n }\n\n toArray(): T[] {\n return vectorToArray(this);\n }\n\n toJSON(): T[] {\n return vectorToArray(this);\n }\n}\n","import { Vector } from '../types/vector';\n\nexport function vectorToArray<T>(v: Vector<T>): T[] {\n const arr: T[] = Array(v.length);\n for (let i = 0; i < v.length; i++) {\n arr[i] = v.get(i);\n }\n return arr;\n}\n","import { DataQueryError } from '@grafana/data';\n\n/**\n * Convert an object into a DataQueryError -- if this is an HTTP response,\n * it will put the correct values in the error field\n *\n * @public\n */\nexport function toDataQueryError(err: DataQueryError | string | Object): DataQueryError {\n const error = (err || {}) as DataQueryError;\n\n if (!error.message) {\n if (typeof err === 'string' || err instanceof String) {\n return { message: err } as DataQueryError;\n }\n\n let message = 'Query error';\n if (error.message) {\n message = error.message;\n } else if (error.data && error.data.message && error.data?.message !== 'Query data error') {\n message = error.data.message;\n } else if (error?.data?.message === 'Query data error' && error?.data?.error) {\n message = error.data.error;\n } else if (error.data && error.data.error) {\n message = error.data.error;\n } else if (error.status) {\n message = `Query error: ${error.status} ${error.statusText}`;\n }\n error.message = message;\n }\n\n return error;\n}\n","import { map, Observable, ReplaySubject, Subject, Subscriber, Subscription } from 'rxjs';\n\nimport {\n DataFrameJSON,\n DataQueryError,\n Field,\n isLiveChannelMessageEvent,\n isLiveChannelStatusEvent,\n LiveChannelConnectionState,\n LiveChannelEvent,\n LiveChannelId,\n LoadingState,\n} from '@grafana/data';\nimport { LiveDataStreamOptions, StreamingFrameAction, StreamingFrameOptions } from '@grafana/runtime/src/services/live';\nimport { toDataQueryError } from '@grafana/runtime/src/utils/toDataQueryError';\n\nimport { getStreamingFrameOptions, StreamingDataFrame } from '../data/StreamingDataFrame';\nimport { StreamingResponseDataType } from '../data/utils';\n\nimport { DataStreamSubscriptionKey, StreamingDataQueryResponse } from './service';\n\nconst bufferIfNot =\n (canEmitObservable: Observable<boolean>) =>\n <T>(source: Observable<T>): Observable<T[]> => {\n return new Observable((subscriber: Subscriber<T[]>) => {\n let buffer: T[] = [];\n let canEmit = true;\n\n const emitBuffer = () => {\n subscriber.next(buffer);\n buffer = [];\n };\n\n const canEmitSub = canEmitObservable.subscribe({\n next: (val) => {\n canEmit = val;\n\n if (canEmit && buffer.length) {\n emitBuffer();\n }\n },\n });\n\n const sourceSub = source.subscribe({\n next(value) {\n if (canEmit) {\n if (!buffer.length) {\n subscriber.next([value]);\n } else {\n emitBuffer();\n }\n } else {\n buffer.push(value);\n }\n },\n error(error) {\n subscriber.error(error);\n },\n complete() {\n subscriber.complete();\n },\n });\n\n return () => {\n sourceSub.unsubscribe();\n canEmitSub.unsubscribe();\n };\n });\n };\n\nexport type DataStreamHandlerDeps<T> = {\n channelId: LiveChannelId;\n liveEventsObservable: Observable<LiveChannelEvent<T>>;\n onShutdown: () => void;\n subscriberReadiness: Observable<boolean>;\n defaultStreamingFrameOptions: Readonly<StreamingFrameOptions>;\n shutdownDelayInMs: number;\n};\n\nenum InternalStreamMessageType {\n Error,\n NewValuesSameSchema,\n ChangedSchema,\n}\n\ntype InternalStreamMessageTypeToData = {\n [InternalStreamMessageType.Error]: {\n error: DataQueryError;\n };\n [InternalStreamMessageType.ChangedSchema]: {};\n [InternalStreamMessageType.NewValuesSameSchema]: {\n values: unknown[][];\n };\n};\n\ntype InternalStreamMessage<T = InternalStreamMessageType> = T extends InternalStreamMessageType\n ? {\n type: T;\n } & InternalStreamMessageTypeToData[T]\n : never;\n\nconst reduceNewValuesSameSchemaMessages = (\n packets: Array<InternalStreamMessage<InternalStreamMessageType.NewValuesSameSchema>>\n) => ({\n values: packets.reduce((acc, { values }) => {\n for (let i = 0; i < values.length; i++) {\n if (!acc[i]) {\n acc[i] = [];\n }\n for (let j = 0; j < values[i].length; j++) {\n acc[i].push(values[i][j]);\n }\n }\n return acc;\n }, [] as unknown[][]),\n type: InternalStreamMessageType.NewValuesSameSchema,\n});\n\nconst filterMessages = <T extends InternalStreamMessageType>(\n packets: InternalStreamMessage[],\n type: T\n): Array<InternalStreamMessage<T>> => packets.filter((p) => p.type === type) as Array<InternalStreamMessage<T>>;\n\nexport class LiveDataStream<T = unknown> {\n private frameBuffer: StreamingDataFrame;\n private liveEventsSubscription: Subscription;\n private stream: Subject<InternalStreamMessage> = new ReplaySubject(1);\n private shutdownTimeoutId: ReturnType<typeof setTimeout> | undefined;\n\n constructor(private deps: DataStreamHandlerDeps<T>) {\n this.frameBuffer = StreamingDataFrame.empty(deps.defaultStreamingFrameOptions);\n this.liveEventsSubscription = deps.liveEventsObservable.subscribe({\n error: this.onError,\n complete: this.onComplete,\n next: this.onNext,\n });\n }\n\n private shutdown = () => {\n this.stream.complete();\n this.liveEventsSubscription.unsubscribe();\n this.deps.onShutdown();\n };\n\n private shutdownIfNoSubscribers = () => {\n if (!this.stream.observed) {\n this.shutdown();\n }\n };\n\n private onError = (err: any) => {\n console.log('LiveQuery [error]', { err }, this.deps.channelId);\n this.stream.next({\n type: InternalStreamMessageType.Error,\n error: toDataQueryError(err),\n });\n this.shutdown();\n };\n\n private onComplete = () => {\n console.log('LiveQuery [complete]', this.deps.channelId);\n this.shutdown();\n };\n\n private onNext = (evt: LiveChannelEvent) => {\n if (isLiveChannelMessageEvent(evt)) {\n this.process(evt.message);\n return;\n }\n\n const liveChannelStatusEvent = isLiveChannelStatusEvent(evt);\n if (liveChannelStatusEvent && evt.error) {\n this.stream.next({\n type: InternalStreamMessageType.Error,\n error: {\n ...toDataQueryError(evt.error),\n message: `Streaming channel error: ${evt.error.message}`,\n },\n });\n return;\n }\n\n if (\n liveChannelStatusEvent &&\n (evt.state === LiveChannelConnectionState.Connected || evt.state === LiveChannelConnectionState.Pending) &&\n evt.message\n ) {\n this.process(evt.message);\n }\n };\n\n private process = (msg: DataFrameJSON) => {\n const packetInfo = this.frameBuffer.push(msg);\n\n if (packetInfo.schemaChanged) {\n this.stream.next({\n type: InternalStreamMessageType.ChangedSchema,\n });\n } else {\n this.stream.next({\n type: InternalStreamMessageType.NewValuesSameSchema,\n values: this.frameBuffer.getValuesFromLastPacket(),\n });\n }\n };\n\n private resizeBuffer = (bufferOptions: StreamingFrameOptions) => {\n if (bufferOptions && this.frameBuffer.needsResizing(bufferOptions)) {\n this.frameBuffer.resize(bufferOptions);\n }\n };\n\n private prepareInternalStreamForNewSubscription = (options: LiveDataStreamOptions): void => {\n if (!this.frameBuffer.hasAtLeastOnePacket() && options.frame) {\n // will skip initial frames from subsequent subscribers\n this.process(options.frame);\n }\n };\n\n private clearShutdownTimeout = () => {\n if (this.shutdownTimeoutId) {\n clearTimeout(this.shutdownTimeoutId);\n this.shutdownTimeoutId = undefined;\n }\n };\n\n get = (options: LiveDataStreamOptions, subKey: DataStreamSubscriptionKey): Observable<StreamingDataQueryResponse> => {\n this.clearShutdownTimeout();\n const buffer = getStreamingFrameOptions(options.buffer);\n\n this.resizeBuffer(buffer);\n this.prepareInternalStreamForNewSubscription(options);\n\n const shouldSendLastPacketOnly = options?.buffer?.action === StreamingFrameAction.Replace;\n const fieldsNamesFilter = options.filter?.fields;\n const dataNeedsFiltering = fieldsNamesFilter?.length;\n const fieldFilterPredicate = dataNeedsFiltering ? ({ name }: Field) => fieldsNamesFilter.includes(name) : undefined;\n let matchingFieldIndexes: number[] | undefined = undefined;\n\n const getFullFrameResponseData = <T>(\n messages: InternalStreamMessage[],\n error?: DataQueryError\n ): StreamingDataQueryResponse => {\n matchingFieldIndexes = fieldFilterPredicate\n ? this.frameBuffer.getMatchingFieldIndexes(fieldFilterPredicate)\n : undefined;\n\n if (!shouldSendLastPacketOnly) {\n return {\n key: subKey,\n state: error ? LoadingState.Error : LoadingState.Streaming,\n data: [\n {\n type: StreamingResponseDataType.FullFrame,\n frame: this.frameBuffer.serialize(fieldFilterPredicate, buffer),\n },\n ],\n error,\n };\n }\n\n if (error) {\n // send empty frame with error\n return {\n key: subKey,\n state: LoadingState.Error,\n data: [\n {\n type: StreamingResponseDataType.FullFrame,\n frame: this.frameBuffer.serialize(fieldFilterPredicate, buffer, { maxLength: 0 }),\n },\n ],\n error,\n };\n }\n\n if (!messages.length) {\n console.warn(`expected to find at least one non error message ${messages.map(({ type }) => type)}`);\n // send empty frame\n return {\n key: subKey,\n state: LoadingState.Streaming,\n data: [\n {\n type: StreamingResponseDataType.FullFrame,\n frame: this.frameBuffer.serialize(fieldFilterPredicate, buffer, { maxLength: 0 }),\n },\n ],\n error,\n };\n }\n\n return {\n key: subKey,\n state: LoadingState.Streaming,\n data: [\n {\n type: StreamingResponseDataType.FullFrame,\n frame: this.frameBuffer.serialize(fieldFilterPredicate, buffer, {\n maxLength: this.frameBuffer.packetInfo.length,\n }),\n },\n ],\n error,\n };\n };\n\n const getNewValuesSameSchemaResponseData = (\n messages: Array<InternalStreamMessage<InternalStreamMessageType.NewValuesSameSchema>>\n ): StreamingDataQueryResponse => {\n const lastMessage = messages.length ? messages[messages.length - 1] : undefined;\n const values =\n shouldSendLastPacketOnly && lastMessage\n ? lastMessage.values\n : reduceNewValuesSameSchemaMessages(messages).values;\n\n const filteredValues = matchingFieldIndexes\n ? values.filter((v, i) => (matchingFieldIndexes as number[]).includes(i))\n : values;\n\n return {\n key: subKey,\n state: LoadingState.Streaming,\n data: [\n {\n type: StreamingResponseDataType.NewValuesSameSchema,\n values: filteredValues,\n },\n ],\n };\n };\n\n let shouldSendFullFrame = true;\n const transformedInternalStream = this.stream.pipe(\n bufferIfNot(this.deps.subscriberReadiness),\n map((messages, i) => {\n const errors = filterMessages(messages, InternalStreamMessageType.Error);\n const lastError = errors.length ? errors[errors.length - 1].error : undefined;\n\n if (shouldSendFullFrame) {\n shouldSendFullFrame = false;\n return getFullFrameResponseData(messages, lastError);\n }\n\n if (errors.length) {\n // send the latest frame with the last error, discard everything else\n return getFullFrameResponseData(messages, lastError);\n }\n\n const schemaChanged = messages.some((n) => n.type === InternalStreamMessageType.ChangedSchema);\n if (schemaChanged) {\n // send the latest frame, discard intermediate appends\n return getFullFrameResponseData(messages, undefined);\n }\n\n const newValueSameSchemaMessages = filterMessages(messages, InternalStreamMessageType.NewValuesSameSchema);\n if (newValueSameSchemaMessages.length !== messages.length) {\n console.warn(`unsupported message type ${messages.map(({ type }) => type)}`);\n }\n\n return getNewValuesSameSchemaResponseData(newValueSameSchemaMessages);\n })\n );\n\n return new Observable<StreamingDataQueryResponse>((subscriber) => {\n const sub = transformedInternalStream.subscribe({\n next: (n) => {\n subscriber.next(n);\n },\n error: (err) => {\n subscriber.error(err);\n },\n complete: () => {\n subscriber.complete();\n },\n });\n\n return () => {\n // TODO: potentially resize (downsize) the buffer on unsubscribe\n sub.unsubscribe();\n if (!this.stream.observed) {\n this.clearShutdownTimeout();\n this.shutdownTimeoutId = setTimeout(this.shutdownIfNoSubscribers, this.deps.shutdownDelayInMs);\n }\n };\n });\n };\n}\n","import Centrifuge, {\n JoinLeaveContext,\n PublicationContext,\n SubscribeErrorContext,\n SubscribeSuccessContext,\n SubscriptionEvents,\n UnsubscribeContext,\n} from 'centrifuge/dist/centrifuge';\nimport { Subject, of, Observable } from 'rxjs';\n\nimport {\n LiveChannelStatusEvent,\n LiveChannelEvent,\n LiveChannelEventType,\n LiveChannelConnectionState,\n LiveChannelPresenceStatus,\n LiveChannelAddress,\n DataFrameJSON,\n isValidLiveChannelAddress,\n} from '@grafana/data';\n\n/**\n * Internal class that maps Centrifuge support to GrafanaLive\n */\nexport class CentrifugeLiveChannel<T = any> {\n readonly currentStatus: LiveChannelStatusEvent;\n\n readonly opened = Date.now();\n readonly id: string;\n readonly addr: LiveChannelAddress;\n\n readonly stream = new Subject<LiveChannelEvent<T>>();\n\n // Hold on to the last header with schema\n lastMessageWithSchema?: DataFrameJSON;\n\n subscription?: Centrifuge.Subscription;\n shutdownCallback?: () => void;\n initalized?: boolean;\n\n constructor(id: string, addr: LiveChannelAddress) {\n this.id = id;\n this.addr = addr;\n this.currentStatus = {\n type: LiveChannelEventType.Status,\n id,\n timestamp: this.opened,\n state: LiveChannelConnectionState.Pending,\n };\n if (!isValidLiveChannelAddress(addr)) {\n this.currentStatus.state = LiveChannelConnectionState.Invalid;\n this.currentStatus.error = 'invalid channel address';\n }\n }\n\n // This should only be called when centrifuge is connected\n initalize(): SubscriptionEvents {\n if (this.initalized) {\n throw new Error('Channel already initalized: ' + this.id);\n }\n this.initalized = true;\n\n const events: SubscriptionEvents = {\n // Called when a message is received from the socket\n publish: (ctx: PublicationContext) => {\n try {\n if (ctx.data) {\n if (ctx.data.schema) {\n this.lastMessageWithSchema = ctx.data as DataFrameJSON;\n }\n\n this.stream.next({\n type: LiveChannelEventType.Message,\n message: ctx.data,\n });\n }\n\n // Clear any error messages\n if (this.currentStatus.error) {\n this.currentStatus.timestamp = Date.now();\n delete this.currentStatus.error;\n this.sendStatus();\n }\n } catch (err) {\n console.log('publish error', this.addr, err);\n this.currentStatus.error = err;\n this.currentStatus.timestamp = Date.now();\n this.sendStatus();\n }\n },\n error: (ctx: SubscribeErrorContext) => {\n this.currentStatus.timestamp = Date.now();\n this.currentStatus.error = ctx.message;\n this.sendStatus();\n },\n subscribe: (ctx: SubscribeSuccessContext) => {\n this.currentStatus.timestamp = Date.now();\n this.currentStatus.state = LiveChannelConnectionState.Connected;\n delete this.currentStatus.error;\n\n if (ctx.data?.schema) {\n this.lastMessageWithSchema = ctx.data as DataFrameJSON;\n }\n\n this.sendStatus(ctx.data);\n },\n unsubscribe: (ctx: UnsubscribeContext) => {\n this.currentStatus.timestamp = Date.now();\n this.currentStatus.state = LiveChannelConnectionState.Disconnected;\n this.sendStatus();\n },\n };\n\n events.join = (ctx: JoinLeaveContext) => {\n this.stream.next({ type: LiveChannelEventType.Join, user: ctx.info.user });\n };\n events.leave = (ctx: JoinLeaveContext) => {\n this.stream.next({ type: LiveChannelEventType.Leave, user: ctx.info.user });\n };\n return events;\n }\n\n private sendStatus(message?: any) {\n const copy = { ...this.currentStatus };\n if (message) {\n copy.message = message;\n }\n this.stream.next(copy);\n }\n\n disconnectIfNoListeners = () => {\n const count = this.stream.observers.length;\n if (count === 0) {\n this.disconnect();\n }\n };\n\n /**\n * Get the stream of events and\n */\n getStream() {\n return new Observable((subscriber) => {\n const initialMessage = { ...this.currentStatus };\n if (this.lastMessageWithSchema?.schema) {\n // send just schema instead of schema+data to avoid having data gaps\n initialMessage.message = { schema: this.lastMessageWithSchema?.schema };\n }\n\n subscriber.next({ ...this.currentStatus, message: this.lastMessageWithSchema });\n\n const sub = this.stream.subscribe(subscriber);\n return () => {\n sub.unsubscribe();\n const count = this.stream.observers.length;\n\n // Wait 1/4 second to fully disconnect\n if (count === 0) {\n setTimeout(this.disconnectIfNoListeners, 250);\n }\n };\n }) as Observable<LiveChannelEvent<T>>;\n }\n\n /**\n * This is configured by the server when the config supports presence\n */\n async getPresence(): Promise<LiveChannelPresenceStatus> {\n if (!this.subscription) {\n return Promise.reject('not subscribed');\n }\n\n return this.subscription!.presence().then((v) => {\n return {\n users: Object.keys(v.presence),\n };\n });\n }\n\n /**\n * This will close and terminate all streams for this channel\n */\n disconnect() {\n this.currentStatus.state = LiveChannelConnectionState.Shutdown;\n this.currentStatus.timestamp = Date.now();\n\n if (this.subscription) {\n this.subscription.unsubscribe();\n this.subscription.removeAllListeners(); // they keep all listeners attached after unsubscribe\n this.subscription = undefined;\n }\n\n this.stream.complete();\n\n this.stream.next({ ...this.currentStatus });\n this.stream.complete();\n\n if (this.shutdownCallback) {\n this.shutdownCallback();\n }\n }\n\n shutdownWithError(err: string) {\n this.currentStatus.error = err;\n this.sendStatus();\n this.disconnect();\n }\n}\n\nexport function getErrorChannel<TMessage>(msg: string, id: string, addr: LiveChannelAddress) {\n return {\n id,\n opened: Date.now(),\n addr,\n\n // return an error\n getStream: () =>\n of({\n type: LiveChannelEventType.Status,\n id,\n timestamp: Date.now(),\n state: LiveChannelConnectionState.Invalid,\n error: msg,\n }),\n\n // already disconnected\n disconnect: () => {},\n };\n}\n","import Centrifuge from 'centrifuge/dist/centrifuge';\nimport { BehaviorSubject, Observable, share, startWith } from 'rxjs';\n\nimport {\n DataQueryError,\n DataQueryResponse,\n LiveChannelAddress,\n LiveChannelConnectionState,\n LiveChannelId,\n toLiveChannelId,\n} from '@grafana/data';\nimport { FetchResponse } from '@grafana/runtime/src/services/backendSrv';\nimport {\n GrafanaLiveSrv,\n LiveDataStreamOptions,\n LiveQueryDataOptions,\n StreamingFrameAction,\n StreamingFrameOptions,\n} from '@grafana/runtime/src/services/live';\nimport { BackendDataSourceResponse } from '@grafana/runtime/src/utils/queryResponse';\n\nimport { StreamingResponseData } from '../data/utils';\n\nimport { LiveDataStream } from './LiveDataStream';\nimport { CentrifugeLiveChannel } from './channel';\n\nexport type CentrifugeSrvDeps = {\n appUrl: string;\n orgId: number;\n orgRole: string;\n sessionId: string;\n liveEnabled: boolean;\n dataStreamSubscriberReadiness: Observable<boolean>;\n};\n\nexport type StreamingDataQueryResponse = Omit<DataQueryResponse, 'data'> & { data: [StreamingResponseData] };\n\nexport type CentrifugeSrv = Omit<GrafanaLiveSrv, 'publish' | 'getDataStream' | 'getQueryData'> & {\n getDataStream: (options: LiveDataStreamOptions) => Observable<StreamingDataQueryResponse>;\n getQueryData: (\n options: LiveQueryDataOptions\n ) => Promise<\n | { data: BackendDataSourceResponse | undefined }\n | FetchResponse<BackendDataSourceResponse | undefined>\n | DataQueryError\n >;\n};\n\nexport type DataStreamSubscriptionKey = string;\n\nconst defaultStreamingFrameOptions: Readonly<StreamingFrameOptions> = {\n maxLength: 100,\n maxDelta: Infinity,\n action: StreamingFrameAction.Append,\n};\n\nconst dataStreamShutdownDelayInMs = 5000;\n\nexport class CentrifugeService implements CentrifugeSrv {\n readonly open = new Map<string, CentrifugeLiveChannel>();\n private readonly liveDataStreamByChannelId: Record<LiveChannelId, LiveDataStream> = {};\n readonly centrifuge: Centrifuge;\n readonly connectionState: BehaviorSubject<boolean>;\n readonly connectionBlocker: Promise<void>;\n private readonly dataStreamSubscriberReadiness: Observable<boolean>;\n\n constructor(private deps: CentrifugeSrvDeps) {\n this.dataStreamSubscriberReadiness = deps.dataStreamSubscriberReadiness.pipe(share(), startWith(true));\n const liveUrl = `${deps.appUrl.replace(/^http/, 'ws')}/api/live/ws`;\n this.centrifuge = new Centrifuge(liveUrl, {\n timeout: 30000,\n });\n this.centrifuge.setConnectData({\n sessionId: deps.sessionId,\n orgId: deps.orgId,\n });\n // orgRole is set when logged in *or* anonomus users can use grafana\n if (deps.liveEnabled && deps.orgRole !== '') {\n this.centrifuge.connect(); // do connection\n }\n this.connectionState = new BehaviorSubject<boolean>(this.centrifuge.isConnected());\n this.connectionBlocker = new Promise<void>((resolve) => {\n if (this.centrifuge.isConnected()) {\n return resolve();\n }\n const connectListener = () => {\n resolve();\n this.centrifuge.removeListener('connect', connectListener);\n };\n this.centrifuge.addListener('connect', connectListener);\n });\n\n // Register global listeners\n this.centrifuge.on('connect', this.onConnect);\n this.centrifuge.on('disconnect', this.onDisconnect);\n this.centrifuge.on('publish', this.onServerSideMessage);\n }\n\n //----------------------------------------------------------\n // Internal functions\n //----------------------------------------------------------\n\n private onConnect = (context: any) => {\n this.connectionState.next(true);\n };\n\n private onDisconnect = (context: any) => {\n this.connectionState.next(false);\n };\n\n private onServerSideMessage = (context: any) => {\n console.log('Publication from server-side channel', context);\n };\n\n /**\n * Get a channel. If the scope, namespace, or path is invalid, a shutdown\n * channel will be returned with an error state indicated in its status\n */\n private getChannel<TMessage>(addr: LiveChannelAddress): CentrifugeLiveChannel<TMessage> {\n const id = `${this.deps.orgId}/${addr.scope}/${addr.namespace}/${addr.path}`;\n let channel = this.open.get(id);\n if (channel != null) {\n return channel;\n }\n\n channel = new CentrifugeLiveChannel(id, addr);\n if (channel.currentStatus.state === LiveChannelConnectionState.Invalid) {\n return channel;\n }\n channel.shutdownCallback = () => {\n this.open.delete(id); // remove it from the list of open channels\n };\n this.open.set(id, channel);\n\n // Initialize the channel in the background\n this.initChannel(channel).catch((err) => {\n if (channel) {\n channel.currentStatus.state = LiveChannelConnectionState.Invalid;\n channel.shutdownWithError(err);\n }\n this.open.delete(id);\n });\n\n // return the not-yet initialized channel\n return channel;\n }\n\n private async initChannel(channel: CentrifugeLiveChannel): Promise<void> {\n const events = channel.initalize();\n if (!this.centrifuge.isConnected()) {\n await this.connectionBlocker;\n }\n channel.subscription = this.centrifuge.subscribe(channel.id, events, { data: channel.addr.data });\n return;\n }\n\n //----------------------------------------------------------\n // Exported functions\n //----------------------------------------------------------\n\n /**\n * Listen for changes to the connection state\n */\n getConnectionState = () => {\n return this.connectionState.asObservable();\n };\n\n /**\n * Watch for messages in a channel\n */\n getStream: CentrifugeSrv['getStream'] = <T>(address: LiveChannelAddress) => {\n return this.getChannel<T>(address).getStream();\n };\n\n private createSubscriptionKey = (options: LiveDataStreamOptions): DataStreamSubscriptionKey =>\n options.key ?? `xstr/${streamCounter++}`;\n\n private getLiveDataStream = (options: LiveDataStreamOptions): LiveDataStream => {\n const channelId = toLiveChannelId(options.addr);\n const existingStream = this.liveDataStreamByChannelId[channelId];\n\n if (existingStream) {\n return existingStream;\n }\n\n const channel = this.getChannel(options.addr);\n this.liveDataStreamByChannelId[channelId] = new LiveDataStream({\n channelId,\n onShutdown: () => {\n delete this.liveDataStreamByChannelId[channelId];\n },\n liveEventsObservable: channel.getStream(),\n subscriberReadiness: this.dataStreamSubscriberReadiness,\n defaultStreamingFrameOptions,\n shutdownDelayInMs: dataStreamShutdownDelayInMs,\n });\n return this.liveDataStreamByChannelId[channelId];\n };\n /**\n * Connect to a channel and return results as DataFrames\n */\n getDataStream: CentrifugeSrv['getDataStream'] = (options) => {\n const subscriptionKey = this.createSubscriptionKey(options);\n\n const stream = this.getLiveDataStream(options);\n return stream.get(options, subscriptionKey);\n };\n\n /**\n * Executes a query over the live websocket. Query response can contain live channels we can subscribe to for further updates\n *\n * Since the initial request and subscription are on the same socket, this will support HA setups\n */\n getQueryData: CentrifugeSrv['getQueryData'] = async (options) => {\n if (!this.centrifuge.isConnected()) {\n await this.connectionBlocker;\n }\n return this.centrifuge.namedRPC('grafana.query', options.body);\n };\n\n /**\n * For channels that support presence, this will request the current state from the server.\n *\n * Join and leave messages will be sent to the open stream\n */\n getPresence: CentrifugeSrv['getPresence'] = (address) => {\n return this.getChannel(address).getPresence();\n };\n}\n\n// This is used to give a unique key for each stream. The actual value does not matter\nlet streamCounter = 0;\n","import * as comlink from 'comlink';\nimport { Subscriber } from 'rxjs';\n\n// Observers, ie. functions passed to `observable.subscribe(...)`, are converted to a subclass of `Subscriber` before they are sent to the source Observable.\n// The conversion happens internally in the RxJS library - this transfer handler is catches them and wraps them with a proxy\nconst subscriberTransferHandler: any = {\n canHandle(value: any): boolean {\n return value && value instanceof Subscriber;\n },\n\n serialize(value: Function): [MessagePort, Transferable[]] {\n const obj = comlink.proxy(value);\n\n const { port1, port2 } = new MessageChannel();\n\n comlink.expose(obj, port1);\n\n return [port2, [port2]];\n },\n\n deserialize(value: MessagePort): comlink.Remote<MessagePort> {\n value.start();\n\n return comlink.wrap<MessagePort>(value);\n },\n};\ncomlink.transferHandlers.set('SubscriberHandler', subscriberTransferHandler);\n","import { Labels } from '@grafana/data';\n\n/** replace labels in a string. Used for loki+prometheus legend formats */\nexport function renderLegendFormat(aliasPattern: string, aliasData: Labels): string {\n const aliasRegex = /\\{\\{\\s*(.+?)\\s*\\}\\}/g;\n return aliasPattern.replace(aliasRegex, (_, g1) => (aliasData[g1] ? aliasData[g1] : g1));\n}\n"],"names":["dateTimeParse","value","options","isDateTime","parseString","parseOthers","indexOf","isValid","moment","parse","roundUp","timeZone","fiscalYearStartMonth","getTimeZone","zone","format","systemDateFormats","name","lowerCase","date","typeList","Set","eventFactory","has","Error","add","BusEventBase","constructor","this","type","__proto__","BusEventWithPayload","payload","super","FieldConfigOptionsRegistry","Registry","fieldIndexComparer","field","reverse","values","FieldType","numericIndexComparer","stringIndexComparer","booleanIndexComparer","timeIndexComparer","naturalIndexComparer","timeComparer","a","b","isNumber","numericComparer","dateTime","isBefore","falsyComparer","stringComparer","localeCompare","booleanComparer","vA","get","vB","getFrameDisplayName","frame","index","valuesWithLabels","fields","labels","Object","keys","length","push","formatLabels","undefined","filter","f","map","getFieldDisplayName","join","refId","allFrames","existingTitle","state","displayName","multipleFrames","Boolean","hasConfigTitle","config","displayNameFromDS","TIME_SERIES_TIME_FIELD_NAME","parts","frameNamesDiffer","i","frameNameAdded","labelsAdded","TIME_SERIES_VALUE_FIELD_NAME","singleLabelName","frames","singleName","labelKey","getSingleLabelName","allLabels","dupeCount","foundSelf","otherField","getUniqueFieldName","calculateFieldDisplayName","XSSWL","xss","reduce","acc","element","concat","sanitizeXSS","whiteList","sanitizeTextPanelWhitelist","css","gap","order","sanitize","unsanitizedString","process","error","console","sanitizeTextPanelContent","sanitizeUrl","url","braintreeSanitizeUrl","hasAnsiCodes","input","test","escapeHtml","str","String","replace","createComponents","colors","shadows","panel","padding","headerHeight","background","primary","borderColor","border","weak","boxShadow","medium","borderHover","strong","text","mode","canvas","height","sm","md","lg","dropdown","tooltip","secondary","dashboard","overlay","sidemenu","width","menuTabs","textHighlight","warning","contrastText","main","horizontalDrawer","defaultHeight","createV1Theme","theme","oldCommon","typography","fontFamily","sansSerif","monospace","fontFamilyMonospace","size","base","fontSize","xs","heading","h1","h2","h3","h4","h5","h6","weight","light","fontWeightLight","regular","fontWeightRegular","semibold","fontWeightMedium","bold","fontWeightBold","lineHeight","bodySmall","body","link","decoration","hoverDecoration","breakpoints","xl","xxl","spacing","gridSize","insetSquishMd","d","xxs","gutter","formSpacingBase","formMargin","formFieldsetMargin","formInputHeight","formButtonHeight","formInputPaddingHorizontal","formInputAffixPaddingHorizontal","formInputMargin","formLabelPadding","formLabelMargin","formValidationMessagePadding","formValidationMessageMargin","inlineFormMargin","radius","shape","borderRadius","components","panelPadding","panelHeaderHeight","zIndex","basicColors","commonColorsPalette","black","white","dark1","dark2","dark3","dark4","dark5","dark6","dark7","dark8","dark9","dark10","gray1","gray2","gray3","gray4","gray5","gray6","gray7","redBase","redShade","greenBase","greenShade","red","yellow","purple","variable","orange","orangeDark","backgrounds","bg1","bg2","bg3","action","hover","dashboardBg","bgBlue1","bgBlue2","shade","borders","border1","border2","border3","textColors","textStrong","maxContrast","textHeading","textSemiWeak","textWeak","textFaint","disabled","textBlue","form","formLabel","formDescription","formInputBg","formInputBgDisabled","disabledBackground","formInputBorder","formInputBorderHover","formInputBorderActive","formInputBorderInvalid","formInputPlaceholderText","formInputText","formInputDisabledText","disabledText","formFocusOutline","formValidationMessageText","formValidationMessageBg","GrafanaThemeType","isDark","isLight","palette","brandPrimary","brandSuccess","success","brandWarning","brandDanger","queryRed","queryGreen","queryPurple","queryOrange","online","warn","critical","bodyBg","panelBg","panelBorder","pageHeaderBg","pageHeaderBorder","dropdownBg","dropdownShadow","dropdownOptionHoverBg","linkDisabled","linkHover","linkExternal","listItem","visualization","gray98","gray97","gray95","gray90","gray85","gray70","gray60","gray33","gray25","gray15","gray10","gray05","blue95","blue85","blue80","blue77","red88","createTheme","colorsInput","spacingInput","shapeInput","typographyInput","createColors","createBreakpoints","createSpacing","createShape","createTypography","createShadows","transitions","createTransitions","createVisualizationColors","v1","darkLayer0","darkLayer1","darkLayer2","darkBorder1","darkBorder2","gray100","gray80","lightBorder1","blueDarkMain","blueDarkText","redDarkMain","redDarkText","greenDarkMain","greenDarkText","orangeDarkMain","orangeDarkText","blueLightMain","blueLightText","redLightMain","redLightText","greenLightMain","greenLightText","orangeLightMain","orangeLightText","ReducerID","reduceField","reducers","calcs","missing","s","hasOwnProperty","queue","fieldReducers","list","reducer","id","emptyInputResult","nullValueMode","ignoreNulls","NullValueMode","nullAsZero","doStandardCalcs","lastNotNull","description","standard","aliasIds","calculateLastNotNull","last","calculateLast","firstNotNull","calculateFirstNotNull","first","calculateFirst","min","max","mean","sum","count","range","delta","step","diff","logmin","allIsZero","allIsNull","changeCount","calculateChangeCount","distinctCount","calculateDistinctCount","diffperc","allValues","toArray","uniqueValues","Number","MAX_VALUE","nonNullCount","previousDeltaUp","data","isNumberField","currentValue","isFirst","idx","v","distinct","fieldTypeMatcher","FieldMatcherID","defaultOptions","getOptionsDisplayText","numericMatcher","timeMatcher","getFieldTypeMatchers","MatcherID","FrameMatcherID","ValueMatcherID","anyFieldMatcher","excludeFromPicker","children","option","getFieldMatcher","child","sub","matcher","fieldMatchers","anyFrameMatcher","getFrameMatchers","frameMatchers","allFieldsMatcher","allFramesMatcher","notFieldMatcher","check","notFrameMatcher","alwaysFieldMatcher","alwaysFrameMatcher","neverFieldMatcher","notTimeFieldMatcher","neverFrameMatcher","alwaysFieldMatcherInfo","alwaysFrameMatcherInfo","neverFieldMatcherInfo","neverFrameMatcherInfo","getFieldPredicateMatchers","getFramePredicateMatchers","refIdMacher","pattern","regex","stringToJsRegex","getRefIdMatchers","firstFieldMatcher","firstTimeFieldMatcher","find","getSimpleFieldMatchers","isEqualValueMatcher","valueIndex","isApplicable","getDefaultOptions","isNotEqualValueMatcher","getEqualValueMatchers","isNullValueMatcher","isNotNullValueMatcher","getNullValueMatchers","isGreaterValueMatcher","isNaN","isGreaterOrEqualValueMatcher","isLowerValueMatcher","isLowerOrEqualValueMatcher","getNumericValueMatchers","isBetweenValueMatcher","from","to","getRangeValueMatchers","regexValueMatcher","RegExp","getRegexValueMatcher","ensureColumnsTransformer","DataTransformerID","operator","source","pipe","transformer","timeFieldName","timeField","getTimeField","findConsistentTimeFieldName","seriesToColumnsTransformer","byField","filterFieldsTransformer","include","exclude","processed","series","copy","noopTransformer","filterFramesTransformer","filterFieldsByNameTransformer","getMatcherConfig","names","Array","isArray","filterFramesByRefIdTransformer","filterOptions","mergeTransformer","dataFrames","fieldNames","fieldIndexByName","fieldNamesForKey","dataFrame","MutableDataFrame","frameIndex","fieldIndex","addField","copyFieldStructure","fieldExistsInAllFrames","valuesByKey","valuesInOrder","keyFactory","createKeyFactory","valueMapper","createValueMapper","key","createPointer","valueWasMerged","existing","isMergable","pointer","omit","ArrayVector","fieldPointerByName","keyFieldNames","factoryIndex","fieldName","fieldByName","fieldIndexByFrameIndex","mergable","prop","organizeFieldsTransformer","excludeByName","indexByName","renameByName","mapToExcludeArray","orderFieldsTransformer","renameFieldsTransformer","renamer","createRenamer","renameTo","joinBy","joined","outerJoinDataFrames","seriesToRowsTransformer","isTimeSeries","timeFieldByIndex","targetFields","metricField","TIME_SERIES_METRIC_FIELD_NAME","timeFieldIndex","valueFieldIndex","sortDataFrame","sortByTransformer","sort","findIndex","attachFieldIndex","desc","sortDataFrames","FieldColorModeId","FALLBACK_COLOR","ThresholdsMode","MappingType","SpecialValueMatch","init","Map","initialized","getIfExists","initialize","byId","ext","register","selectOptions","current","select","currentOptions","ordered","label","PluginState","ids","found","isEmpty","set","alias","anyToNumber","NaN","toNumber","BinaryOperationID","binaryOperators","Add","operation","Subtract","Multiply","Divide","makeFieldParser","guessFieldTypeFromValue","parseFloat","makeClassES5Compatible","ES6Class","Proxy","apply","target","self","argumentsList","Reflect","construct","alert","toPercent","decimals","toFixed","suffix","toPercentUnit","toHex0x","asHex","toHex","substring","toString","toUpperCase","sci","toExponential","getCategories","formats","fn","toFixedUnit","stringFormater","scaledUnits","locale","SIPrefix","currency","binaryPrefix","dateTimeAsIso","dateTimeAsIsoNoDateIfToday","dateTimeAsUS","dateTimeAsUSNoDateIfToday","getDateTimeAsLocalFormat","getDateTimeAsLocalFormatNoDateIfToday","dateTimeSystemFormatter","dateTimeFromNow","toNanoSeconds","toMicroSeconds","toMilliSeconds","toSeconds","toMinutes","toHours","toDays","toDurationInMilliseconds","toDurationInSeconds","toDurationInHoursMinutesSeconds","toDurationInDaysHoursMinutesSeconds","toTimeTicks","toClockMilliseconds","toClockSeconds","simpleCountUnit","booleanValueFormatter","Interval","UNITS","Year","Month","Week","Day","Hour","Minute","Second","Millisecond","INTERVALS_IN_SECONDS","Math","abs","toFixedScaled","scaledDecimals","toDuration","timeScale","strings","decrementDecimals","decimalsCount","interval","floor","unit","toClock","toUtc","hours","duration","asHours","slice","numHours","numMinutes","numSeconds","dayString","numDays","toDateTimeValueFormatter","todayPattern","isSame","dateTimeFormat","localTimeFormat","year","month","day","hour","minute","second","showMs","dateTimeFormatTimeAgo","symbol","asSuffix","scaler","scaled","prefix","SI_PREFIXES","SI_BASE_INDEX","getOffsetFromSIPrefix","c","charIndex","normalize","BIN_PREFIXES","offset","units","p","FunctionalVector","buffer","toJSON","AsNumberVector","BinaryOperationVector","left","right","vectorToArray","ConstantVector","len","fill","RowVector","columns","rowIndex","SortedVector","arr","toDataQueryError","err","message","status","statusText","InternalStreamMessageType","filterMessages","packets","LiveDataStream","deps","ReplaySubject","stream","complete","liveEventsSubscription","unsubscribe","onShutdown","observed","shutdown","log","channelId","next","evt","isLiveChannelMessageEvent","liveChannelStatusEvent","isLiveChannelStatusEvent","LiveChannelConnectionState","msg","frameBuffer","schemaChanged","ChangedSchema","NewValuesSameSchema","getValuesFromLastPacket","bufferOptions","needsResizing","resize","hasAtLeastOnePacket","shutdownTimeoutId","clearTimeout","subKey","clearShutdownTimeout","getStreamingFrameOptions","resizeBuffer","prepareInternalStreamForNewSubscription","shouldSendLastPacketOnly","StreamingFrameAction","fieldsNamesFilter","fieldFilterPredicate","includes","matchingFieldIndexes","getFullFrameResponseData","messages","getMatchingFieldIndexes","LoadingState","StreamingResponseDataType","serialize","maxLength","packetInfo","getNewValuesSameSchemaResponseData","lastMessage","j","filteredValues","shouldSendFullFrame","transformedInternalStream","canEmitObservable","subscriberReadiness","Observable","subscriber","canEmit","emitBuffer","canEmitSub","subscribe","val","sourceSub","errors","lastError","some","n","newValueSameSchemaMessages","setTimeout","shutdownIfNoSubscribers","shutdownDelayInMs","StreamingDataFrame","defaultStreamingFrameOptions","liveEventsObservable","onError","onComplete","onNext","CentrifugeLiveChannel","addr","Date","now","Subject","observers","disconnect","currentStatus","LiveChannelEventType","timestamp","opened","isValidLiveChannelAddress","initalize","initalized","events","publish","ctx","schema","lastMessageWithSchema","sendStatus","user","info","leave","getStream","initialMessage","disconnectIfNoListeners","subscription","presence","then","users","Promise","reject","removeAllListeners","shutdownCallback","shutdownWithError","maxDelta","Infinity","CentrifugeService","context","connectionState","asObservable","address","getChannel","streamCounter","toLiveChannelId","existingStream","liveDataStreamByChannelId","channel","dataStreamSubscriberReadiness","subscriptionKey","createSubscriptionKey","getLiveDataStream","async","centrifuge","isConnected","connectionBlocker","namedRPC","getPresence","share","startWith","liveUrl","appUrl","Centrifuge","timeout","setConnectData","sessionId","orgId","liveEnabled","orgRole","connect","BehaviorSubject","resolve","connectListener","removeListener","addListener","on","onConnect","onDisconnect","onServerSideMessage","scope","namespace","path","open","delete","initChannel","catch","subscriberTransferHandler","canHandle","Subscriber","obj","comlink","port1","port2","MessageChannel","deserialize","start","renderLegendFormat","aliasPattern","aliasData","_","g1"],"sourceRoot":""}