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U+iB,EAAAA,aAAAA,QACZ/iB,EAAQ+iB,EAAAA,aAAAA,MAGVkN,EAAWQ,WACXrZ,EAAIoY,eAENJ,KAAOuE,IACL,IAAIC,EAAAA,EAAAA,2BAA0BD,GAC5B1xB,EAAQ0xB,EAAI/F,cAGd,IAAIiG,EAAAA,EAAAA,0BAAyBF,GAAM,CACjC,GAAIA,EAAIzxB,MAAO,CACb,IAAIA,GAAQwrB,EAAAA,EAAAA,GAAiBiG,EAAIzxB,OAIjC,OAHAA,EAAM0rB,QAAW,4BAA2B1rB,EAAM0rB,UAClD5tB,EAAQ+iB,EAAAA,aAAAA,WACRkN,EAAWb,KAAK,CAAEpvB,MAAAA,EAAO6V,KAAM,CAACA,GAAO6K,IAAAA,EAAKxe,MAAAA,IAEvC,GACLyxB,EAAI3zB,QAAU6uB,EAAAA,2BAAAA,WACd8E,EAAI3zB,QAAU6uB,EAAAA,2BAAAA,QAKd,YAHI8E,EAAI/F,SACN3rB,EAAQ0xB,EAAI/F,UAIhBzrB,QAAQmtB,IAAI,eAAgBqE,OAKlC,MAAO,KACLvc,EAAIoY,kBAUVsE,YAAYb,GACV,OAAOtP,KAAK4O,WAAWU,GAASa,eAKpC,IAAIX,EAAgB,G,sSCtRpB,MAAMY,EAAiC,CACrCC,UAAUx4B,GACDA,GAASA,aAAiBy4B,EAAAA,GAGnCC,UAAU14B,GACR,MAAM24B,EAAMC,EAAAA,GAAc54B,IAEpB,MAAE64B,EAAF,MAASC,GAAU,IAAIC,eAI7B,OAFAH,EAAAA,GAAeD,EAAKE,GAEb,CAACC,EAAO,CAACA,KAGlBE,YAAYh5B,IACVA,EAAMi5B,QAECL,EAAAA,GAA0B54B,KAGrC44B,EAAAA,GAAAA,IAA6B,oBAAqBL","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/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/createV1Theme.ts","webpack://grafana/./packages/grafana-data/src/themes/createTheme.ts","webpack://grafana/./packages/grafana-data/src/themes/createComponents.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/joinDataFrames.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/data.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/channel.ts","webpack://grafana/./public/app/features/live/centrifuge/service.ts","webpack://grafana/./public/app/features/live/centrifuge/transferHandlers.ts"],"sourcesContent":["/* eslint-disable id-blacklist, no-restricted-imports, @typescript-eslint/ban-types */\nimport moment, { MomentInput } from 'moment-timezone';\nimport { DateTimeInput, DateTime, isDateTime } from './moment_wrapper';\nimport { DateTimeOptions, getTimeZone } from './common';\nimport { parse, isValid } from './datemath';\nimport { lowerCase } from 'lodash';\nimport { systemDateFormats } from './formats';\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 = (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 = (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 = new Set();\n\nexport function eventFactory(name: string): AppEvent {\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 { Registry } from '../utils/Registry';\nimport { FieldConfigPropertyItem } from '../types/fieldOverrides';\n\nexport class FieldConfigOptionsRegistry extends Registry {}\n","import { Field, FieldType } from '../types/dataFrame';\nimport { Vector } from '../types/vector';\nimport { dateTime } from '../datetime';\nimport { isNumber } from 'lodash';\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, 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, 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, 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, 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\n if (existingTitle) {\n return existingTitle;\n }\n\n const displayName = calculateFieldDisplayName(field, frame, allFrames);\n field.state = field.state || {};\n field.state.displayName = displayName;\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 xss from 'xss';\nimport { sanitizeUrl as braintreeSanitizeUrl } from '@braintree/sanitize-url';\n\nconst XSSWL = Object.keys(xss.whiteList).reduce((acc, element) => {\n // @ts-ignore\n acc[element] = xss.whiteList[element].concat(['class', 'style']);\n return acc;\n}, {});\n\nconst sanitizeXSS = new xss.FilterXSS({\n whiteList: XSSWL,\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 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, '&').replace(//g, '>').replace(/\"/g, '"');\n}\n","import { GrafanaTheme, GrafanaThemeCommons, GrafanaThemeType } from '../types';\nimport { GrafanaTheme2 } from './types';\n\nexport function createV1Theme(theme: Omit): 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 { createComponents } from './createComponents';\nimport { createColors, ThemeColorsInput } from './createColors';\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 { GrafanaTheme2 } from './types';\nimport { zIndex } from './zIndex';\nimport { createVisualizationColors } from './createVisualizationColors';\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 name = 'Dark',\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,\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","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 sidemenu: {\n width: 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.mode === 'light' ? '#555' : colors.background.secondary,\n text: colors.mode === 'light' ? '#FFF' : colors.text.primary,\n },\n dashboard: {\n background: colors.background.canvas,\n padding: 1,\n },\n overlay: {\n background: colors.mode === 'dark' ? 'rgba(0, 0, 0, 0.45)' : 'rgba(208, 209, 211, 0.24)',\n },\n sidemenu: {\n width: 48,\n },\n };\n}\n","export const palette = {\n white: '#fff',\n black: '#000',\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}\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(() => [\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 { id: ReducerID.first, name: 'First', description: 'First Value', standard: true, reduce: calculateFirst },\n {\n id: ReducerID.firstNotNull,\n name: 'First',\n description: 'First non-null value',\n standard: true,\n reduce: calculateFirstNotNull,\n },\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\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();\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 { FieldMatcherID } from './ids';\nimport { FieldMatcherInfo } from '../../types/transformations';\n\n// General Field matcher\nconst fieldTypeMatcher: FieldMatcherInfo = {\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 { MatcherID } from './ids';\nimport { getFieldMatcher, fieldMatchers, getFrameMatchers, frameMatchers } from '../matchers';\nimport { FieldMatcherInfo, MatcherConfig, FrameMatcherInfo } from '../../types/transformations';\n\nconst anyFieldMatcher: FieldMatcherInfo = {\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 = {\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 = {\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 = {\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 = {\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 = {\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 { DataFrame } from '../../types/dataFrame';\nimport { FrameMatcherID } from './ids';\nimport { FrameMatcherInfo } from '../../types/transformations';\nimport { stringToJsRegex } from '../../text';\n\n// General Field matcher\nconst refIdMacher: FrameMatcherInfo = {\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 { FieldMatcherID } from './ids';\nimport { FieldMatcherInfo } from '../../types/transformations';\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';\nimport { BasicValueMatcherOptions } from './types';\n\nconst isEqualValueMatcher: ValueMatcherInfo = {\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 = {\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';\nimport { ValueMatcherOptions } from './types';\n\nconst isNullValueMatcher: ValueMatcherInfo = {\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 = {\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';\nimport { BasicValueMatcherOptions } from './types';\n\nconst isGreaterValueMatcher: ValueMatcherInfo> = {\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> = {\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> = {\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> = {\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';\nimport { RangeValueMatcherOptions } from './types';\n\nconst isBetweenValueMatcher: ValueMatcherInfo> = {\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';\nimport { BasicValueMatcherOptions } from './types';\n\nconst regexValueMatcher: ValueMatcherInfo> = {\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 { seriesToColumnsTransformer } from './seriesToColumns';\nimport { DataFrame } from '../../types/dataFrame';\nimport { getTimeField } from '../../dataframe/processDataFrame';\nimport { SynchronousDataTransformerInfo } from '../../types/transformations';\nimport { DataTransformerID } from './ids';\nimport { map } from 'rxjs/operators';\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 { noopTransformer } from './noop';\nimport { DataFrame, Field } from '../../types/dataFrame';\nimport { DataTransformerID } from './ids';\nimport { DataTransformerInfo, MatcherConfig } from '../../types/transformations';\nimport { getFieldMatcher, getFrameMatchers } from '../matchers';\n\nexport interface FilterOptions {\n include?: MatcherConfig;\n exclude?: MatcherConfig;\n}\n\nexport const filterFieldsTransformer: DataTransformerInfo = {\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 = {\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 { DataTransformerID } from './ids';\nimport { DataTransformerInfo, MatcherConfig } from '../../types/transformations';\nimport { FieldMatcherID } from '../matchers/ids';\nimport { filterFieldsTransformer } from './filter';\nimport { RegexpOrNamesMatcherOptions } from '../matchers/nameMatcher';\n\nexport interface FilterFieldsByNameTransformerOptions {\n include?: RegexpOrNamesMatcherOptions;\n exclude?: RegexpOrNamesMatcherOptions;\n}\n\nexport const filterFieldsByNameTransformer: DataTransformerInfo = {\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 { DataTransformerID } from './ids';\nimport { filterFramesTransformer, FilterOptions } from './filter';\nimport { DataTransformerInfo } from '../../types/transformations';\nimport { FrameMatcherID } from '../matchers/ids';\n\nexport interface FilterFramesByRefIdTransformerOptions {\n include?: string;\n exclude?: string;\n}\n\nexport const filterFramesByRefIdTransformer: DataTransformerInfo = {\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 extractFields = 'extractFields',\n}\n","import { DataFrame, Field, FieldMatcher, FieldType, Vector } from '../../types';\nimport { ArrayVector } from '../../vector';\nimport { fieldMatchers } from '../matchers';\nimport { FieldMatcherID } from '../matchers/ids';\nimport { getTimeField, sortDataFrame } from '../../dataframe';\n\nexport function pickBestJoinField(data: DataFrame[]): FieldMatcher {\n const { timeField } = getTimeField(data[0]);\n if (timeField) {\n return fieldMatchers.get(FieldMatcherID.firstTimeField).get({});\n }\n let common: string[] = [];\n for (const f of data[0].fields) {\n if (f.type === FieldType.number) {\n common.push(f.name);\n }\n }\n\n for (let i = 1; i < data.length; i++) {\n const names: string[] = [];\n for (const f of data[0].fields) {\n if (f.type === FieldType.number) {\n names.push(f.name);\n }\n }\n common = common.filter((v) => !names.includes(v));\n }\n\n return fieldMatchers.get(FieldMatcherID.byName).get(common[0]);\n}\n\n/**\n * @alpha\n */\nexport interface JoinOptions {\n /**\n * The input fields\n */\n frames: DataFrame[];\n\n /**\n * The field to join -- frames that do not have this field will be droppped\n */\n joinBy?: FieldMatcher;\n\n /**\n * Optionally filter the non-join fields\n */\n keep?: FieldMatcher;\n\n /**\n * When the result is a single frame, this will to a quick check to see if the values are sorted,\n * and sort if necessary. If the first/last values are in order the whole vector is assumed to be\n * sorted\n */\n enforceSort?: boolean;\n\n /**\n * @internal -- used when we need to keep a reference to the original frame/field index\n */\n keepOriginIndices?: boolean;\n}\n\nfunction getJoinMatcher(options: JoinOptions): FieldMatcher {\n return options.joinBy ?? pickBestJoinField(options.frames);\n}\n\n/**\n * This will return a single frame joined by the first matching field. When a join field is not specified,\n * the default will use the first time field\n */\nexport function outerJoinDataFrames(options: JoinOptions): DataFrame | undefined {\n if (!options.frames?.length) {\n return;\n }\n\n if (options.frames.length === 1) {\n let frame = options.frames[0];\n let frameCopy = frame;\n\n const joinFieldMatcher = getJoinMatcher(options);\n let joinIndex = frameCopy.fields.findIndex((f) => joinFieldMatcher(f, frameCopy, options.frames));\n\n if (options.keepOriginIndices) {\n frameCopy = {\n ...frame,\n fields: frame.fields.map((f, fieldIndex) => {\n const copy = { ...f };\n const origin = {\n frameIndex: 0,\n fieldIndex,\n };\n if (copy.state) {\n copy.state.origin = origin;\n } else {\n copy.state = { origin };\n }\n return copy;\n }),\n };\n\n // Make sure the join field is first\n if (joinIndex > 0) {\n const joinField = frameCopy.fields[joinIndex];\n const fields = frameCopy.fields.filter((f, idx) => idx !== joinIndex);\n fields.unshift(joinField);\n frameCopy.fields = fields;\n joinIndex = 0;\n }\n }\n\n if (options.enforceSort) {\n if (joinIndex >= 0) {\n if (!isLikelyAscendingVector(frameCopy.fields[joinIndex].values)) {\n frameCopy = sortDataFrame(frameCopy, joinIndex);\n }\n }\n }\n\n if (options.keep) {\n let fields = frameCopy.fields.filter(\n (f, fieldIdx) => fieldIdx === joinIndex || options.keep!(f, frameCopy, options.frames)\n );\n\n // mutate already copied frame\n if (frame !== frameCopy) {\n frameCopy.fields = fields;\n } else {\n frameCopy = {\n ...frame,\n fields,\n };\n }\n }\n\n return frameCopy;\n }\n\n const nullModes: JoinNullMode[][] = [];\n const allData: AlignedData[] = [];\n const originalFields: Field[] = [];\n const joinFieldMatcher = getJoinMatcher(options);\n\n for (let frameIndex = 0; frameIndex < options.frames.length; frameIndex++) {\n const frame = options.frames[frameIndex];\n\n if (!frame || !frame.fields?.length) {\n continue; // skip the frame\n }\n\n const nullModesFrame: JoinNullMode[] = [NULL_REMOVE];\n let join: Field | undefined = undefined;\n let fields: Field[] = [];\n\n for (let fieldIndex = 0; fieldIndex < frame.fields.length; fieldIndex++) {\n const field = frame.fields[fieldIndex];\n field.state = field.state || {};\n\n if (!join && joinFieldMatcher(field, frame, options.frames)) {\n join = field;\n } else {\n if (options.keep && !options.keep(field, frame, options.frames)) {\n continue; // skip field\n }\n\n // Support the standard graph span nulls field config\n let spanNulls = field.config.custom?.spanNulls;\n nullModesFrame.push(spanNulls === true ? NULL_REMOVE : spanNulls === -1 ? NULL_RETAIN : NULL_EXPAND);\n\n let labels = field.labels ?? {};\n if (frame.name) {\n labels = { ...labels, name: frame.name };\n }\n\n fields.push({\n ...field,\n labels, // add the name label from frame\n });\n }\n\n if (options.keepOriginIndices) {\n field.state.origin = {\n frameIndex,\n fieldIndex,\n };\n }\n }\n\n if (!join) {\n continue; // skip the frame\n }\n\n if (originalFields.length === 0) {\n originalFields.push(join); // first join field\n }\n\n nullModes.push(nullModesFrame);\n const a: AlignedData = [join.values.toArray()]; //\n\n for (const field of fields) {\n a.push(field.values.toArray());\n originalFields.push(field);\n // clear field displayName state\n delete field.state?.displayName;\n }\n\n allData.push(a);\n }\n\n const joined = join(allData, nullModes);\n\n return {\n // ...options.data[0], // keep name, meta?\n length: joined[0].length,\n fields: originalFields.map((f, index) => ({\n ...f,\n values: new ArrayVector(joined[index]),\n })),\n };\n}\n\n//--------------------------------------------------------------------------------\n// Below here is copied from uplot (MIT License)\n// https://github.com/leeoniya/uPlot/blob/master/src/utils.js#L325\n// This avoids needing to import uplot into the data package\n//--------------------------------------------------------------------------------\n\n// Copied from uplot\nexport type AlignedData = [number[], ...Array>];\n\n// nullModes\nconst NULL_REMOVE = 0; // nulls are converted to undefined (e.g. for spanGaps: true)\nconst NULL_RETAIN = 1; // nulls are retained, with alignment artifacts set to undefined (default)\nconst NULL_EXPAND = 2; // nulls are expanded to include any adjacent alignment artifacts\n\ntype JoinNullMode = number; // NULL_IGNORE | NULL_RETAIN | NULL_EXPAND;\n\n// sets undefined values to nulls when adjacent to existing nulls (minesweeper)\nfunction nullExpand(yVals: Array, nullIdxs: number[], alignedLen: number) {\n for (let i = 0, xi, lastNullIdx = -1; i < nullIdxs.length; i++) {\n let nullIdx = nullIdxs[i];\n\n if (nullIdx > lastNullIdx) {\n xi = nullIdx - 1;\n while (xi >= 0 && yVals[xi] == null) {\n yVals[xi--] = null;\n }\n\n xi = nullIdx + 1;\n while (xi < alignedLen && yVals[xi] == null) {\n yVals[(lastNullIdx = xi++)] = null;\n }\n }\n }\n}\n\n// nullModes is a tables-matched array indicating how to treat nulls in each series\nexport function join(tables: AlignedData[], nullModes?: number[][]) {\n const xVals = new Set();\n\n for (let ti = 0; ti < tables.length; ti++) {\n let t = tables[ti];\n let xs = t[0];\n let len = xs.length;\n\n for (let i = 0; i < len; i++) {\n xVals.add(xs[i]);\n }\n }\n\n let data = [Array.from(xVals).sort((a, b) => a - b)];\n\n let alignedLen = data[0].length;\n\n let xIdxs = new Map();\n\n for (let i = 0; i < alignedLen; i++) {\n xIdxs.set(data[0][i], i);\n }\n\n for (let ti = 0; ti < tables.length; ti++) {\n let t = tables[ti];\n let xs = t[0];\n\n for (let si = 1; si < t.length; si++) {\n let ys = t[si];\n\n let yVals = Array(alignedLen).fill(undefined);\n\n let nullMode = nullModes ? nullModes[ti][si] : NULL_RETAIN;\n\n let nullIdxs = [];\n\n for (let i = 0; i < ys.length; i++) {\n let yVal = ys[i];\n let alignedIdx = xIdxs.get(xs[i]);\n\n if (yVal === null) {\n if (nullMode !== NULL_REMOVE) {\n yVals[alignedIdx] = yVal;\n\n if (nullMode === NULL_EXPAND) {\n nullIdxs.push(alignedIdx);\n }\n }\n } else {\n yVals[alignedIdx] = yVal;\n }\n }\n\n nullExpand(yVals, nullIdxs, alignedLen);\n\n data.push(yVals);\n }\n }\n\n return data;\n}\n\n// Quick test if the first and last points look to be ascending\n// Only exported for tests\nexport function isLikelyAscendingVector(data: Vector): boolean {\n let first: any = undefined;\n\n for (let idx = 0; idx < data.length; idx++) {\n const v = data.get(idx);\n if (v != null) {\n if (first != null) {\n if (first > v) {\n return false; // descending\n }\n break;\n }\n first = v;\n }\n }\n\n let idx = data.length - 1;\n while (idx >= 0) {\n const v = data.get(idx--);\n if (v != null) {\n if (first > v) {\n return false;\n }\n return true;\n }\n }\n\n return true; // only one non-null point\n}\n","import { map } from 'rxjs/operators';\n\nimport { DataTransformerID } from './ids';\nimport { DataTransformerInfo } from '../../types/transformations';\nimport { DataFrame, Field } from '../../types/dataFrame';\nimport { omit } from 'lodash';\nimport { ArrayVector } from '../../vector/ArrayVector';\nimport { MutableDataFrame } from '../../dataframe';\n\ninterface ValuePointer {\n key: string;\n index: number;\n}\n\nexport interface MergeTransformerOptions {}\n\nexport const mergeTransformer: DataTransformerInfo = {\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();\n const fieldIndexByName: Record> = {};\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>> = {};\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>,\n keyFieldNames: string[]\n) => {\n const factoryIndex = keyFieldNames.reduce((index: Record, fieldName) => {\n return Object.keys(fieldPointerByName[fieldName]).reduce((index: Record, 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,\n fieldIndexByName: Record>\n) => {\n return (frameIndex: number, valueIndex: number) => {\n const value: Record = {};\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, value: Record): 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>,\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>>): ValuePointer => {\n return {\n key,\n index: valuesByKey[key].length - 1,\n };\n};\n","import { DataTransformerID } from './ids';\nimport { DataTransformerInfo } from '../../types/transformations';\n\nexport interface NoopTransformerOptions {\n include?: string;\n exclude?: string;\n}\n\nexport const noopTransformer: DataTransformerInfo = {\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 { DataTransformerID } from './ids';\nimport { DataTransformerInfo } from '../../types/transformations';\nimport { orderFieldsTransformer, OrderFieldsTransformerOptions } from './order';\nimport { filterFieldsByNameTransformer } from './filterByName';\nimport { renameFieldsTransformer, RenameFieldsTransformerOptions } from './rename';\n\nexport interface OrganizeFieldsTransformerOptions\n extends OrderFieldsTransformerOptions,\n RenameFieldsTransformerOptions {\n excludeByName: Record;\n}\n\nexport const organizeFieldsTransformer: DataTransformerInfo = {\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[] => {\n if (!excludeByName) {\n return [];\n }\n\n return Object.keys(excludeByName).filter((name) => excludeByName[name]);\n};\n","import { DataTransformerID } from './ids';\nimport { DataTransformerInfo } from '../../types/transformations';\nimport { DataFrame, Field } from '../../types/dataFrame';\nimport { getFieldDisplayName } from '../../field/fieldState';\nimport { map } from 'rxjs/operators';\n\nexport interface RenameFieldsTransformerOptions {\n renameByName: Record;\n}\n\nexport const renameFieldsTransformer: DataTransformerInfo = {\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 = (renameByName: Record) => (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 { DataTransformerID } from './ids';\nimport { outerJoinDataFrames } from './joinDataFrames';\nimport { fieldMatchers } from '../matchers';\nimport { FieldMatcherID } from '../matchers/ids';\n\nexport interface SeriesToColumnsOptions {\n byField?: string; // empty will pick the field automatically\n}\n\nexport const seriesToColumnsTransformer: SynchronousDataTransformerInfo = {\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 { DataTransformerID } from './ids';\nimport { DataTransformerInfo } from '../../types/transformations';\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 { isTimeSeries } from '../../dataframe/utils';\nimport { MutableDataFrame, sortDataFrame } from '../../dataframe';\nimport { ArrayVector } from '../../vector';\nimport { getFrameDisplayName } from '../../field/fieldState';\n\nexport interface SeriesToRowsTransformerOptions {}\n\nexport const seriesToRowsTransformer: DataTransformerInfo = {\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 = {};\n const targetFields = new Set();\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 { DataTransformerID } from './ids';\nimport { DataTransformerInfo } from '../../types/transformations';\nimport { DataFrame } from '../../types';\nimport { getFieldDisplayName } from '../../field';\nimport { sortDataFrame } from '../../dataframe';\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 = {\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 { DataFrameDTO, FieldConfig } from './dataFrame';\nimport { DataTransformerConfig } from './transformations';\nimport { ApplyFieldOverrideOptions } from './fieldOverrides';\nimport { PanelPluginDataSupport } from '.';\nimport { DataTopic } from './query';\nimport { DataFrameType } from './dataFrameTypes';\n\nexport type KeyValue = Record;\n\n/**\n * Represent panel data loading state.\n * @public\n */\nexport enum LoadingState {\n NotStarted = 'NotStarted',\n Loading = 'Loading',\n Streaming = 'Streaming',\n Done = 'Done',\n Error = 'Error',\n}\n\n// Should be kept in sync with grafana-plugin-sdk-go/data/frame_meta.go\nexport type PreferredVisualisationType = 'graph' | 'table' | 'logs' | 'trace' | 'nodeGraph';\n\n/**\n * @public\n */\nexport interface QueryResultMeta {\n type?: DataFrameType;\n\n /** DatasSource Specific Values */\n custom?: Record;\n\n /** Stats */\n stats?: QueryResultMetaStat[];\n\n /** Meta Notices */\n notices?: QueryResultMetaNotice[];\n\n /** Used to track transformation ids that where part of the processing */\n transformations?: string[];\n\n /** Currently used to show results in Explore only in preferred visualisation option */\n preferredVisualisationType?: PreferredVisualisationType;\n\n /** The path for live stream updates for this frame */\n channel?: string;\n\n /**\n * Optionally identify which topic the frame should be assigned to.\n * A value specified in the response will override what the request asked for.\n */\n dataTopic?: DataTopic;\n\n /**\n * This is the raw query sent to the underlying system. All macros and templating\n * as been applied. When metadata contains this value, it will be shown in the query inspector\n */\n executedQueryString?: string;\n\n /**\n * A browsable path on the datasource\n */\n path?: string;\n\n /**\n * defaults to '/'\n */\n pathSeparator?: string;\n\n /**\n * Legacy data source specific, should be moved to custom\n * */\n alignmentPeriod?: number; // used by cloud monitoring\n searchWords?: string[]; // used by log models and loki\n limit?: number; // used by log models and loki\n json?: boolean; // used to keep track of old json doc values\n instant?: boolean;\n}\n\nexport interface QueryResultMetaStat extends FieldConfig {\n displayName: string;\n value: number;\n}\n\n/**\n * QueryResultMetaNotice is a structure that provides user notices for query result data\n * @public\n */\nexport interface QueryResultMetaNotice {\n /**\n * Specify the notice severity\n */\n severity: 'info' | 'warning' | 'error';\n\n /**\n * Notice descriptive text\n */\n text: string;\n\n /**\n * An optional link that may be displayed in the UI.\n * This value may be an absolute URL or relative to grafana root\n */\n link?: string;\n\n /**\n * Optionally suggest an appropriate tab for the panel inspector\n */\n inspect?: 'meta' | 'error' | 'data' | 'stats';\n}\n\n/**\n * @public\n */\nexport interface QueryResultBase {\n /**\n * Matches the query target refId\n */\n refId?: string;\n\n /**\n * Used by some backend data sources to communicate back info about the execution (generated sql, timing)\n */\n meta?: QueryResultMeta;\n}\n\nexport interface Labels {\n [key: string]: string;\n}\nexport interface Column {\n text: string; // For a Column, the 'text' is the field name\n filterable?: boolean;\n unit?: string;\n custom?: Record;\n}\n\nexport interface TableData extends QueryResultBase {\n name?: string;\n columns: Column[];\n rows: any[][];\n type?: string;\n}\n\nexport type TimeSeriesValue = number | null;\n\nexport type TimeSeriesPoints = TimeSeriesValue[][];\n\nexport interface TimeSeries extends QueryResultBase {\n target: string;\n /**\n * If name is manually configured via an alias / legend pattern\n */\n title?: string;\n datapoints: TimeSeriesPoints;\n unit?: string;\n tags?: Labels;\n}\n\nexport enum NullValueMode {\n Null = 'null',\n Ignore = 'connected',\n AsZero = 'null as zero',\n}\n\n/**\n * Describes and API for exposing panel specific data configurations.\n */\nexport interface DataConfigSource {\n configRev?: number;\n getDataSupport: () => PanelPluginDataSupport;\n getTransformations: () => DataTransformerConfig[] | undefined;\n getFieldOverrideOptions: () => ApplyFieldOverrideOptions | undefined;\n snapshotData?: DataFrameDTO[];\n}\n","import { ThresholdsConfig } from './thresholds';\nimport { ValueMapping } from './valueMapping';\nimport { QueryResultBase, Labels, NullValueMode } from './data';\nimport { DisplayProcessor, DisplayValue } from './displayValue';\nimport { DataLink, LinkModel } from './dataLink';\nimport { Vector } from './vector';\nimport { FieldColor } from './fieldColor';\nimport { ScopedVars } from './ScopedVars';\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 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 {\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 // 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> {\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 text to the field value\n */\n parse?: (value: any) => T;\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>;\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/** @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 {\n name: string; // The column name\n type?: FieldType;\n config?: FieldConfig;\n values?: Vector | 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;\n}\n\nexport interface FieldCalcs extends Record {}\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 index?: number;\n}\n\n/**\n * @alpha\n */\ninterface BaseValueMap {\n type: MappingType;\n options: T;\n}\n\n/**\n * @alpha\n */\nexport interface ValueMap extends BaseValueMap> {\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 {\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 {\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 {\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 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>;\n current: Array>;\n}\n\nexport class Registry {\n private ordered: T[] = [];\n private byId = new Map();\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> = {};\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(() => {\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 { Field, FieldType } from '../types/dataFrame';\nimport { guessFieldTypeFromValue } from '../dataframe/processDataFrame';\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(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 { toFixed, FormattedValue } from './valueFormats';\nimport { DecimalCount } from '../types/displayValue';\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 {\n locale,\n scaledUnits,\n simpleCountUnit,\n toFixedUnit,\n ValueFormatCategory,\n stringFormater,\n booleanValueFormatter,\n} from './valueFormats';\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 { toHex, sci, toHex0x, toPercent, toPercentUnit } from './arithmeticFormatters';\nimport { binaryPrefix, currency, SIPrefix } from './symbolFormatters';\n\nexport const getCategories = (): ValueFormatCategory[] => [\n {\n name: 'Misc',\n formats: [\n { name: 'none', 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: 'mibibytes/sec', id: 'MiBs', fn: binaryPrefix('B/s', 2) },\n { name: 'mibibits/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: 'petibytes/sec', id: 'PiBs', fn: binaryPrefix('B/s', 5) },\n { name: 'petibits/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 { toDuration as duration, toUtc, dateTime } from '../datetime/moment_wrapper';\n\nimport { toFixed, toFixedScaled, FormattedValue, ValueFormatter } from './valueFormats';\nimport { DecimalCount } from '../types/displayValue';\nimport { TimeZone } from '../types';\nimport { dateTimeFormat, dateTimeFormatTimeAgo, localTimeFormat, systemDateFormats } from '../datetime';\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 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 const units = [\n { long: Interval.Year },\n { long: Interval.Month },\n { long: Interval.Week },\n { long: Interval.Day },\n { long: Interval.Hour },\n { long: Interval.Minute },\n { long: Interval.Second },\n { long: Interval.Millisecond },\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].long] * 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].long + (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 { scaledUnits, ValueFormatter } from './valueFormats';\nimport { DecimalCount } from '../types/displayValue';\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\nexport function getOffsetFromSIPrefix(c: string): number {\n switch (c) {\n case 'f':\n return -5;\n case 'p':\n return -4;\n case 'n':\n return -3;\n case 'μ': // Two different unicode chars for µ\n case 'µ':\n return -2;\n case 'm':\n return -1;\n case '':\n return 0;\n case 'k':\n return 1;\n case 'M':\n return 2;\n case 'G':\n return 3;\n case 'T':\n return 4;\n case 'P':\n return 5;\n case 'E':\n return 6;\n case 'Z':\n return 7;\n case 'Y':\n return 8;\n }\n return 0;\n}\n\nexport function binaryPrefix(unit: string, offset = 0): ValueFormatter {\n const prefixes = ['', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi', 'Yi'].slice(offset);\n const units = prefixes.map((p) => {\n return ' ' + p + unit;\n });\n return scaledUnits(1024, units);\n}\n\nexport function SIPrefix(unit: string, offset = 0): ValueFormatter {\n let prefixes = ['f', 'p', 'n', 'µ', 'm', '', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'];\n prefixes = prefixes.slice(5 + (offset || 0));\n const units = prefixes.map((p) => {\n return ' ' + p + unit;\n });\n return scaledUnits(1000, units);\n}\n","import { MutableVector } from '../types/vector';\nimport { FunctionalVector } from './FunctionalVector';\n\n/**\n * @public\n */\nexport class ArrayVector extends FunctionalVector implements MutableVector {\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';\nimport { FunctionalVector } from './FunctionalVector';\n\n/**\n * This will force all values to be numbers\n *\n * @public\n */\nexport class AsNumberVector extends FunctionalVector {\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 { vectorToArray } from './vectorToArray';\nimport { BinaryOperation } from '../utils/binaryOperators';\n\n/**\n * @public\n */\nexport class BinaryOperationVector implements Vector {\n constructor(private left: Vector, private right: Vector, 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 implements Vector {\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(this.length);\n return arr.fill(this.value);\n }\n\n toJSON(): T[] {\n return this.toArray();\n }\n}\n","import { Vector } from '../types';\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';\nimport { vectorToArray } from './vectorToArray';\n\n/**\n * Values are returned in the order defined by the input parameter\n */\nexport class SortedVector implements Vector {\n constructor(private source: Vector, 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(v: Vector): 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) {\n message = error.data.message;\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 {\n LiveChannelStatusEvent,\n LiveChannelEvent,\n LiveChannelEventType,\n LiveChannelConnectionState,\n LiveChannelPresenceStatus,\n LiveChannelAddress,\n DataFrameJSON,\n isValidLiveChannelAddress,\n} from '@grafana/data';\nimport Centrifuge, {\n JoinLeaveContext,\n PublicationContext,\n SubscribeErrorContext,\n SubscribeSuccessContext,\n SubscriptionEvents,\n UnsubscribeContext,\n} from 'centrifuge/dist/centrifuge';\n\nimport { Subject, of, Observable } from 'rxjs';\n\n/**\n * Internal class that maps Centrifuge support to GrafanaLive\n */\nexport class CentrifugeLiveChannel {\n readonly currentStatus: LiveChannelStatusEvent;\n\n readonly opened = Date.now();\n readonly id: string;\n readonly addr: LiveChannelAddress;\n\n readonly stream = new Subject>();\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 recieved 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.error;\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 subscriber.next({ ...this.currentStatus });\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>;\n }\n\n /**\n * This is configured by the server when the config supports presence\n */\n async getPresence(): Promise {\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(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 { LiveDataStreamOptions } from '@grafana/runtime';\nimport { toDataQueryError } from '@grafana/runtime/src/utils/toDataQueryError';\nimport { BehaviorSubject, Observable } from 'rxjs';\nimport {\n DataFrame,\n DataFrameJSON,\n dataFrameToJSON,\n DataQueryResponse,\n isLiveChannelMessageEvent,\n isLiveChannelStatusEvent,\n LiveChannelAddress,\n LiveChannelConnectionState,\n LiveChannelEvent,\n LiveChannelPresenceStatus,\n LoadingState,\n StreamingDataFrame,\n toDataFrameDTO,\n} from '@grafana/data';\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;\n};\n\nexport interface CentrifugeSrv {\n /**\n * Listen for changes to the connection state\n */\n getConnectionState(): Observable;\n\n /**\n * Watch for messages in a channel\n */\n getStream(address: LiveChannelAddress): Observable>;\n\n /**\n * Connect to a channel and return results as DataFrames\n */\n getDataStream(options: LiveDataStreamOptions): Observable;\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(address: LiveChannelAddress): Promise;\n}\n\nexport class CentrifugeService implements CentrifugeSrv {\n readonly open = new Map();\n readonly centrifuge: Centrifuge;\n readonly connectionState: BehaviorSubject;\n readonly connectionBlocker: Promise;\n private dataStreamSubscriberReady = true;\n\n constructor(private deps: CentrifugeSrvDeps) {\n deps.dataStreamSubscriberReadiness.subscribe((next) => (this.dataStreamSubscriberReady = next));\n const liveUrl = `${deps.appUrl.replace(/^http/, 'ws')}/api/live/ws`;\n this.centrifuge = new Centrifuge(liveUrl, {});\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(this.centrifuge.isConnected());\n this.connectionBlocker = new Promise((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(addr: LiveChannelAddress): CentrifugeLiveChannel {\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 initalized channel\n return channel;\n }\n\n private async initChannel(channel: CentrifugeLiveChannel): Promise {\n const events = channel.initalize();\n if (!this.centrifuge.isConnected()) {\n await this.connectionBlocker;\n }\n channel.subscription = this.centrifuge.subscribe(channel.id, events);\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(address: LiveChannelAddress): Observable> {\n return this.getChannel(address).getStream();\n }\n\n /**\n * Connect to a channel and return results as DataFrames\n */\n getDataStream(options: LiveDataStreamOptions): Observable {\n return new Observable((subscriber) => {\n const channel = this.getChannel(options.addr);\n const key = options.key ?? `xstr/${streamCounter++}`;\n let data: StreamingDataFrame | undefined = undefined;\n let filtered: DataFrame | undefined = undefined;\n let state = LoadingState.Streaming;\n let lastWidth = -1;\n\n const process = (msg: DataFrameJSON) => {\n if (!data) {\n data = new StreamingDataFrame(msg, options.buffer);\n } else {\n data.push(msg);\n }\n state = LoadingState.Streaming;\n const sameWidth = lastWidth === data.fields.length;\n lastWidth = data.fields.length;\n\n // Filter out fields\n if (!filtered || msg.schema || !sameWidth) {\n filtered = data;\n if (options.filter) {\n const { fields } = options.filter;\n if (fields?.length) {\n filtered = {\n ...data,\n fields: data.fields.filter((f) => fields.includes(f.name)),\n };\n }\n }\n }\n\n if (this.dataStreamSubscriberReady) {\n filtered.length = data.length; // make sure they stay up-to-date\n subscriber.next({\n state,\n data: [\n // workaround for serializing issues when sending DataFrame from web worker to the main thread\n // DataFrame is making use of ArrayVectors which are es6 classes and thus not cloneable out of the box\n // `toDataFrameDTO` converts ArrayVectors into native arrays.\n toDataFrameDTO(filtered),\n ],\n key,\n });\n }\n };\n\n if (options.frame) {\n process(dataFrameToJSON(options.frame));\n } else if (channel.lastMessageWithSchema) {\n process(channel.lastMessageWithSchema);\n }\n\n const sub = channel.getStream().subscribe({\n error: (err: any) => {\n console.log('LiveQuery [error]', { err }, options.addr);\n state = LoadingState.Error;\n subscriber.next({ state, data: [data], key, error: toDataQueryError(err) });\n sub.unsubscribe(); // close after error\n },\n complete: () => {\n console.log('LiveQuery [complete]', options.addr);\n if (state !== LoadingState.Error) {\n state = LoadingState.Done;\n }\n // or track errors? subscriber.next({ state, data: [data], key });\n subscriber.complete();\n sub.unsubscribe();\n },\n next: (evt: LiveChannelEvent) => {\n if (isLiveChannelMessageEvent(evt)) {\n process(evt.message);\n return;\n }\n if (isLiveChannelStatusEvent(evt)) {\n if (evt.error) {\n let error = toDataQueryError(evt.error);\n error.message = `Streaming channel error: ${error.message}`;\n state = LoadingState.Error;\n subscriber.next({ state, data: [data], key, error });\n return;\n } else if (\n evt.state === LiveChannelConnectionState.Connected ||\n evt.state === LiveChannelConnectionState.Pending\n ) {\n if (evt.message) {\n process(evt.message);\n }\n return;\n }\n console.log('ignore state', evt);\n }\n },\n });\n\n return () => {\n sub.unsubscribe();\n };\n });\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(address: LiveChannelAddress): Promise {\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 {\n value.start();\n\n return comlink.wrap(value);\n },\n};\ncomlink.transferHandlers.set('SubscriberHandler', subscriberTransferHandler);\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","FieldConfigOptionsRegistry","Registry","fieldIndexComparer","field","reverse","values","type","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","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","sanitize","unsanitizedString","process","error","console","sanitizeUrl","url","braintreeSanitizeUrl","hasAnsiCodes","input","test","escapeHtml","str","String","replace","createV1Theme","theme","oldCommon","typography","fontFamily","sansSerif","monospace","fontFamilyMonospace","size","base","fontSize","xs","sm","md","lg","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","border","radius","shape","borderRadius","width","height","components","panelPadding","panel","padding","panelHeaderHeight","headerHeight","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","colors","background","primary","bg2","secondary","bg3","action","hover","dashboardBg","canvas","bgBlue1","main","bgBlue2","shade","borders","border1","weak","border2","medium","border3","strong","textColors","textStrong","text","maxContrast","textHeading","textSemiWeak","textWeak","textFaint","disabled","textBlue","form","formLabel","formDescription","formInputBg","formInputBgDisabled","disabledBackground","formInputBorder","borderColor","formInputBorderHover","borderHover","formInputBorderActive","formInputBorderInvalid","formInputPlaceholderText","formInputText","formInputDisabledText","disabledText","formFocusOutline","formValidationMessageText","contrastText","formValidationMessageBg","mode","GrafanaThemeType","isDark","isLight","palette","brandPrimary","brandSuccess","success","brandWarning","warning","brandDanger","queryRed","queryGreen","queryPurple","queryOrange","online","warn","critical","bodyBg","panelBg","panelBorder","pageHeaderBg","pageHeaderBorder","dropdownBg","dropdownShadow","dropdownOptionHoverBg","linkDisabled","linkHover","linkExternal","shadows","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","boxShadow","dropdown","tooltip","dashboard","overlay","sidemenu","createComponents","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","first","calculateFirst","firstNotNull","calculateFirstNotNull","min","max","mean","sum","count","range","delta","step","diff","logmin","allIsZero","allIsNull","changeCount","calculateChangeCount","distinctCount","calculateDistinctCount","diffperc","allValues","toArray","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","getJoinMatcher","joinBy","common","includes","pickBestJoinField","outerJoinDataFrames","frameCopy","joinFieldMatcher","joinIndex","findIndex","keepOriginIndices","fieldIndex","origin","frameIndex","joinField","unshift","enforceSort","isLikelyAscendingVector","sortDataFrame","keep","fieldIdx","nullModes","allData","originalFields","nullModesFrame","NULL_REMOVE","spanNulls","custom","NULL_RETAIN","NULL_EXPAND","joined","ArrayVector","nullExpand","yVals","nullIdxs","alignedLen","xi","lastNullIdx","nullIdx","tables","xVals","ti","len","sort","xIdxs","Map","set","t","si","ys","fill","nullMode","yVal","alignedIdx","mergeTransformer","dataFrames","fieldNames","fieldIndexByName","fieldNamesForKey","dataFrame","MutableDataFrame","addField","copyFieldStructure","fieldExistsInAllFrames","valuesByKey","valuesInOrder","keyFactory","createKeyFactory","valueMapper","createValueMapper","key","createPointer","valueWasMerged","existing","isMergable","pointer","omit","fieldPointerByName","keyFieldNames","factoryIndex","fieldName","fieldByName","fieldIndexByFrameIndex","mergable","prop","organizeFieldsTransformer","excludeByName","indexByName","renameByName","mapToExcludeArray","orderFieldsTransformer","renameFieldsTransformer","renamer","createRenamer","renameTo","seriesToRowsTransformer","isTimeSeries","timeFieldByIndex","targetFields","metricField","TIME_SERIES_METRIC_FIELD_NAME","timeFieldIndex","valueFieldIndex","sortByTransformer","attachFieldIndex","desc","sortDataFrames","LoadingState","FieldColorModeId","FALLBACK_COLOR","ThresholdsMode","MappingType","SpecialValueMatch","ordered","byId","initialized","constructor","init","setInit","this","getIfExists","initialize","ext","register","selectOptions","current","select","currentOptions","label","PluginState","ids","found","isEmpty","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","INTERVALS_IN_SECONDS","Year","Month","Week","Day","Hour","Minute","Second","Millisecond","Math","abs","toFixedScaled","scaledDecimals","toDuration","timeScale","units","long","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","getOffsetFromSIPrefix","c","offset","p","prefixes","FunctionalVector","buffer","super","toJSON","AsNumberVector","BinaryOperationVector","left","right","vectorToArray","ConstantVector","RowVector","columns","rowIndex","SortedVector","order","arr","toDataQueryError","err","message","status","statusText","CentrifugeLiveChannel","currentStatus","opened","Date","now","addr","stream","Subject","lastMessageWithSchema","subscription","shutdownCallback","initalized","LiveChannelEventType","timestamp","LiveChannelConnectionState","isValidLiveChannelAddress","initalize","events","publish","ctx","schema","next","sendStatus","log","subscribe","unsubscribe","user","info","leave","disconnectIfNoListeners","observers","disconnect","getStream","Observable","subscriber","setTimeout","presence","then","users","Promise","reject","removeAllListeners","complete","shutdownWithError","CentrifugeService","open","centrifuge","connectionState","connectionBlocker","dataStreamSubscriberReady","deps","dataStreamSubscriberReadiness","liveUrl","appUrl","Centrifuge","setConnectData","sessionId","orgId","liveEnabled","orgRole","connect","BehaviorSubject","isConnected","resolve","connectListener","removeListener","addListener","on","onConnect","onDisconnect","onServerSideMessage","context","getChannel","scope","namespace","path","channel","delete","initChannel","catch","getConnectionState","asObservable","address","getDataStream","streamCounter","filtered","lastWidth","msg","StreamingDataFrame","sameWidth","toDataFrameDTO","dataFrameToJSON","evt","isLiveChannelMessageEvent","isLiveChannelStatusEvent","getPresence","subscriberTransferHandler","canHandle","Subscriber","serialize","obj","comlink","port1","port2","MessageChannel","deserialize","start"],"sourceRoot":""}