{"version":3,"file":"index.cjs","sources":["../../src/services/backendSrv.ts","../../src/services/dataSourceSrv.ts","../../src/services/LocationSrv.ts","../../src/services/EchoSrv.ts","../../src/services/templateSrv.ts","../../src/services/live.ts","../../src/config.ts","../../src/services/LocationService.tsx","../../src/services/appEvents.ts","../../src/services/pluginExtensions/usePluginComponent.ts","../../src/services/pluginExtensions/usePluginComponents.ts","../../src/services/pluginExtensions/usePluginLinks.ts","../../src/services/pluginExtensions/usePluginFunctions.ts","../../src/services/pluginExtensions/getObservablePluginLinks.ts","../../src/services/pluginExtensions/getObservablePluginComponents.ts","../../src/services/pluginExtensions/utils.tsx","../../src/services/user.ts","../../src/services/RuntimeDataSource.ts","../../src/services/ScopesContext.ts","../../src/analytics/types.ts","../../src/utils/plugin.ts","../../src/analytics/utils.ts","../../src/utils/licensing.ts","../../src/utils/logging.ts","../../src/utils/toDataQueryError.ts","../../src/utils/queryResponse.ts","../../src/utils/publicDashboardQueryHandler.ts","../../src/utils/userStorage.tsx","../../src/utils/DataSourceWithBackend.ts","../../src/components/PanelRenderer.tsx","../../src/components/PanelDataErrorView.tsx","../../src/services/QueryRunner.ts","../../src/components/PluginPage.tsx","../../src/components/DataSourcePicker.tsx","../../src/analytics/plugins/eventProperties.ts","../../src/analytics/plugins/usePluginInteractionReporter.ts","../../src/utils/returnToPrevious.ts","../../src/utils/megaMenuOpen.ts","../../src/utils/chromeHeaderHeight.ts","../../src/components/EmbeddedDashboard.tsx","../../src/utils/rbac.ts","../../src/utils/migrationHandler.ts","../../src/components/QueryEditorWithMigration.tsx","../../src/utils/useFavoriteDatasources.ts","../../src/components/FolderPicker.tsx","../../src/services/CorrelationsService.ts"],"sourcesContent":["import { Observable } from 'rxjs';\n\n/**\n * Used to initiate a remote call via the {@link BackendSrv}\n *\n * @public\n */\nexport type BackendSrvRequest = {\n  /**\n   * Request URL\n   */\n  url: string;\n\n  /**\n   * Number of times to retry the remote call if it fails.\n   */\n  retry?: number;\n\n  /**\n   * HTTP headers that should be passed along with the remote call.\n   * Please have a look at {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API | Fetch API}\n   * for supported headers.\n   */\n  headers?: Record<string, any>;\n\n  /**\n   * HTTP verb to perform in the remote call GET, POST, PUT etc.\n   */\n  method?: string;\n\n  /**\n   * Set to false an success application alert box will not be shown for successful PUT, DELETE, POST requests\n   */\n  showSuccessAlert?: boolean;\n\n  /**\n   * Set to false to not show an application alert box for request errors\n   */\n  showErrorAlert?: boolean;\n\n  /**\n   * Provided by the initiator to identify a particular remote call. An example\n   * of this is when a datasource plugin triggers a query. If the request id already\n   * exist the backendSrv will try to cancel and replace the previous call with the\n   * new one.\n   */\n  requestId?: string;\n\n  /**\n   * Set to to true to not include call in query inspector\n   */\n  hideFromInspector?: boolean;\n\n  /**\n   * The data to send\n   */\n  data?: any;\n\n  /**\n   * Query params\n   */\n  params?: Record<string, any>;\n\n  /**\n   * Define how the response object should be parsed.  See:\n   *\n   * https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data\n   *\n   * By default values are json parsed from text\n   */\n  responseType?: 'json' | 'text' | 'arraybuffer' | 'blob';\n\n  /**\n   * Used to cancel an open connection\n   * https://developer.mozilla.org/en-US/docs/Web/API/AbortController\n   */\n  abortSignal?: AbortSignal;\n\n  /**\n   * The credentials read-only property of the Request interface indicates whether the user agent should send cookies from the other domain in the case of cross-origin requests.\n   */\n  credentials?: RequestCredentials;\n\n  /**\n   * @deprecated withCredentials is deprecated in favor of credentials\n   */\n  withCredentials?: boolean;\n\n  /**\n   * Set to true to validate the URL path to prevent path traversal attacks.\n   * Use this when constructing URLs from user input.\n   */\n  validatePath?: boolean;\n};\n\n/**\n * Response for fetch function in {@link BackendSrv}\n *\n * @public\n */\nexport interface FetchResponse<T = any> {\n  data: T;\n  readonly status: number;\n  readonly statusText: string;\n  readonly ok: boolean;\n  readonly headers: Headers;\n  readonly redirected: boolean;\n  readonly type: ResponseType;\n  readonly url: string;\n  readonly config: BackendSrvRequest;\n  readonly traceId?: string;\n}\n\n/**\n * Error type for fetch function in {@link BackendSrv}\n *\n * @public\n */\nexport interface FetchErrorDataProps {\n  message?: string;\n  status?: string;\n  error?: string | any;\n}\n\n/**\n * Error type for fetch function in {@link BackendSrv}\n *\n * @public\n */\nexport interface FetchError<T = any> {\n  status: number;\n  statusText?: string;\n  data: T;\n  message?: string;\n  cancelled?: boolean;\n  isHandled?: boolean;\n  config: BackendSrvRequest;\n  traceId?: string;\n}\n\nexport function isFetchError<T = any>(e: unknown): e is FetchError<T> {\n  return typeof e === 'object' && e !== null && 'status' in e && 'data' in e;\n}\n\n/**\n * Used to communicate via http(s) to a remote backend such as the Grafana backend,\n * a datasource etc. The BackendSrv is using the {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API | Fetch API}\n * under the hood to handle all the communication.\n *\n * The request function can be used to perform a remote call by specifying a {@link BackendSrvRequest}.\n * To make the BackendSrv a bit easier to use we have added a couple of shorthand functions that will\n * use default values executing the request.\n *\n * @remarks\n * By default, Grafana displays an error message alert if the remote call fails. To prevent this from\n * happening `showErrorAlert = true` on the options object.\n *\n * @public\n */\nexport interface BackendSrv {\n  get<T = any>(url: string, params?: any, requestId?: string, options?: Partial<BackendSrvRequest>): Promise<T>;\n  delete<T = unknown>(url: string, data?: unknown, options?: Partial<BackendSrvRequest>): Promise<T>;\n  post<T = any>(url: string, data?: unknown, options?: Partial<BackendSrvRequest>): Promise<T>;\n  patch<T = any>(url: string, data?: unknown, options?: Partial<BackendSrvRequest>): Promise<T>;\n  put<T = any>(url: string, data?: unknown, options?: Partial<BackendSrvRequest>): Promise<T>;\n\n  /**\n   * @deprecated Use the `.fetch()` function instead. If you prefer to work with a promise\n   * wrap the Observable returned by fetch with the lastValueFrom function, or use the get|delete|post|patch|put methods.\n   * This method is going to be private from Grafana 10.\n   */\n  request<T = unknown>(options: BackendSrvRequest): Promise<T>;\n\n  /**\n   * Special function used to communicate with datasources that will emit core\n   * events that the Grafana QueryInspector and QueryEditor is listening for to be able\n   * to display datasource query information. Can be skipped by adding `option.silent`\n   * when initializing the request.\n   *\n   * @deprecated Use the fetch function instead\n   */\n  datasourceRequest<T = unknown>(options: BackendSrvRequest): Promise<FetchResponse<T>>;\n\n  /**\n   * Observable http request interface\n   */\n  fetch<T>(options: BackendSrvRequest): Observable<FetchResponse<T>>;\n\n  /**\n   * Observe each raw chunk in the response.  This is useful when reading values from\n   * a long living HTTP connection like the kubernetes WATCH command.\n   *\n   * Each chunk includes the full response headers and the `data` property is filled with the chunk.\n   */\n  chunked(options: BackendSrvRequest): Observable<FetchResponse<Uint8Array | undefined>>;\n}\n\nlet singletonInstance: BackendSrv;\n\n/**\n * Used during startup by Grafana to set the BackendSrv so it is available\n * via the {@link getBackendSrv} to the rest of the application.\n *\n * @internal\n */\nexport const setBackendSrv = (instance: BackendSrv) => {\n  singletonInstance = instance;\n};\n\n/**\n * Used to retrieve the {@link BackendSrv} that can be used to communicate\n * via http(s) to a remote backend such as the Grafana backend, a datasource etc.\n *\n * @public\n */\nexport const getBackendSrv = (): BackendSrv => singletonInstance;\n","import { ScopedVars, DataSourceApi, DataSourceInstanceSettings, DataSourceRef } from '@grafana/data';\n\nimport { RuntimeDataSource } from './RuntimeDataSource';\n\n/**\n * This is the entry point for communicating with a datasource that is added as\n * a plugin (both external and internal). Via this service you will get access\n * to the {@link @grafana/data#DataSourceApi | DataSourceApi} that have a rich API for\n * communicating with the datasource.\n *\n * @public\n */\nexport interface DataSourceSrv {\n  /**\n   * Returns the requested dataSource. If it cannot be found it rejects the promise.\n   * @param ref - The datasource identifier, it can be a name, UID or DataSourceRef (an object with UID),\n   * @param scopedVars - variables used to interpolate a templated passed as name.\n   */\n  get(ref?: DataSourceRef | string | null, scopedVars?: ScopedVars): Promise<DataSourceApi>;\n\n  /**\n   * Get a list of data sources\n   */\n  getList(filters?: GetDataSourceListFilters): DataSourceInstanceSettings[];\n\n  /**\n   * Get settings and plugin metadata by name or uid\n   */\n  getInstanceSettings(\n    ref?: DataSourceRef | string | null,\n    scopedVars?: ScopedVars\n  ): DataSourceInstanceSettings | undefined;\n\n  /**\n   * Reloads the DataSourceSrv\n   */\n  reload(): void;\n\n  /**\n   * Registers a runtime data source. Make sure your data source uid is unique.\n   */\n  registerRuntimeDataSource(entry: RuntimeDataSourceRegistration): void;\n}\n\nexport interface RuntimeDataSourceRegistration {\n  dataSource: RuntimeDataSource;\n}\n\n/** @public */\nexport interface GetDataSourceListFilters {\n  /** Include mixed data source by setting this to true */\n  mixed?: boolean;\n\n  /** Only return data sources that support metrics response */\n  metrics?: boolean;\n\n  /** Only return data sources that support tracing response */\n  tracing?: boolean;\n\n  /** Only return data sources that support logging response */\n  logs?: boolean;\n\n  /** Only return data sources that support annotations */\n  annotations?: boolean;\n\n  /** Only filter data sources that support alerting */\n  alerting?: boolean;\n\n  /**\n   * By default only data sources that can be queried will be returned. Meaning they have tracing,\n   * metrics, logs or annotations flag set in plugin.json file\n   * */\n  all?: boolean;\n\n  /** Set to true to return dashboard data source */\n  dashboard?: boolean;\n\n  /** Set to true to return data source variables */\n  variables?: boolean;\n\n  /** filter list by plugin  */\n  pluginId?: string;\n\n  /** apply a function to filter */\n  filter?: (dataSource: DataSourceInstanceSettings) => boolean;\n\n  /** Only returns datasources matching the specified types (ie. Loki, Prometheus) */\n  type?: string | string[];\n}\n\nlet singletonInstance: DataSourceSrv;\n\n/**\n * Used during startup by Grafana to set the DataSourceSrv so it is available\n * via the {@link getDataSourceSrv} to the rest of the application.\n *\n * @internal\n */\nexport function setDataSourceSrv(instance: DataSourceSrv) {\n  singletonInstance = instance;\n}\n\n/**\n * Used to retrieve the {@link DataSourceSrv} that is the entry point for communicating with\n * a datasource that is added as a plugin (both external and internal).\n *\n * @public\n */\nexport function getDataSourceSrv(): DataSourceSrv {\n  return singletonInstance;\n}\n","import { UrlQueryMap } from '@grafana/data';\n\n/**\n * @public\n * @deprecated in favor of {@link locationService} and will be removed in Grafana 9\n */\nexport interface LocationUpdate {\n  /**\n   * Target path where you automatically wants to navigate the user.\n   */\n  path?: string;\n\n  /**\n   * Specify this value if you want to add values to the query string of the URL.\n   */\n  query?: UrlQueryMap;\n\n  /**\n   * If set to true, the query argument will be added to the existing URL.\n   */\n  partial?: boolean;\n\n  /**\n   * Used internally to sync the Redux state from Angular to make sure that the Redux location\n   * state is in sync when navigating using the Angular router.\n   *\n   * @remarks\n   * Do not change this unless you are the Angular router.\n   *\n   * @internal\n   */\n  routeParams?: UrlQueryMap;\n\n  /*\n   * If set to true, this will replace URL state (ie. cause no new browser history).\n   */\n  replace?: boolean;\n}\n\n/**\n * If you need to automatically navigate the user to a new place in the application this should\n * be done via the LocationSrv and it will make sure to update the application state accordingly.\n *\n * @public\n * @deprecated in favor of {@link locationService} and will be removed in Grafana 9\n */\nexport interface LocationSrv {\n  update(options: LocationUpdate): void;\n}\n\nlet singletonInstance: LocationSrv;\n\n/**\n * Used during startup by Grafana to set the LocationSrv so it is available\n * via the {@link getLocationSrv} to the rest of the application.\n *\n * @internal\n */\nexport function setLocationSrv(instance: LocationSrv) {\n  singletonInstance = instance;\n}\n\n/**\n * Used to retrieve the {@link LocationSrv} that can be used to automatically navigate\n * the user to a new place in Grafana.\n *\n * @public\n * @deprecated in favor of {@link locationService} and will be removed in Grafana 9\n */\nexport function getLocationSrv(): LocationSrv {\n  return singletonInstance;\n}\n","/**\n * Describes a size with width/height\n *\n * @public\n */\nexport interface SizeMeta {\n  width: number;\n  height: number;\n}\n\n/**\n * Describes the meta information that are sent together with each event.\n *\n * @public\n */\nexport interface EchoMeta {\n  screenSize: SizeMeta;\n  windowSize: SizeMeta;\n  userAgent: string;\n  url?: string;\n  path?: string;\n  /**\n   * A unique browser session\n   */\n  sessionId: string;\n  /**\n   * The current user's username used to login into Grafana e.g. email.\n   */\n  userLogin: string;\n  /**\n   * The current user's unique identifier.\n   */\n  userId: number;\n  /**\n   * True when user is logged in into Grafana.\n   */\n  userSignedIn: boolean;\n  /**\n   * Current user's role\n   */\n  orgRole: string | '';\n  /**\n   * Current user's org\n   */\n  orgId: number;\n  /**\n   * A millisecond epoch\n   */\n  ts: number;\n  /**\n   * A highres timestamp since navigation start\n   */\n  timeSinceNavigationStart: number;\n}\n\n/**\n * Describes echo backends that can be registered to receive of events.\n *\n * @public\n */\nexport interface EchoBackend<T extends EchoEvent = any, O = any> {\n  options: O;\n  supportedEvents: EchoEventType[];\n  flush: () => void;\n  addEvent: (event: T) => void;\n}\n\n/**\n * Describes an echo event.\n *\n * @public\n */\nexport interface EchoEvent<T extends EchoEventType = any, P = any> {\n  type: EchoEventType;\n  /**\n   * Event payload containing event specific data.\n   */\n  payload: P;\n  meta: EchoMeta;\n}\n\n/**\n * Supported echo event types that can be sent via the {@link EchoSrv}.\n *\n * @public\n */\nexport enum EchoEventType {\n  Performance = 'performance',\n  MetaAnalytics = 'meta-analytics',\n  Pageview = 'pageview',\n  Interaction = 'interaction',\n  ExperimentView = 'experimentview',\n  GrafanaJavascriptAgent = 'grafana-javascript-agent',\n}\n\n/**\n * Used to send events to all the registered backends. This should be accessed via the\n * {@link getEchoSrv} function. Will, by default, flush events to the backends every\n * 10s or when the flush function is triggered.\n *\n * @public\n */\nexport interface EchoSrv {\n  /**\n   * Call this to flush current events to the echo backends.\n   */\n  flush(): void;\n  /**\n   * Add a new echo backend to the list of backends that will receive events.\n   */\n  addBackend(backend: EchoBackend): void;\n  /**\n   * Call this to add event that will be sent to the echo backends upon next\n   * flush.\n   *\n   * @param event - Object containing event information.\n   * @param meta - Object that will extend/override the default meta object.\n   */\n  addEvent<T extends EchoEvent>(event: Omit<T, 'meta'>, meta?: {}): void;\n}\n\nlet singletonInstance: EchoSrv;\n\n/**\n * Used during startup by Grafana to set the EchoSrv so it is available\n * via the {@link getEchoSrv} to the rest of the application.\n *\n * @internal\n */\nexport function setEchoSrv(instance: EchoSrv) {\n  // Check if there were any events reported to the FakeEchoSrv (before the main EchoSrv was initialized), and track them\n  if (singletonInstance instanceof FakeEchoSrv) {\n    for (const item of singletonInstance.buffer) {\n      instance.addEvent(item.event, item.meta);\n    }\n  }\n\n  singletonInstance = instance;\n}\n\n/**\n * Used to retrieve the {@link EchoSrv} that can be used to report events to registered\n * echo backends.\n *\n * @public\n */\nexport function getEchoSrv(): EchoSrv {\n  if (!singletonInstance) {\n    singletonInstance = new FakeEchoSrv();\n  }\n\n  return singletonInstance;\n}\n\n/**\n * Used to register echo backends that will receive Grafana echo events during application\n * runtime.\n *\n * @public\n */\nexport const registerEchoBackend = (backend: EchoBackend) => {\n  getEchoSrv().addBackend(backend);\n};\n\nexport class FakeEchoSrv implements EchoSrv {\n  buffer: Array<{ event: Omit<EchoEvent, 'meta'>; meta?: {} | undefined }> = [];\n\n  flush(): void {\n    this.buffer = [];\n  }\n\n  addBackend(backend: EchoBackend): void {}\n\n  addEvent<T extends EchoEvent>(event: Omit<T, 'meta'>, meta?: {} | undefined): void {\n    this.buffer.push({ event, meta });\n  }\n}\n","import { ScopedVars, TimeRange, TypedVariableModel } from '@grafana/data';\n\n/**\n * Can be used to gain more information about an interpolation operation\n */\nexport interface VariableInterpolation {\n  /** The full matched expression including, example: ${varName.field:regex} */\n  match: string;\n  /** In the expression ${varName.field:regex} variableName is varName */\n  variableName: string;\n  /** In the expression ${varName.fields[0].name:regex} the fieldPath is fields[0].name */\n  fieldPath?: string;\n  /** In the expression ${varName:regex} the regex part is the format */\n  format?: string;\n  /** The formatted value of the variable expresion. Will equal match when variable not found or scopedVar was undefined or null **/\n  value: string;\n  // When value === match this will be true, meaning the variable was not found\n  found?: boolean;\n}\n\n/**\n * Via the TemplateSrv consumers get access to all the available template variables\n * that can be used within the current active dashboard.\n *\n * For a more in-depth description visit: https://grafana.com/docs/grafana/latest/reference/templating\n * @public\n */\nexport interface TemplateSrv {\n  /**\n   * List the dashboard variables\n   */\n  getVariables(): TypedVariableModel[];\n\n  /**\n   * Replace the values within the target string.  See also {@link InterpolateFunction}\n   *\n   * Note: interpolations array is being mutated by replace function by adding information about variables that\n   * have been interpolated during replacement. Variables that were specified in the target but not found in\n   * the list of available variables are also added to the array. See {@link VariableInterpolation} for more details.\n   *\n   * @param {VariableInterpolation[]} interpolations an optional map that is updated with interpolated variables\n   */\n  replace(\n    target?: string,\n    scopedVars?: ScopedVars,\n    format?: string | Function,\n    interpolations?: VariableInterpolation[]\n  ): string;\n\n  /**\n   * Checks if a target contains template variables.\n   */\n  containsTemplate(target?: string): boolean;\n\n  /**\n   * Update the current time range to be used when interpolating __from / __to variables.\n   */\n  updateTimeRange(timeRange: TimeRange): void;\n}\n\nlet singletonInstance: TemplateSrv;\n\n/**\n * Used during startup by Grafana to set the TemplateSrv so it is available\n * via the {@link getTemplateSrv} to the rest of the application.\n *\n * @internal\n */\nexport const setTemplateSrv = (instance: TemplateSrv) => {\n  singletonInstance = instance;\n};\n\n/**\n * Used to retrieve the {@link TemplateSrv} that can be used to fetch available\n * template variables.\n *\n * @public\n */\nexport const getTemplateSrv = (): TemplateSrv => singletonInstance;\n","import { Observable } from 'rxjs';\n\nimport {\n  DataFrameJSON,\n  DataQueryRequest,\n  DataQueryResponse,\n  LiveChannelAddress,\n  LiveChannelEvent,\n  LiveChannelPresenceStatus,\n  StreamingFrameOptions,\n} from '@grafana/data';\n\n/**\n * @alpha -- experimental\n */\nexport interface LiveDataFilter {\n  fields?: string[];\n}\n\n// StreamingFrameAction and StreamingFrameOptions are now in @grafana/data\nexport { StreamingFrameAction, type StreamingFrameOptions } from '@grafana/data';\n\n/**\n * @alpha\n */\nexport interface LiveDataStreamOptions {\n  addr: LiveChannelAddress;\n  frame?: DataFrameJSON; // initial results\n  key?: string;\n  buffer?: Partial<StreamingFrameOptions>;\n  filter?: LiveDataFilter;\n}\n\n/**\n * @alpha -- experimental: send a normal query request over websockt\n */\nexport interface LiveQueryDataOptions {\n  request: DataQueryRequest;\n  body: unknown; // processed queries, same as sent to `/api/query/ds`\n}\n\n/**\n * @alpha -- experimental\n */\nexport interface LivePublishOptions {\n  /**\n   * Publish the data over the websocket instead of the HTTP API.\n   *\n   * This is not recommended for most use cases.\n   *\n   * @experimental\n   */\n  useSocket?: boolean;\n}\n\n/**\n * @alpha -- experimental\n */\nexport interface GrafanaLiveSrv {\n  /**\n   * Listen for changes to the main service\n   */\n  getConnectionState(): Observable<boolean>;\n\n  /**\n   * Watch for messages in a channel\n   */\n  getStream<T>(address: LiveChannelAddress): Observable<LiveChannelEvent<T>>;\n\n  /**\n   * Connect to a channel and return results as DataFrames\n   */\n  getDataStream(options: LiveDataStreamOptions): Observable<DataQueryResponse>;\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<LiveChannelPresenceStatus>;\n\n  /**\n   * Publish into a channel\n   *\n   * @alpha -- experimental\n   */\n  publish(address: LiveChannelAddress, data: unknown, options?: LivePublishOptions): Promise<unknown>;\n}\n\nlet singletonInstance: GrafanaLiveSrv;\n\n/**\n * Used during startup by Grafana to set the GrafanaLiveSrv so it is available\n * via the {@link getGrafanaLiveSrv} to the rest of the application.\n *\n * @internal\n */\nexport const setGrafanaLiveSrv = (instance: GrafanaLiveSrv) => {\n  singletonInstance = instance;\n};\n\n/**\n * Used to retrieve the GrafanaLiveSrv that allows you to subscribe to\n * server side events and streams\n *\n * @alpha -- experimental\n */\nexport const getGrafanaLiveSrv = (): GrafanaLiveSrv => singletonInstance;\n","import { merge } from 'lodash';\n\nimport {\n  AppPluginConfig as AppPluginConfigGrafanaData,\n  AuthSettings,\n  AzureSettings as AzureSettingsGrafanaData,\n  BootData,\n  BuildInfo,\n  DataSourceInstanceSettings,\n  FeatureToggles,\n  GrafanaTheme,\n  GrafanaTheme2,\n  LicenseInfo,\n  MapLayerOptions,\n  OAuthSettings,\n  PanelPluginMeta,\n  PreinstalledPlugin as PreinstalledPluginGrafanaData,\n  systemDateFormats,\n  SystemDateFormatSettings,\n  getThemeById,\n  AngularMeta,\n  PluginLoadingStrategy,\n  PluginDependencies,\n  PluginExtensions,\n  TimeOption,\n  UnifiedAlertingConfig,\n  GrafanaConfig,\n  CurrentUserDTO,\n} from '@grafana/data';\n\n/**\n * @deprecated Use the type from `@grafana/data`\n */\n// TODO remove in G13\nexport interface AzureSettings {\n  cloud?: string;\n  clouds?: AzureCloudInfo[];\n  managedIdentityEnabled: boolean;\n  workloadIdentityEnabled: boolean;\n  userIdentityEnabled: boolean;\n  userIdentityFallbackCredentialsEnabled: boolean;\n  azureEntraPasswordCredentialsEnabled: boolean;\n}\n\n/**\n * @deprecated Use the type from `@grafana/data`\n */\n// TODO remove in G13\nexport interface AzureCloudInfo {\n  name: string;\n  displayName: string;\n}\n\n/**\n * @deprecated Use the type from `@grafana/data`\n */\n// TODO remove in G13\nexport type AppPluginConfig = {\n  id: string;\n  path: string;\n  version: string;\n  preload: boolean;\n  angular: AngularMeta;\n  loadingStrategy: PluginLoadingStrategy;\n  dependencies: PluginDependencies;\n  extensions: PluginExtensions;\n  moduleHash?: string;\n};\n\n/**\n * @deprecated Use the type from `@grafana/data`\n */\n// TODO remove in G13\nexport type PreinstalledPlugin = {\n  id: string;\n  version: string;\n};\n\n/**\n * Use to access Grafana config settings in application code.\n * This takes `window.grafanaBootData.settings` as input and returns a config object.\n */\nexport class GrafanaBootConfig {\n  publicDashboardAccessToken?: string;\n  publicDashboardsEnabled = true;\n  snapshotEnabled = true;\n  datasources: { [str: string]: DataSourceInstanceSettings } = {};\n  panels: { [key: string]: PanelPluginMeta } = {};\n  apps: Record<string, AppPluginConfigGrafanaData> = {};\n  auth: AuthSettings = {};\n  minRefreshInterval = '';\n  appUrl = '';\n  appSubUrl = '';\n  namespace = 'default';\n  windowTitlePrefix = 'Grafana - ';\n  buildInfo: BuildInfo = {\n    version: '1.0',\n    commit: '1',\n    env: 'production',\n  } as BuildInfo;\n  bootData: BootData;\n  externalUserMngLinkUrl = '';\n  externalUserMngLinkName = '';\n  externalUserMngInfo = '';\n  externalUserMngAnalytics = false;\n  externalUserMngAnalyticsParams = '';\n  allowOrgCreate = false;\n  feedbackLinksEnabled = true;\n  disableLoginForm = false;\n  defaultDatasource = ''; // UID\n  authProxyEnabled = false;\n  exploreEnabled = false;\n  queryHistoryEnabled = false;\n  helpEnabled = false;\n  profileEnabled = false;\n  newsFeedEnabled = true;\n  ldapEnabled = false;\n  jwtHeaderName = '';\n  jwtUrlLogin = false;\n  sigV4AuthEnabled = false;\n  azureAuthEnabled = false;\n  secureSocksDSProxyEnabled = false;\n  samlEnabled = false;\n  samlName = '';\n  autoAssignOrg = true;\n  verifyEmailEnabled = false;\n  oauth: OAuthSettings = {};\n  rbacEnabled = true;\n  disableUserSignUp = false;\n  loginHint = '';\n  passwordHint = '';\n  loginError?: string;\n  viewersCanEdit = false;\n  disableSanitizeHtml = false;\n  trustedTypesDefaultPolicyEnabled = false;\n  cspReportOnlyEnabled = false;\n  liveEnabled = true;\n  liveMessageSizeLimit = 65536;\n  /** @deprecated Use `theme2` instead. */\n  theme: GrafanaTheme;\n  theme2: GrafanaTheme2;\n  featureToggles: FeatureToggles = {};\n  anonymousEnabled = false;\n  anonymousDeviceLimit?: number;\n  licenseInfo: LicenseInfo = {} as LicenseInfo;\n  rendererAvailable = false;\n  rendererVersion = '';\n  rendererDefaultImageWidth = 1000;\n  rendererDefaultImageHeight = 500;\n  rendererDefaultImageScale = 1;\n  supportBundlesEnabled = false;\n  http2Enabled = false;\n  dateFormats?: SystemDateFormatSettings;\n  grafanaJavascriptAgent = {\n    enabled: false,\n    customEndpoint: '',\n    apiKey: '',\n    allInstrumentationsEnabled: false,\n    errorInstrumentalizationEnabled: true,\n    consoleInstrumentalizationEnabled: false,\n    webVitalsInstrumentalizationEnabled: false,\n    tracingInstrumentalizationEnabled: false,\n  };\n  pluginCatalogURL = 'https://grafana.com/grafana/plugins/';\n  pluginAdminEnabled = true;\n  pluginAdminExternalManageEnabled = false;\n  pluginCatalogHiddenPlugins: string[] = [];\n  pluginCatalogManagedPlugins: string[] = [];\n  pluginCatalogPreinstalledPlugins: PreinstalledPluginGrafanaData[] = [];\n  pluginsCDNBaseURL = '';\n  expressionsEnabled = false;\n  awsAllowedAuthProviders: string[] = [];\n  awsAssumeRoleEnabled = false;\n  azure: AzureSettingsGrafanaData = {\n    managedIdentityEnabled: false,\n    workloadIdentityEnabled: false,\n    userIdentityEnabled: false,\n    userIdentityFallbackCredentialsEnabled: false,\n    azureEntraPasswordCredentialsEnabled: false,\n  };\n  caching = {\n    enabled: false,\n  };\n  geomapDefaultBaseLayerConfig?: MapLayerOptions;\n  geomapDisableCustomBaseLayer?: boolean;\n  unifiedAlertingEnabled = false;\n  unifiedAlerting: UnifiedAlertingConfig = {\n    minInterval: '',\n    stateHistory: {\n      backend: undefined,\n      primary: undefined,\n      prometheusTargetDatasourceUID: undefined,\n      prometheusMetricName: undefined,\n    },\n    recordingRulesEnabled: false,\n    defaultRecordingRulesTargetDatasourceUID: undefined,\n\n    // Backward compatibility fields - populated by backend\n    alertStateHistoryBackend: undefined,\n    alertStateHistoryPrimary: undefined,\n  };\n  applicationInsightsConnectionString?: string;\n  applicationInsightsEndpointUrl?: string;\n  recordedQueries = {\n    enabled: true,\n  };\n  featureHighlights = {\n    enabled: false,\n  };\n  reporting = {\n    enabled: true,\n  };\n  analytics = {\n    enabled: true,\n  };\n  googleAnalyticsId?: string;\n  googleAnalytics4Id?: string;\n  googleAnalytics4SendManualPageViews = false;\n  rudderstackWriteKey?: string;\n  rudderstackDataPlaneUrl?: string;\n  rudderstackSdkUrl?: string;\n  rudderstackConfigUrl?: string;\n  rudderstackIntegrationsUrl?: string;\n  analyticsConsoleReporting = false;\n  dashboardPerformanceMetrics: string[] = [];\n  panelSeriesLimit = 0;\n  sqlConnectionLimits = {\n    maxOpenConns: 100,\n    maxIdleConns: 100,\n    connMaxLifetime: 14400,\n  };\n  defaultDatasourceManageAlertsUiToggle = true;\n  defaultAllowRecordingRulesTargetAlertsUiToggle = true;\n  tokenExpirationDayLimit?: number;\n  enableFrontendSandboxForPlugins: string[] = [];\n  sharedWithMeFolderUID?: string;\n  rootFolderUID?: string;\n  localFileSystemAvailable?: boolean;\n  cloudMigrationIsTarget?: boolean;\n  cloudMigrationPollIntervalMs = 2000;\n  reportingStaticContext?: Record<string, string>;\n  exploreDefaultTimeOffset = '1h';\n  exploreHideLogsDownload?: boolean;\n  quickRanges?: TimeOption[];\n  pluginRestrictedAPIsAllowList?: Record<string, string[]>;\n  pluginRestrictedAPIsBlockList?: Record<string, string[]>;\n\n  /**\n   * Language used in Grafana's UI. This is after the user's preference (or deteceted locale) is resolved to one of\n   * Grafana's supported language.\n   */\n  language: string | undefined;\n\n  /**\n   * regionalFormat used in Grafana's UI. Default to 'es-US' in the backend and overwritten when the user select a different one in SharedPreferences.\n   * This is the regionalFormat that is used for date formatting and other locale-specific features.\n   */\n  regionalFormat: string;\n  listDashboardScopesEndpoint = '';\n  listScopesEndpoint = '';\n\n  constructor(\n    options: BootData['settings'] & {\n      bootData: BootData;\n    }\n  ) {\n    this.bootData = options.bootData;\n\n    merge(this, options);\n\n    if (this.dateFormats) {\n      systemDateFormats.update(this.dateFormats);\n    }\n\n    overrideFeatureTogglesFromUrl(this);\n    overrideFeatureTogglesFromLocalStorage(this);\n\n    // Creating theme after applying feature toggle overrides in case we need to toggle anything\n    this.theme2 = getThemeById(this.bootData.user.theme);\n    this.bootData.user.lightTheme = this.theme2.isLight;\n    this.theme = this.theme2.v1;\n    this.regionalFormat = options.bootData.user.regionalFormat;\n  }\n}\n\n// localstorage key: grafana.featureToggles\n// example value: panelEditor=1,panelInspector=1\nfunction overrideFeatureTogglesFromLocalStorage(config: GrafanaBootConfig) {\n  const featureToggles = config.featureToggles;\n  const localStorageKey = 'grafana.featureToggles';\n  const localStorageValue = window.localStorage.getItem(localStorageKey);\n  if (localStorageValue) {\n    const features = localStorageValue.split(',');\n    for (const feature of features) {\n      const [featureName, featureValue] = feature.split('=');\n      const toggleState = featureValue === 'true' || featureValue === '1';\n      // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n      featureToggles[featureName as keyof FeatureToggles] = toggleState;\n      console.log(`Setting feature toggle ${featureName} = ${toggleState} via localstorage`);\n    }\n  }\n}\n\nfunction overrideFeatureTogglesFromUrl(config: GrafanaBootConfig) {\n  if (window.location.href.indexOf('__feature') === -1) {\n    return;\n  }\n\n  const isDevelopment = config.buildInfo.env === 'development';\n\n  // Although most flags can not be changed from the URL in production,\n  // some of them are safe (and useful!) to change dynamically from the browser URL\n  const safeRuntimeFeatureFlags = new Set(['queryServiceFromUI', 'dashboardSceneSolo']);\n\n  const params = new URLSearchParams(window.location.search);\n  params.forEach((value, key) => {\n    if (key.startsWith('__feature.')) {\n      const featureToggles = config.featureToggles as Record<string, boolean>;\n      const featureName = key.substring(10);\n\n      const toggleState = value === 'true' || value === ''; // browser rewrites true as ''\n      if (toggleState !== featureToggles[key]) {\n        if (isDevelopment || safeRuntimeFeatureFlags.has(featureName)) {\n          featureToggles[featureName] = toggleState;\n          console.log(`Setting feature toggle ${featureName} = ${toggleState} via url`);\n        } else {\n          console.log(`Unable to change feature toggle ${featureName} via url in production.`);\n        }\n      }\n    }\n  });\n}\n\nlet bootData = window.grafanaBootData;\n\nif (!bootData) {\n  if (process.env.NODE_ENV !== 'test') {\n    console.error('window.grafanaBootData was not set by the time config was initialized');\n  }\n\n  bootData = {\n    assets: {\n      dark: '',\n      light: '',\n    },\n    settings: {} as GrafanaConfig,\n    user: {} as CurrentUserDTO,\n    navTree: [],\n  };\n}\n\n/**\n * Use this to access the {@link GrafanaBootConfig} for the current running Grafana instance.\n *\n * @public\n */\nexport const config = new GrafanaBootConfig({\n  ...bootData.settings,\n  // need to separately include bootData here\n  // this allows people to access the user object on config.bootData.user and maintains backwards compatibility\n  // TODO expose a user object (similar to `GrafanaBootConfig`) and deprecate this recursive bootData\n  bootData,\n});\n","import * as H from 'history';\nimport React, { useContext } from 'react';\nimport { BehaviorSubject, Observable } from 'rxjs';\n\nimport { deprecationWarning, UrlQueryMap, urlUtil } from '@grafana/data';\nimport { attachDebugger, createLogger } from '@grafana/ui';\n\nimport { config } from '../config';\n\nimport { LocationUpdate } from './LocationSrv';\n\n/**\n * @public\n * A wrapper to help work with browser location and history\n */\nexport interface LocationService {\n  partial: (query: Record<string, any>, replace?: boolean) => void;\n  push: (location: H.Path | H.LocationDescriptor<any>) => void;\n  replace: (location: H.Path | H.LocationDescriptor<any>) => void;\n  reload: () => void;\n  getLocation: () => H.Location;\n  getHistory: () => H.History;\n  getSearch: () => URLSearchParams;\n  getSearchObject: () => UrlQueryMap;\n  getLocationObservable: () => Observable<H.Location>;\n\n  /**\n   * This is from the old LocationSrv interface\n   * @deprecated use partial, push or replace instead */\n  update: (update: LocationUpdate) => void;\n}\n\n/** @internal */\nexport class HistoryWrapper implements LocationService {\n  private readonly history: H.History;\n  private locationObservable: BehaviorSubject<H.Location>;\n\n  constructor(history?: H.History) {\n    // If no history passed create an in memory one if being called from test\n    this.history =\n      history ||\n      (process.env.NODE_ENV === 'test'\n        ? H.createMemoryHistory({ initialEntries: ['/'] })\n        : H.createBrowserHistory({ basename: config.appSubUrl ?? '/' }));\n\n    this.locationObservable = new BehaviorSubject(this.history.location);\n\n    this.history.listen((location) => {\n      this.locationObservable.next(location);\n    });\n\n    this.partial = this.partial.bind(this);\n    this.push = this.push.bind(this);\n    this.replace = this.replace.bind(this);\n    this.getSearch = this.getSearch.bind(this);\n    this.getHistory = this.getHistory.bind(this);\n    this.getLocation = this.getLocation.bind(this);\n  }\n\n  getLocationObservable() {\n    return this.locationObservable.asObservable();\n  }\n\n  getHistory() {\n    return this.history;\n  }\n\n  getSearch() {\n    return new URLSearchParams(this.history.location.search);\n  }\n\n  partial(query: Record<string, any>, replace?: boolean) {\n    const currentLocation = this.history.location;\n    const newQuery = this.getSearchObject();\n\n    for (const key in query) {\n      // removing params with null | undefined\n      if (query[key] === null || query[key] === undefined) {\n        delete newQuery[key];\n      } else {\n        newQuery[key] = query[key];\n      }\n    }\n\n    const updatedUrl = urlUtil.renderUrl(currentLocation.pathname, newQuery);\n\n    if (replace) {\n      this.history.replace(updatedUrl, this.history.location.state);\n    } else {\n      this.history.push(updatedUrl, this.history.location.state);\n    }\n  }\n\n  push(location: H.Path | H.LocationDescriptor) {\n    this.history.push(location);\n  }\n\n  replace(location: H.Path | H.LocationDescriptor) {\n    this.history.replace(location);\n  }\n\n  reload() {\n    const prevState = (this.history.location.state as any)?.routeReloadCounter;\n    this.history.replace({\n      ...this.history.location,\n      state: { routeReloadCounter: prevState ? prevState + 1 : 1 },\n    });\n  }\n\n  getLocation() {\n    return this.history.location;\n  }\n\n  getSearchObject() {\n    return locationSearchToObject(this.history.location.search);\n  }\n\n  /** @deprecated use partial, push or replace instead */\n  update(options: LocationUpdate) {\n    deprecationWarning('LocationSrv', 'update', 'partial, push or replace');\n    if (options.partial && options.query) {\n      this.partial(options.query, options.partial);\n    } else {\n      const newLocation: H.LocationDescriptor = {\n        pathname: options.path,\n      };\n      if (options.query) {\n        newLocation.search = urlUtil.toUrlParams(options.query);\n      }\n      if (options.replace) {\n        this.replace(newLocation);\n      } else {\n        this.push(newLocation);\n      }\n    }\n  }\n}\n\n/**\n * @public\n * Parses a location search string to an object\n * */\nexport function locationSearchToObject(search: string | number): UrlQueryMap {\n  let queryString = typeof search === 'number' ? String(search) : search;\n\n  if (queryString.length > 0) {\n    if (queryString.startsWith('?')) {\n      return urlUtil.parseKeyValue(queryString.substring(1));\n    }\n    return urlUtil.parseKeyValue(queryString);\n  }\n\n  return {};\n}\n\n/**\n * @public\n */\nexport let locationService: LocationService = new HistoryWrapper();\n\n/**\n * Used for tests only\n * @internal\n */\nexport const setLocationService = (location: LocationService) => {\n  if (process.env.NODE_ENV !== 'test') {\n    throw new Error('locationService can be only overriden in test environment');\n  }\n  locationService = location;\n};\n\nconst navigationLog = createLogger('Router');\n\n/** @internal */\nexport const navigationLogger = navigationLog.logger;\n\n// For debugging purposes the location service is attached to global _debug variable\nattachDebugger('location', locationService, navigationLog);\n\n// Simple context so the location service can be used without being a singleton\nconst LocationServiceContext = React.createContext<LocationService | undefined>(undefined);\n\nexport function useLocationService(): LocationService {\n  const service = useContext(LocationServiceContext);\n  if (!service) {\n    throw new Error('useLocationService must be used within a LocationServiceProvider');\n  }\n  return service;\n}\n\nexport const LocationServiceProvider: React.FC<{ service: LocationService; children: React.ReactNode }> = ({\n  service,\n  children,\n}) => {\n  return <LocationServiceContext.Provider value={service}>{children}</LocationServiceContext.Provider>;\n};\n","import { BusEventBase, BusEventWithPayload, EventBus, GrafanaTheme2, PanelModel, TimeRange } from '@grafana/data';\n\n/**\n * Called when a dashboard is refreshed\n *\n * @public\n */\nexport class RefreshEvent extends BusEventBase {\n  static type = 'refresh';\n}\n\n/**\n * Called when the theme settings change\n *\n * @public\n */\nexport class ThemeChangedEvent extends BusEventWithPayload<GrafanaTheme2> {\n  static type = 'theme-changed';\n}\n\n/**\n * Called when time range is updated\n *\n * @public\n */\nexport class TimeRangeUpdatedEvent extends BusEventWithPayload<TimeRange> {\n  static type = 'time-range-updated';\n}\n\n/**\n * Called to copy a panel JSON into local storage\n *\n * @public\n */\nexport class CopyPanelEvent extends BusEventWithPayload<PanelModel> {\n  static type = 'copy-panel';\n}\n\n// Internal singleton instance\nlet singletonInstance: EventBus;\n\n/**\n * Used during startup by Grafana to set the setAppEvents so it is available\n * via the {@link setAppEvents} to the rest of the application.\n *\n * @internal\n */\nexport function setAppEvents(instance: EventBus) {\n  singletonInstance = instance;\n}\n\n/**\n * Used to retrieve an event bus that manages application level events\n *\n * @public\n */\nexport function getAppEvents(): EventBus {\n  return singletonInstance;\n}\n","export type UsePluginComponent<Props extends object = {}> = (componentId: string) => UsePluginComponentResult<Props>;\n\nexport type UsePluginComponentResult<Props = {}> = {\n  component: React.ComponentType<Props> | undefined | null;\n  isLoading: boolean;\n};\n\nlet singleton: UsePluginComponent | undefined;\n\nexport function setPluginComponentHook(hook: UsePluginComponent): void {\n  // We allow overriding the registry in tests\n  if (singleton && process.env.NODE_ENV !== 'test') {\n    throw new Error('setPluginComponentHook() function should only be called once, when Grafana is starting.');\n  }\n  singleton = hook;\n}\n\nexport function usePluginComponent<Props extends object = {}>(componentId: string): UsePluginComponentResult<Props> {\n  if (!singleton) {\n    throw new Error('setPluginComponentHook(options) can only be used after the Grafana instance has started.');\n  }\n  return singleton(componentId) as UsePluginComponentResult<Props>;\n}\n","import { type ComponentTypeWithExtensionMeta } from '@grafana/data';\n\nexport type UsePluginComponentsOptions = {\n  extensionPointId: string;\n  limitPerPlugin?: number;\n};\n\nexport type UsePluginComponentsResult<Props = {}> = {\n  components: Array<ComponentTypeWithExtensionMeta<Props>>;\n  isLoading: boolean;\n};\n\nexport type UsePluginComponents<Props extends object = {}> = (\n  options: UsePluginComponentsOptions\n) => UsePluginComponentsResult<Props>;\n\nlet singleton: UsePluginComponents | undefined;\n\nexport function setPluginComponentsHook(hook: UsePluginComponents): void {\n  // We allow overriding the hook in tests\n  if (singleton && process.env.NODE_ENV !== 'test') {\n    throw new Error('setPluginComponentsHook() function should only be called once, when Grafana is starting.');\n  }\n  singleton = hook;\n}\n\nexport function usePluginComponents<Props extends object = {}>(\n  options: UsePluginComponentsOptions\n): UsePluginComponentsResult<Props> {\n  if (!singleton) {\n    throw new Error('setPluginComponentsHook(options) can only be used after the Grafana instance has started.');\n  }\n  return singleton(options) as UsePluginComponentsResult<Props>;\n}\n","import { PluginExtensionLink } from '@grafana/data';\n\nexport type UsePluginLinksOptions = {\n  extensionPointId: string;\n  context?: object | Record<string | symbol, unknown>;\n  limitPerPlugin?: number;\n};\n\nexport type UsePluginLinksResult = {\n  isLoading: boolean;\n  links: PluginExtensionLink[];\n};\n\nexport type UsePluginLinks = (options: UsePluginLinksOptions) => UsePluginLinksResult;\n\nlet singleton: UsePluginLinks | undefined;\n\nexport function setPluginLinksHook(hook: UsePluginLinks): void {\n  // We allow overriding the registry in tests\n  if (singleton && process.env.NODE_ENV !== 'test') {\n    throw new Error('setPluginLinksHook() function should only be called once, when Grafana is starting.');\n  }\n  singleton = hook;\n}\n\nexport function usePluginLinks(options: UsePluginLinksOptions): UsePluginLinksResult {\n  if (!singleton) {\n    throw new Error('setPluginLinksHook(options) can only be used after the Grafana instance has started.');\n  }\n  return singleton(options);\n}\n","import { PluginExtensionFunction } from '@grafana/data';\n\nexport type UsePluginFunctionsOptions = {\n  extensionPointId: string;\n  limitPerPlugin?: number;\n};\n\nexport type UsePluginFunctionsResult<Signature> = {\n  isLoading: boolean;\n  functions: Array<PluginExtensionFunction<Signature>>;\n};\n\nexport type UsePluginFunctions<T> = (options: UsePluginFunctionsOptions) => UsePluginFunctionsResult<T>;\n\nlet singleton: UsePluginFunctions<unknown> | undefined;\n\nexport function setPluginFunctionsHook(hook: UsePluginFunctions<unknown>): void {\n  // We allow overriding the registry in tests\n  if (singleton && process.env.NODE_ENV !== 'test') {\n    throw new Error('setUsePluginFunctionsHook() function should only be called once, when Grafana is starting.');\n  }\n  singleton = hook;\n}\n\nexport function usePluginFunctions<T>(options: UsePluginFunctionsOptions): UsePluginFunctionsResult<T> {\n  if (!singleton) {\n    throw new Error('usePluginFunctions(options) can only be used after the Grafana instance has started.');\n  }\n  return singleton(options) as UsePluginFunctionsResult<T>;\n}\n","import { Observable } from 'rxjs';\n\nimport { PluginExtensionLink } from '@grafana/data';\n\ntype GetObservablePluginLinksOptions = {\n  context?: object | Record<string | symbol, unknown>;\n  extensionPointId: string;\n  limitPerPlugin?: number;\n};\n\nexport type GetObservablePluginLinks = (options: GetObservablePluginLinksOptions) => Observable<PluginExtensionLink[]>;\n\nlet singleton: GetObservablePluginLinks | undefined;\n\nexport function setGetObservablePluginLinks(fn: GetObservablePluginLinks): void {\n  // We allow overriding the registry in tests\n  if (singleton && process.env.NODE_ENV !== 'test') {\n    throw new Error('setGetObservablePluginLinks() function should only be called once, when Grafana is starting.');\n  }\n\n  singleton = fn;\n}\n\nexport function getObservablePluginLinks(options: GetObservablePluginLinksOptions): Observable<PluginExtensionLink[]> {\n  if (!singleton) {\n    throw new Error('getObservablePluginLinks() can only be used after the Grafana instance has started.');\n  }\n\n  return singleton(options);\n}\n","import { Observable } from 'rxjs';\n\nimport { PluginExtensionComponent } from '@grafana/data';\n\ntype GetObservablePluginComponentsOptions = {\n  context?: object | Record<string, unknown>;\n  extensionPointId: string;\n  limitPerPlugin?: number;\n};\n\nexport type GetObservablePluginComponents = (\n  options: GetObservablePluginComponentsOptions\n) => Observable<PluginExtensionComponent[]>;\n\nlet singleton: GetObservablePluginComponents | undefined;\n\nexport function setGetObservablePluginComponents(fn: GetObservablePluginComponents): void {\n  // We allow overriding the registry in tests\n  if (singleton && process.env.NODE_ENV !== 'test') {\n    throw new Error(\n      'setGetObservablePluginComponents() function should only be called once, when Grafana is starting.'\n    );\n  }\n\n  singleton = fn;\n}\n\nexport function getObservablePluginComponents(\n  options: GetObservablePluginComponentsOptions\n): Observable<PluginExtensionComponent[]> {\n  if (!singleton) {\n    throw new Error('getObservablePluginComponents() can only be used after the Grafana instance has started.');\n  }\n\n  return singleton(options);\n}\n","import React from 'react';\n\nimport {\n  ComponentTypeWithExtensionMeta,\n  type PluginExtension,\n  type PluginExtensionComponent,\n  type PluginExtensionLink,\n  PluginExtensionTypes,\n} from '@grafana/data';\n\nexport function isPluginExtensionLink(extension: PluginExtension | undefined): extension is PluginExtensionLink {\n  if (!extension) {\n    return false;\n  }\n  return extension.type === PluginExtensionTypes.link && ('path' in extension || 'onClick' in extension);\n}\n\nexport function isPluginExtensionComponent(\n  extension: PluginExtension | undefined\n): extension is PluginExtensionComponent {\n  if (!extension) {\n    return false;\n  }\n  return extension.type === PluginExtensionTypes.component && 'component' in extension;\n}\n\nexport function getLimitedComponentsToRender<Props extends {}>({\n  props,\n  components,\n  limit,\n  pluginId,\n}: {\n  props: Props;\n  components: Array<ComponentTypeWithExtensionMeta<Props>>;\n  limit?: number;\n  pluginId?: string | string[] | RegExp;\n}) {\n  if (!components.length) {\n    return null;\n  }\n\n  const renderedComponents: Array<ComponentTypeWithExtensionMeta<Props>> = [];\n\n  for (const Component of components) {\n    const { meta } = Component;\n\n    if (pluginId && typeof pluginId === 'string' && pluginId !== meta.pluginId) {\n      continue;\n    }\n\n    if (pluginId && Array.isArray(pluginId) && !pluginId.includes(meta.pluginId)) {\n      continue;\n    }\n\n    if (pluginId instanceof RegExp && !pluginId.test(meta.pluginId)) {\n      continue;\n    }\n\n    // If no limit is provided, return all components\n    if (limit === undefined) {\n      renderedComponents.push(Component);\n      continue;\n    }\n\n    // If a component does not render anything, do not count it in the limit\n    if (React.createElement<Props>(Component, props) !== null) {\n      renderedComponents.push(Component);\n    }\n\n    // Stop if we've reached the limit\n    if (renderedComponents.length >= limit) {\n      break;\n    }\n  }\n\n  return renderedComponents;\n}\n\nexport function renderLimitedComponents<Props extends {}>({\n  props,\n  components,\n  limit,\n  pluginId,\n}: {\n  props: Props;\n  components: Array<ComponentTypeWithExtensionMeta<Props>>;\n  limit?: number;\n  pluginId?: string | string[] | RegExp;\n}) {\n  const limitedComponents = getLimitedComponentsToRender({ props, components, limit, pluginId });\n\n  if (!limitedComponents?.length) {\n    return null;\n  }\n\n  return (\n    <>\n      {limitedComponents.map((Component) => (\n        <Component key={Component.meta.id} {...props} />\n      ))}\n    </>\n  );\n}\n","import { CurrentUser } from '@grafana/data';\n\nlet singletonInstance: CurrentUser | null = null;\n\n/**\n * Used during startup by Grafana to set the current user so it is available\n * for rbac checks.\n *\n * @internal\n */\nexport function setCurrentUser(instance: CurrentUser) {\n  if (singletonInstance) {\n    throw new Error('User should only be set once, when Grafana is starting.');\n  }\n  singletonInstance = instance;\n}\n\n/**\n * Used to retrieve the current user.\n *\n * @internal\n *\n */\nexport function getCurrentUser(): CurrentUser {\n  if (!singletonInstance) {\n    throw new Error('User can only be used after Grafana instance has started.');\n  }\n  return singletonInstance;\n}\n","import {\n  DataQuery,\n  DataSourceApi,\n  DataSourceInstanceSettings,\n  PluginType,\n  TestDataSourceResponse,\n} from '@grafana/data';\n\nexport abstract class RuntimeDataSource<TQuery extends DataQuery = DataQuery> extends DataSourceApi<TQuery> {\n  public instanceSettings: DataSourceInstanceSettings;\n\n  public constructor(pluginId: string, uid: string) {\n    const instanceSettings: DataSourceInstanceSettings = {\n      name: 'RuntimeDataSource-' + pluginId,\n      uid: uid,\n      type: pluginId,\n      id: 1,\n      readOnly: true,\n      jsonData: {},\n      access: 'direct',\n      meta: {\n        id: pluginId,\n        name: 'RuntimeDataSource-' + pluginId,\n        type: PluginType.datasource,\n        info: {\n          author: {\n            name: '',\n          },\n          description: '',\n          links: [],\n          logos: {\n            large: '',\n            small: '',\n          },\n          screenshots: [],\n          updated: '',\n          version: '',\n        },\n        module: '',\n        baseUrl: '',\n      },\n    };\n\n    super(instanceSettings);\n    this.instanceSettings = instanceSettings;\n  }\n\n  public testDatasource(): Promise<TestDataSourceResponse> {\n    return Promise.resolve({\n      status: 'success',\n      message: '',\n    });\n  }\n}\n","import { createContext, useContext, useMemo } from 'react';\nimport { useObservable } from 'react-use';\nimport { Observable } from 'rxjs';\n\nimport { Scope } from '@grafana/data';\n\nexport interface ScopesContextValueState {\n  // Whether the drawer with the related dashboards is open\n  drawerOpened: boolean;\n  enabled: boolean;\n\n  // loading state of the scopes\n  loading: boolean;\n  readOnly: boolean;\n\n  // Currently selected scopes\n  value: Scope[];\n}\n\nexport interface ScopesContextValue {\n  /**\n   * Current state.\n   */\n  state: ScopesContextValueState;\n\n  /**\n   * Observable that emits the current state.\n   */\n  stateObservable: Observable<ScopesContextValue['state']>;\n\n  /**\n   * Change the selected scopes. The service takes care about loading them and propagating the changes.\n   * @param scopeNames\n   */\n  changeScopes(scopeNames: string[]): void;\n\n  /**\n   * Set read-only mode.\n   * If `readOnly` is `true`, the selector will be set to read-only and the dashboards panel will be closed.\n   */\n  setReadOnly(readOnly: boolean): void;\n\n  /**\n   * Enable or disable the usage of scopes.\n   * This will hide the selector and the dashboards panel, and it will stop propagating the scopes to the query object.\n   */\n  setEnabled(enabled: boolean): void;\n}\n\nexport const ScopesContext = createContext<ScopesContextValue | undefined>(undefined);\n\nexport function useScopes(): ScopesContextValue | undefined {\n  const context = useContext(ScopesContext);\n\n  useObservable(context?.stateObservable ?? new Observable(), context?.state);\n\n  return useMemo(() => {\n    return context\n      ? {\n          state: context.state,\n          stateObservable: context.stateObservable,\n          changeScopes: context.changeScopes,\n          setReadOnly: context.setReadOnly,\n          setEnabled: context.setEnabled,\n        }\n      : undefined;\n    // Not sure why it thinks the context?.state is not required, but we want to recreate this when the state changes.\n    // context.stateObservable is readOnly so that is not needed, others are methods which should not change.\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, [context, context?.state]);\n}\n","import { CoreApp } from '@grafana/data';\n\nimport { EchoEvent, EchoEventType } from '../services/EchoSrv';\n\n/**\n * Describes the basic dashboard information that can be passed as the meta\n * analytics payload.\n *\n * @public\n */\nexport interface DashboardInfo {\n  /** @deprecated -- use UID not internal ID */\n  dashboardId: number;\n  dashboardUid: string;\n  dashboardName: string;\n  folderName?: string;\n}\n\n/**\n * Describes the data request information passed as the meta analytics payload.\n *\n * @public\n */\nexport interface DataRequestInfo extends Partial<DashboardInfo> {\n  source?: CoreApp | string;\n  datasourceName: string;\n  datasourceId: number;\n  datasourceUid: string;\n  datasourceType: string;\n  panelId?: number;\n  panelPluginId?: string;\n  panelName?: string;\n  duration: number;\n  error?: string;\n  dataSize?: number;\n}\n\n/**\n * The meta analytics events that can be added to the echo service.\n *\n * @public\n */\nexport enum MetaAnalyticsEventName {\n  DashboardView = 'dashboard-view',\n  DataRequest = 'data-request',\n}\n\n/**\n * Describes the payload of a dashboard view event.\n *\n * @public\n */\nexport interface DashboardViewEventPayload extends DashboardInfo {\n  eventName: MetaAnalyticsEventName.DashboardView;\n}\n\n/**\n * Describes the payload of a data request event.\n *\n * @public\n */\nexport interface DataRequestEventPayload extends DataRequestInfo {\n  eventName: MetaAnalyticsEventName.DataRequest;\n  totalQueries?: number;\n  cachedQueries?: number;\n}\n\n/**\n * Describes the meta analytics payload passed with the {@link MetaAnalyticsEvent}\n *\n * @public\n */\nexport type MetaAnalyticsEventPayload = DashboardViewEventPayload | DataRequestEventPayload;\n\n/**\n * Describes meta analytics event with predefined {@link EchoEventType.EchoEventType} type.\n *\n * @public\n */\nexport interface MetaAnalyticsEvent extends EchoEvent<EchoEventType.MetaAnalytics, MetaAnalyticsEventPayload> {}\n\n/**\n * Describes the payload of a pageview event.\n *\n * @public\n */\nexport interface PageviewEchoEventPayload {\n  page: string;\n}\n\n/**\n * Describes pageview event with predefined {@link EchoEventType.EchoEventType} type.\n *\n * @public\n */\nexport type PageviewEchoEvent = EchoEvent<EchoEventType.Pageview, PageviewEchoEventPayload>;\n\n/**\n * Describes the payload of a user interaction event.\n *\n * @public\n */\nexport interface InteractionEchoEventPayload {\n  interactionName: string;\n  properties?: Record<string, any>;\n}\n\n/**\n * Describes interaction event with predefined {@link EchoEventType.EchoEventType} type.\n *\n * @public\n */\nexport type InteractionEchoEvent = EchoEvent<EchoEventType.Interaction, InteractionEchoEventPayload>;\n\n/**\n * Describes the payload of an experimentview event.\n *\n * @public\n */\nexport interface ExperimentViewEchoEventPayload {\n  experimentId: string;\n  experimentGroup: string;\n  experimentVariant: string;\n}\n\n/**\n * Describes experimentview event with predefined {@link EchoEventType.EchoEventType} type.\n *\n * @public\n */\nexport type ExperimentViewEchoEvent = EchoEvent<EchoEventType.ExperimentView, ExperimentViewEchoEventPayload>;\n\n/**\n * Pageview event typeguard.\n *\n * @public\n */\nexport const isPageviewEvent = (event: EchoEvent): event is PageviewEchoEvent => {\n  return Boolean(event.payload.page);\n};\n\n/**\n * Interaction event typeguard.\n *\n * @public\n */\nexport const isInteractionEvent = (event: EchoEvent): event is InteractionEchoEvent => {\n  return Boolean(event.payload.interactionName);\n};\n\n/**\n * Experimentview event typeguard.\n *\n * @public\n */\nexport const isExperimentViewEvent = (event: EchoEvent): event is ExperimentViewEchoEvent => {\n  return Boolean(event.payload.experimentId);\n};\n","import { PanelPlugin } from '@grafana/data';\n\nimport { config } from '../config';\n\n/**\n * Option to specify a plugin css that should be applied for the dark\n * and the light theme.\n *\n * @public\n */\nexport interface PluginCssOptions {\n  light: string;\n  dark: string;\n}\n\n/**\n * Use this to load css for a Grafana plugin by specifying a {@link PluginCssOptions}\n * containing styling for the dark and the light theme.\n *\n * @param options - plugin styling for light and dark theme.\n * @public\n */\nexport async function loadPluginCss(options: PluginCssOptions): Promise<System.Module | void> {\n  try {\n    const cssPath = config.bootData.user.theme === 'light' ? options.light : options.dark;\n    return window.System.import(cssPath);\n  } catch (err) {\n    console.error(err);\n  }\n}\n\ninterface PluginImportUtils {\n  importPanelPlugin: (id: string) => Promise<PanelPlugin>;\n  getPanelPluginFromCache: (id: string) => PanelPlugin | undefined;\n}\n\nlet pluginImportUtils: PluginImportUtils | undefined;\n\nexport function setPluginImportUtils(utils: PluginImportUtils) {\n  if (pluginImportUtils) {\n    throw new Error('pluginImportUtils should only be set once, when Grafana is starting.');\n  }\n\n  pluginImportUtils = utils;\n}\n\nexport function getPluginImportUtils(): PluginImportUtils {\n  if (!pluginImportUtils) {\n    throw new Error('pluginImportUtils can only be used after Grafana instance has started.');\n  }\n\n  return pluginImportUtils;\n}\n","import { config } from '../config';\nimport { locationService } from '../services';\nimport { getEchoSrv, EchoEventType } from '../services/EchoSrv';\n\nimport {\n  ExperimentViewEchoEvent,\n  InteractionEchoEvent,\n  MetaAnalyticsEvent,\n  MetaAnalyticsEventPayload,\n  PageviewEchoEvent,\n} from './types';\n\n/**\n * Helper function to report meta analytics to the {@link EchoSrv}.\n *\n * @public\n */\nexport const reportMetaAnalytics = (payload: MetaAnalyticsEventPayload) => {\n  getEchoSrv().addEvent<MetaAnalyticsEvent>({\n    type: EchoEventType.MetaAnalytics,\n    payload,\n  });\n};\n\n/**\n * Helper function to report pageview events to the {@link EchoSrv}.\n *\n * @public\n */\nexport const reportPageview = () => {\n  const location = locationService.getLocation();\n  const page = `${config.appSubUrl ?? ''}${location.pathname}${location.search}${location.hash}`;\n  getEchoSrv().addEvent<PageviewEchoEvent>({\n    type: EchoEventType.Pageview,\n    payload: {\n      page,\n    },\n  });\n};\n\n/**\n * Helper function to report interaction events to the {@link EchoSrv}.\n *\n * @public\n */\nexport const reportInteraction = (interactionName: string, properties?: Record<string, unknown>) => {\n  // get static reporting context and append it to properties\n  if (config.reportingStaticContext && config.reportingStaticContext instanceof Object) {\n    properties = { ...properties, ...config.reportingStaticContext };\n  }\n  getEchoSrv().addEvent<InteractionEchoEvent>({\n    type: EchoEventType.Interaction,\n    payload: {\n      interactionName,\n      properties,\n    },\n  });\n};\n\n/**\n * Helper function to report experimentview events to the {@link EchoSrv}.\n *\n * @public\n */\nexport const reportExperimentView = (id: string, group: string, variant: string) => {\n  getEchoSrv().addEvent<ExperimentViewEchoEvent>({\n    type: EchoEventType.ExperimentView,\n    payload: {\n      experimentId: id,\n      experimentGroup: group,\n      experimentVariant: variant,\n    },\n  });\n};\n","import { config } from '../config';\n\nexport const featureEnabled = (feature: string): boolean => {\n  const { enabledFeatures } = config.licenseInfo;\n  return enabledFeatures && enabledFeatures[feature];\n};\n","import { faro, LogContext, LogLevel } from '@grafana/faro-web-sdk';\n\nimport { config } from '../config';\n\nexport { LogLevel };\n\n/**\n * Log a message at INFO level\n * @public\n */\nexport function logInfo(message: string, contexts?: LogContext) {\n  if (config.grafanaJavascriptAgent.enabled) {\n    faro.api.pushLog([message], {\n      level: LogLevel.INFO,\n      context: contexts,\n    });\n  }\n}\n\n/**\n * Log a message at WARNING level\n *\n * @public\n */\nexport function logWarning(message: string, contexts?: LogContext) {\n  if (config.grafanaJavascriptAgent.enabled) {\n    faro.api.pushLog([message], {\n      level: LogLevel.WARN,\n      context: contexts,\n    });\n  }\n}\n\n/**\n * Log a message at DEBUG level\n *\n * @public\n */\nexport function logDebug(message: string, contexts?: LogContext) {\n  if (config.grafanaJavascriptAgent.enabled) {\n    faro.api.pushLog([message], {\n      level: LogLevel.DEBUG,\n      context: contexts,\n    });\n  }\n}\n\n/**\n * Log an error\n *\n * @public\n */\nexport function logError(err: Error, contexts?: LogContext) {\n  if (config.grafanaJavascriptAgent.enabled) {\n    faro.api.pushError(err, {\n      context: contexts,\n    });\n  }\n}\n\n/**\n * Log a measurement\n *\n * @public\n */\nexport type MeasurementValues = Record<string, number>;\nexport function logMeasurement(type: string, values: MeasurementValues, context?: LogContext) {\n  if (config.grafanaJavascriptAgent.enabled) {\n    faro.api.pushMeasurement(\n      {\n        type,\n        values,\n      },\n      { context: context }\n    );\n  }\n}\n\nexport interface MonitoringLogger {\n  logDebug: (message: string, contexts?: LogContext) => void;\n  logInfo: (message: string, contexts?: LogContext) => void;\n  logWarning: (message: string, contexts?: LogContext) => void;\n  logError: (error: Error, contexts?: LogContext) => void;\n  logMeasurement: (type: string, measurement: MeasurementValues, contexts?: LogContext) => void;\n}\n/**\n * Creates a monitoring logger with five levels of logging methods: `logDebug`, `logInfo`, `logWarning`, `logError`, and `logMeasurement`.\n * These methods use `faro.api.pushX` web SDK methods to report these logs or errors to the Faro collector.\n *\n * @param {string} source - Identifier for the source of the log messages.\n * @param {LogContext} [defaultContext] - Context to be included in every log message.\n *\n * @returns {MonitoringLogger} Logger object with five methods:\n * - `logDebug(message: string, contexts?: LogContext)`: Logs a debug message.\n * - `logInfo(message: string, contexts?: LogContext)`: Logs an informational message.\n * - `logWarning(message: string, contexts?: LogContext)`: Logs a warning message.\n * - `logError(error: Error, contexts?: LogContext)`: Logs an error message.\n * - `logMeasurement(measurement: Omit<MeasurementEvent, 'timestamp'>, contexts?: LogContext)`: Logs a measurement.\n * Each method combines the `defaultContext` (if provided), the `source`, and an optional `LogContext` parameter into a full context that is included with the log message.\n */\nexport function createMonitoringLogger(source: string, defaultContext?: LogContext): MonitoringLogger {\n  const createFullContext = (contexts?: LogContext) => ({\n    source: source,\n    ...defaultContext,\n    ...contexts,\n  });\n\n  return {\n    /**\n     * Logs a debug message with optional additional context.\n     * @param {string} message - The debug message to be logged.\n     * @param {LogContext} [contexts] - Optional additional context to be included.\n     */\n    logDebug: (message: string, contexts?: LogContext) => logDebug(message, createFullContext(contexts)),\n\n    /**\n     * Logs an informational message with optional additional context.\n     * @param {string} message - The informational message to be logged.\n     * @param {LogContext} [contexts] - Optional additional context to be included.\n     */\n    logInfo: (message: string, contexts?: LogContext) => logInfo(message, createFullContext(contexts)),\n\n    /**\n     * Logs a warning message with optional additional context.\n     * @param {string} message - The warning message to be logged.\n     * @param {LogContext} [contexts] - Optional additional context to be included.\n     */\n    logWarning: (message: string, contexts?: LogContext) => logWarning(message, createFullContext(contexts)),\n\n    /**\n     * Logs an error with optional additional context.\n     * @param {Error} error - The error object to be logged.\n     * @param {LogContext} [contexts] - Optional additional context to be included.\n     */\n    logError: (error: Error, contexts?: LogContext) => logError(error, createFullContext(contexts)),\n\n    /**\n     * Logs an measurement with optional additional context.\n     * @param {MeasurementEvent} measurement - The measurement object to be recorded.\n     * @param {LogContext} [contexts] - Optional additional context to be included.\n     */\n    logMeasurement: (type: string, measurement: MeasurementValues, contexts?: LogContext) =>\n      logMeasurement(type, measurement, createFullContext(contexts)),\n  };\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 | unknown): DataQueryError {\n  const error: DataQueryError = err || {};\n\n  if (!error.message) {\n    if (typeof err === 'string') {\n      return { message: err };\n    }\n\n    let message = 'Query error';\n    if (error.message) {\n      message = error.message;\n    } else if (error.data && error.data.message && error.data?.message !== 'Query data error') {\n      message = error.data.message;\n    } else if (error?.data?.message === 'Query data error' && error?.data?.error) {\n      message = error.data.error;\n    } else if (error.data && error.data.error) {\n      message = error.data.error;\n    } else if (error.status) {\n      message = `Query error: ${error.status} ${error.statusText}`;\n    }\n    error.message = message;\n  }\n\n  return error;\n}\n","import {\n  DataQueryResponse,\n  KeyValue,\n  LoadingState,\n  DataQueryError,\n  TimeSeries,\n  TableData,\n  toDataFrame,\n  DataFrame,\n  MetricFindValue,\n  FieldType,\n  DataQuery,\n  DataFrameJSON,\n  dataFrameFromJSON,\n  QueryResultMetaNotice,\n} from '@grafana/data';\n\nimport { FetchError, FetchResponse } from '../services';\n\nimport { HealthCheckResultDetails } from './DataSourceWithBackend';\nimport { toDataQueryError } from './toDataQueryError';\n\nexport const cachedResponseNotice: QueryResultMetaNotice = { severity: 'info', text: 'Cached response' };\n\n/**\n * Single response object from a backend data source. Properties are optional but response should contain at least\n * an error or a some data (but can contain both). Main way to send data is with dataframes attribute as series and\n * tables data attributes are legacy formats.\n *\n * @internal\n */\nexport interface DataResponse {\n  error?: string;\n  refId?: string;\n  frames?: DataFrameJSON[];\n  status?: number;\n\n  // Legacy TSDB format...\n  series?: TimeSeries[];\n  tables?: TableData[];\n}\n\n/**\n * This is the type of response expected form backend datasource.\n *\n * @internal\n */\nexport interface BackendDataSourceResponse {\n  results: KeyValue<DataResponse>;\n}\n\n/**\n * Parse the results from /api/ds/query into a DataQueryResponse\n *\n * @param res - the HTTP response data.\n * @param queries - optional DataQuery array that will order the response based on the order of query refId's.\n *\n * @public\n */\nexport function toDataQueryResponse(\n  res:\n    | { data: BackendDataSourceResponse | undefined }\n    | FetchResponse<BackendDataSourceResponse | undefined>\n    | DataQueryError,\n  queries?: DataQuery[]\n): DataQueryResponse {\n  const rsp: DataQueryResponse = { data: [], state: LoadingState.Done };\n\n  const traceId = 'traceId' in res ? res.traceId : undefined;\n\n  if (traceId != null) {\n    rsp.traceIds = [traceId];\n  }\n\n  // If the response isn't in a correct shape we just ignore the data and pass empty DataQueryResponse.\n  const fetchResponse = res as FetchResponse;\n  if (fetchResponse.data?.results) {\n    const results = fetchResponse.data.results;\n    const refIDs = queries?.length ? queries.map((q) => q.refId) : Object.keys(results);\n    const cachedResponse = isCachedResponse(fetchResponse);\n    const data: DataResponse[] = [];\n\n    for (const refId of refIDs) {\n      const dr = results[refId];\n      if (!dr) {\n        continue;\n      }\n      dr.refId = refId;\n      data.push(dr);\n    }\n\n    for (const dr of data) {\n      if (dr.error) {\n        const errorObj: DataQueryError = {\n          refId: dr.refId,\n          message: dr.error,\n          status: dr.status,\n        };\n        if (traceId != null) {\n          errorObj.traceId = traceId;\n        }\n        if (!rsp.error) {\n          rsp.error = { ...errorObj };\n        }\n        if (rsp.errors) {\n          rsp.errors.push({ ...errorObj });\n        } else {\n          rsp.errors = [{ ...errorObj }];\n        }\n        rsp.state = LoadingState.Error;\n      }\n\n      if (dr.frames?.length) {\n        for (let js of dr.frames) {\n          if (cachedResponse) {\n            js = addCacheNotice(js);\n          }\n          const df = dataFrameFromJSON(js);\n          if (!df.refId) {\n            df.refId = dr.refId;\n          }\n          rsp.data.push(df);\n        }\n        continue; // the other tests are legacy\n      }\n\n      if (dr.series?.length) {\n        for (const s of dr.series) {\n          if (!s.refId) {\n            s.refId = dr.refId;\n          }\n          rsp.data.push(toDataFrame(s));\n        }\n      }\n\n      if (dr.tables?.length) {\n        for (const s of dr.tables) {\n          if (!s.refId) {\n            s.refId = dr.refId;\n          }\n          rsp.data.push(toDataFrame(s));\n        }\n      }\n    }\n  }\n\n  // When it is not an OK response, make sure the error gets added\n  if (fetchResponse.status && fetchResponse.status !== 200) {\n    if (rsp.state !== LoadingState.Error) {\n      rsp.state = LoadingState.Error;\n    }\n    if (!rsp.error) {\n      rsp.error = toDataQueryError(res);\n    }\n  }\n\n  return rsp;\n}\n\nfunction isCachedResponse(res: FetchResponse<BackendDataSourceResponse | undefined>): boolean {\n  const headers = res?.headers;\n  if (!headers || !headers.get) {\n    return false;\n  }\n  return headers.get('X-Cache') === 'HIT';\n}\n\nfunction addCacheNotice(frame: DataFrameJSON): DataFrameJSON {\n  return {\n    ...frame,\n    schema: {\n      ...frame.schema,\n      fields: [...(frame.schema?.fields ?? [])],\n      meta: {\n        ...frame.schema?.meta,\n        notices: [...(frame.schema?.meta?.notices ?? []), cachedResponseNotice],\n        isCachedResponse: true,\n      },\n    },\n  };\n}\n\nexport interface TestingStatus {\n  message?: string | null;\n  status?: string | null;\n  details?: HealthCheckResultDetails;\n}\n\n/**\n * Data sources using api/ds/query to test data sources can use this function to\n * handle errors and convert them to TestingStatus object.\n *\n * If possible, this should be avoided in favor of implementing /health endpoint\n * and testing data source with DataSourceWithBackend.testDataSource()\n *\n * Re-thrown errors are handled by testDataSource() in public/app/features/datasources/state/actions.ts\n *\n * @returns {TestingStatus}\n */\nexport function toTestingStatus(err: FetchError): TestingStatus {\n  const queryResponse = toDataQueryResponse(err);\n  // POST api/ds/query errors returned as { message: string, error: string } objects\n  if (queryResponse.error?.data?.message) {\n    return {\n      status: 'error',\n      message: queryResponse.error.data.message,\n      details: queryResponse.error?.data?.error ? { message: queryResponse.error.data.error } : undefined,\n    };\n  }\n  // POST api/ds/query errors returned in results object\n  else if (queryResponse.error?.refId && queryResponse.error?.message) {\n    return {\n      status: 'error',\n      message: queryResponse.error.message,\n    };\n  }\n\n  throw err;\n}\n\n/**\n * Return the first string or non-time field as the value\n *\n * @beta\n */\nexport function frameToMetricFindValue(frame: DataFrame): MetricFindValue[] {\n  if (!frame || !frame.length) {\n    return [];\n  }\n\n  const values: MetricFindValue[] = [];\n  let field = frame.fields.find((f) => f.type === FieldType.string);\n  if (!field) {\n    field = frame.fields.find((f) => f.type !== FieldType.time);\n  }\n  if (field) {\n    for (let i = 0; i < field.values.length; i++) {\n      values.push({ text: '' + field.values[i] });\n    }\n  }\n  return values;\n}\n","import { catchError, Observable, of, switchMap } from 'rxjs';\n\nimport { DataQuery, DataQueryRequest, DataQueryResponse } from '@grafana/data';\n\nimport { config } from '../config';\nimport { getBackendSrv } from '../services/backendSrv';\n\nimport { BackendDataSourceResponse, toDataQueryResponse } from './queryResponse';\n\nexport function publicDashboardQueryHandler(request: DataQueryRequest<DataQuery>): Observable<DataQueryResponse> {\n  const {\n    intervalMs,\n    maxDataPoints,\n    requestId,\n    panelId,\n    queryCachingTTL,\n    range: { from: fromRange, to: toRange },\n  } = request;\n  // Return early if no queries exist\n  if (!request.targets.length) {\n    return of({ data: [] });\n  }\n\n  const body = {\n    intervalMs,\n    maxDataPoints,\n    queryCachingTTL,\n    timeRange: {\n      from: fromRange.valueOf().toString(),\n      to: toRange.valueOf().toString(),\n      timezone: request.timezone,\n    },\n  };\n\n  return getBackendSrv()\n    .fetch<BackendDataSourceResponse>({\n      url: `/api/public/dashboards/${config.publicDashboardAccessToken!}/panels/${panelId}/query`,\n      method: 'POST',\n      data: body,\n      requestId,\n    })\n    .pipe(\n      switchMap((raw) => {\n        return of(toDataQueryResponse(raw, request.targets));\n      }),\n      catchError((err) => {\n        return of(toDataQueryResponse(err));\n      })\n    );\n}\n","import { get } from 'lodash';\nimport { lastValueFrom } from 'rxjs';\n\nimport { usePluginContext, type UserStorage as UserStorageType } from '@grafana/data';\n\nimport { config } from '../config';\nimport { BackendSrvRequest, getBackendSrv } from '../services';\n\nconst baseURL = `/apis/userstorage.grafana.app/v0alpha1/namespaces/${config.namespace}/user-storage`;\n\ninterface RequestOptions extends BackendSrvRequest {\n  manageError?: (err: unknown) => { error: unknown };\n  showErrorAlert?: boolean;\n\n  // rtk codegen sets this\n  body?: BackendSrvRequest['data'];\n}\n\nexport type UserStorageSpec = {\n  data: { [key: string]: string };\n};\n\nasync function apiRequest<T>(requestOptions: RequestOptions) {\n  try {\n    const { data: responseData, ...meta } = await lastValueFrom(\n      getBackendSrv().fetch<T>({\n        ...requestOptions,\n        url: baseURL + requestOptions.url,\n        data: requestOptions.body,\n        showErrorAlert: false,\n      })\n    );\n    return { data: responseData, meta };\n  } catch (error) {\n    return requestOptions.manageError ? requestOptions.manageError(error) : { error };\n  }\n}\n\n/**\n * A class for interacting with the backend user storage.\n * Exposed internally only to avoid misuse (wrong service name)..\n */\nexport class UserStorage implements UserStorageType {\n  private service: string;\n  private resourceName: string;\n  private userUID: string;\n  private canUseUserStorage: boolean;\n  private storageSpec: UserStorageSpec | null | undefined;\n\n  constructor(service: string) {\n    this.service = service;\n    this.userUID = config.bootData.user.uid === '' ? config.bootData.user.id.toString() : config.bootData.user.uid;\n    this.resourceName = `${service}:${this.userUID}`;\n    this.canUseUserStorage = config.bootData.user.isSignedIn;\n  }\n\n  private async init() {\n    if (this.storageSpec !== undefined) {\n      return;\n    }\n    const userStorage = await apiRequest<{ spec: UserStorageSpec }>({\n      url: `/${this.resourceName}`,\n      method: 'GET',\n      manageError: (error) => {\n        if (get(error, 'status') === 404) {\n          this.storageSpec = null;\n          return { error: null };\n        }\n        return { error };\n      },\n    });\n    if ('error' in userStorage) {\n      return userStorage.error;\n    }\n    this.storageSpec = userStorage.data.spec;\n    return;\n  }\n\n  async getItem(key: string): Promise<string | null> {\n    if (!this.canUseUserStorage) {\n      // Fallback to localStorage\n      return localStorage.getItem(`${this.resourceName}:${key}`);\n    }\n    // Ensure this.storageSpec is initialized\n    await this.init();\n    if (!this.storageSpec) {\n      // Also, fallback to localStorage for backward compatibility\n      return localStorage.getItem(`${this.resourceName}:${key}`);\n    }\n    return this.storageSpec.data[key];\n  }\n\n  async setItem(key: string, value: string): Promise<void> {\n    if (!this.canUseUserStorage) {\n      // Fallback to localStorage\n      localStorage.setItem(`${this.resourceName}:${key}`, value);\n      return;\n    }\n\n    const newData = { data: { [key]: value } };\n    // Ensure this.storageSpec is initialized\n    const error = await this.init();\n    if (error) {\n      // Fallback to localStorage\n      localStorage.setItem(`${this.resourceName}:${key}`, value);\n      return;\n    }\n\n    if (!this.storageSpec) {\n      // No user storage found, create a new one\n      await apiRequest<UserStorageSpec>({\n        url: `/`,\n        method: 'POST',\n        body: {\n          metadata: { name: this.resourceName, labels: { user: this.userUID, service: this.service } },\n          spec: newData,\n        },\n        manageError: (error) => {\n          // Fallback to localStorage\n          localStorage.setItem(`${this.resourceName}:${key}`, value);\n          return { error };\n        },\n      });\n      this.storageSpec = newData;\n      return;\n    }\n\n    // Update existing user storage\n    this.storageSpec.data[key] = value;\n    await apiRequest<UserStorageSpec>({\n      headers: { 'Content-Type': 'application/merge-patch+json' },\n      url: `/${this.resourceName}`,\n      method: 'PATCH',\n      body: { spec: newData },\n      manageError: (error) => {\n        // Fallback to localStorage\n        localStorage.setItem(`${this.resourceName}:${key}`, value);\n        return { error };\n      },\n    });\n  }\n}\n\n// This is a type alias to avoid breaking changes\nexport interface PluginUserStorage extends UserStorageType {}\n\n/**\n * A hook for interacting with the backend user storage (or local storage if not enabled).\n * @returns An scoped object for a plugin and a user with getItem and setItem functions.\n * @alpha Experimental\n */\nexport function usePluginUserStorage(): PluginUserStorage {\n  const context = usePluginContext();\n  if (!context) {\n    throw new Error(`No PluginContext found. The usePluginUserStorage() hook can only be used from a plugin.`);\n  }\n  return new UserStorage(context?.meta.id);\n}\n","import { lastValueFrom, merge, Observable, of } from 'rxjs';\nimport { catchError, switchMap } from 'rxjs/operators';\n\nimport {\n  DataFrame,\n  dataFrameToJSON,\n  DataQuery,\n  DataQueryRequest,\n  DataQueryResponse,\n  TestDataSourceResponse,\n  DataSourceApi,\n  DataSourceInstanceSettings,\n  DataSourceJsonData,\n  DataSourceRef,\n  getDataSourceRef,\n  makeClassES5Compatible,\n  parseLiveChannelAddress,\n  ScopedVars,\n  AdHocVariableFilter,\n  CoreApp,\n} from '@grafana/data';\n\nimport { reportInteraction } from '../analytics/utils';\nimport { config } from '../config';\nimport {\n  BackendSrvRequest,\n  FetchResponse,\n  getBackendSrv,\n  getDataSourceSrv,\n  getGrafanaLiveSrv,\n  StreamingFrameAction,\n  StreamingFrameOptions,\n} from '../services';\n\nimport { publicDashboardQueryHandler } from './publicDashboardQueryHandler';\nimport { BackendDataSourceResponse, toDataQueryResponse } from './queryResponse';\nimport { UserStorage } from './userStorage';\n\n/**\n * @internal\n */\nexport const ExpressionDatasourceRef = Object.freeze({\n  type: '__expr__',\n  uid: '__expr__',\n  name: 'Expression',\n});\n\n/**\n * @public\n */\nexport function isExpressionReference(ref?: DataSourceRef | string | null): boolean {\n  if (!ref) {\n    return false;\n  }\n  const v = typeof ref === 'string' ? ref : ref.type;\n  return v === ExpressionDatasourceRef.type || v === ExpressionDatasourceRef.name || v === '-100'; // -100 was a legacy accident that should be removed\n}\n\nexport class HealthCheckError extends Error {\n  details: HealthCheckResultDetails;\n\n  constructor(message: string, details: HealthCheckResultDetails) {\n    super(message);\n    this.details = details;\n    this.name = 'HealthCheckError';\n  }\n}\n\n/**\n * Describes the current health status of a data source plugin.\n *\n * @public\n */\nexport enum HealthStatus {\n  Unknown = 'UNKNOWN',\n  OK = 'OK',\n  Error = 'ERROR',\n}\n\n// Internal for now\nenum PluginRequestHeaders {\n  PluginID = 'X-Plugin-Id', // can be used for routing\n  DatasourceUID = 'X-Datasource-Uid', // can be used for routing/ load balancing\n  DashboardUID = 'X-Dashboard-Uid', // mainly useful for debugging slow queries\n  PanelID = 'X-Panel-Id', // mainly useful for debugging slow queries\n  PanelPluginId = 'X-Panel-Plugin-Id',\n  QueryGroupID = 'X-Query-Group-Id', // mainly useful to find related queries with query splitting\n  FromExpression = 'X-Grafana-From-Expr', // used by datasources to identify expression queries\n  SkipQueryCache = 'X-Cache-Skip', // used by datasources to skip the query cache\n  DashboardTitle = 'X-Dashboard-Title', // used by datasources to identify the dashboard title\n  PanelTitle = 'X-Panel-Title', // used by datasources to identify the panel title\n}\n\n/**\n * Describes the details in the payload returned when checking the health of a data source\n * plugin.\n *\n * If the 'message' key exists, this will be displayed in the error message in DataSourceSettingsPage\n * If the 'verboseMessage' key exists, this will be displayed in the expandable details in the error message in DataSourceSettingsPage\n *\n * @public\n */\nexport type HealthCheckResultDetails = Record<string, unknown> | undefined;\n\n/**\n * Describes the payload returned when checking the health of a data source\n * plugin.\n *\n * @public\n */\nexport interface HealthCheckResult {\n  status: HealthStatus;\n  message: string;\n  details: HealthCheckResultDetails;\n}\n\n/**\n * Extend this class to implement a data source plugin that is depending on the Grafana\n * backend API.\n *\n * @public\n */\nclass DataSourceWithBackend<\n  TQuery extends DataQuery = DataQuery,\n  TOptions extends DataSourceJsonData = DataSourceJsonData,\n> extends DataSourceApi<TQuery, TOptions> {\n  userStorage: UserStorage;\n\n  constructor(instanceSettings: DataSourceInstanceSettings<TOptions>) {\n    super(instanceSettings);\n    this.userStorage = new UserStorage(instanceSettings.type);\n  }\n\n  /**\n   * Ideally final -- any other implementation may not work as expected\n   */\n  query(request: DataQueryRequest<TQuery>): Observable<DataQueryResponse> {\n    if (config.publicDashboardAccessToken) {\n      return publicDashboardQueryHandler(request);\n    }\n\n    const { intervalMs, maxDataPoints, queryCachingTTL, range, requestId, hideFromInspector = false } = request;\n    let targets = request.targets;\n\n    let hasExpr = false;\n    const pluginIDs = new Set<string>();\n    const dsUIDs = new Set<string>();\n    const queries: DataQuery[] = targets.map((q) => {\n      let datasource = this.getRef();\n      let datasourceId = this.id;\n      let shouldApplyTemplateVariables = true;\n\n      if (isExpressionReference(q.datasource)) {\n        hasExpr = true;\n        return {\n          ...q,\n          datasource: ExpressionDatasourceRef,\n        };\n      }\n\n      if (q.datasource) {\n        const ds = getDataSourceSrv().getInstanceSettings(q.datasource, request.scopedVars);\n\n        if (!ds) {\n          throw new Error(`Unknown Datasource: ${JSON.stringify(q.datasource)}`);\n        }\n\n        const dsRef = ds.rawRef ?? getDataSourceRef(ds);\n        const dsId = ds.id;\n        if (dsRef.uid !== datasource.uid || datasourceId !== dsId) {\n          datasource = dsRef;\n          datasourceId = dsId;\n          // If the query is using a different datasource, we would need to retrieve the datasource\n          // instance (async) and apply the template variables but it seems it's not necessary for now.\n          shouldApplyTemplateVariables = false;\n        }\n      }\n      if (datasource.type?.length) {\n        pluginIDs.add(datasource.type);\n      }\n      if (datasource.uid?.length) {\n        dsUIDs.add(datasource.uid);\n      }\n\n      return {\n        ...(shouldApplyTemplateVariables ? this.applyTemplateVariables(q, request.scopedVars, request.filters) : q),\n        datasource,\n        datasourceId, // deprecated!\n        intervalMs,\n        maxDataPoints,\n        queryCachingTTL,\n      };\n    });\n\n    // Return early if no queries exist\n    if (!queries.length) {\n      return of({ data: [] });\n    }\n\n    const body = {\n      queries,\n      from: range?.from.valueOf().toString(),\n      to: range?.to.valueOf().toString(),\n    };\n\n    const headers: Record<string, string> = request.headers ?? {};\n    headers[PluginRequestHeaders.PluginID] = Array.from(pluginIDs).join(', ');\n    headers[PluginRequestHeaders.DatasourceUID] = Array.from(dsUIDs).join(', ');\n\n    let url = '/api/ds/query?ds_type=' + this.type;\n\n    // Use the new query service for explore\n    if (config.featureToggles.queryServiceFromExplore && request.app === CoreApp.Explore) {\n      // make sure query-service is enabled on the backend\n      const isQueryServiceEnabled = config.featureToggles.queryService;\n      const isExperimentalAPIsEnabled = config.featureToggles.grafanaAPIServerWithExperimentalAPIs;\n      if (!isQueryServiceEnabled && !isExperimentalAPIsEnabled) {\n        console.warn('feature toggle queryServiceFromExplore also requires the queryService to be running');\n      } else {\n        url = `/apis/query.grafana.app/v0alpha1/namespaces/${config.namespace}/query?ds_type=${this.type}`;\n      }\n    }\n\n    // Use the new query service\n    if (config.featureToggles.queryServiceFromUI) {\n      if (!(config.featureToggles.queryService || config.featureToggles.grafanaAPIServerWithExperimentalAPIs)) {\n        console.warn('feature toggle queryServiceFromUI also requires the queryService to be running');\n      } else {\n        url = `/apis/query.grafana.app/v0alpha1/namespaces/${config.namespace}/query?ds_type=${this.type}`;\n      }\n    }\n\n    if (hasExpr) {\n      headers[PluginRequestHeaders.FromExpression] = 'true';\n      url += '&expression=true';\n    }\n\n    // Appending request ID to url to facilitate client-side performance metrics. See #65244 for more context.\n    if (requestId) {\n      url += `&requestId=${requestId}`;\n    }\n\n    if (request.dashboardUID) {\n      headers[PluginRequestHeaders.DashboardUID] = request.dashboardUID;\n      if (request.dashboardTitle) {\n        headers[PluginRequestHeaders.DashboardTitle] = request.dashboardTitle;\n      }\n      if (request.panelId) {\n        headers[PluginRequestHeaders.PanelID] = `${request.panelId}`;\n      }\n      if (request.panelName) {\n        headers[PluginRequestHeaders.PanelTitle] = request.panelName;\n      }\n    }\n    if (request.panelPluginId) {\n      headers[PluginRequestHeaders.PanelPluginId] = `${request.panelPluginId}`;\n    }\n    if (request.queryGroupId) {\n      headers[PluginRequestHeaders.QueryGroupID] = `${request.queryGroupId}`;\n    }\n    if (request.skipQueryCache) {\n      headers[PluginRequestHeaders.SkipQueryCache] = 'true';\n    }\n    return getBackendSrv()\n      .fetch<BackendDataSourceResponse>({\n        url,\n        method: 'POST',\n        data: body,\n        requestId,\n        hideFromInspector,\n        headers,\n      })\n      .pipe(\n        switchMap((raw) => {\n          const rsp = toDataQueryResponse(raw, queries);\n          // Check if any response should subscribe to a live stream\n          if (rsp.data?.length && rsp.data.find((f: DataFrame) => f.meta?.channel)) {\n            return toStreamingDataResponse(rsp, request, this.streamOptionsProvider);\n          }\n          return of(rsp);\n        }),\n        catchError((err) => {\n          return of(toDataQueryResponse(err));\n        })\n      );\n  }\n\n  /** Get request headers with plugin ID+UID set */\n  protected getRequestHeaders(): Record<string, string> {\n    const headers: Record<string, string> = {};\n    headers[PluginRequestHeaders.PluginID] = this.type;\n    headers[PluginRequestHeaders.DatasourceUID] = this.uid;\n    return headers;\n  }\n\n  /**\n   * Apply template variables for explore\n   */\n  interpolateVariablesInQueries(queries: TQuery[], scopedVars: ScopedVars, filters?: AdHocVariableFilter[]): TQuery[] {\n    return queries.map((q) => this.applyTemplateVariables(q, scopedVars, filters));\n  }\n\n  /**\n   * Override to apply template variables and adhoc filters.  The result is usually also `TQuery`, but sometimes this can\n   * be used to modify the query structure before sending to the backend.\n   *\n   * NOTE: if you do modify the structure or use template variables, alerting queries may not work\n   * as expected\n   *\n   * @virtual\n   */\n  applyTemplateVariables(query: TQuery, scopedVars: ScopedVars, filters?: AdHocVariableFilter[]) {\n    return query;\n  }\n\n  /**\n   * Optionally override the streaming behavior\n   */\n  streamOptionsProvider: StreamOptionsProvider<TQuery> = standardStreamOptionsProvider;\n\n  /**\n   * Make a GET request to the datasource resource path\n   */\n  async getResource<T = any>(\n    path: string,\n    params?: BackendSrvRequest['params'],\n    options?: Partial<BackendSrvRequest>\n  ): Promise<T> {\n    const headers = this.getRequestHeaders();\n    const result = await lastValueFrom(\n      getBackendSrv().fetch<T>({\n        ...options,\n        method: 'GET',\n        headers: options?.headers ? { ...options.headers, ...headers } : headers,\n        params: params ?? options?.params,\n        url: `/api/datasources/uid/${this.uid}/resources/${path}`,\n      })\n    );\n    return result.data;\n  }\n\n  /**\n   * Send a POST request to the datasource resource path\n   */\n  async postResource<T = unknown>(\n    path: string,\n    data?: BackendSrvRequest['data'],\n    options?: Partial<BackendSrvRequest>\n  ): Promise<T> {\n    const headers = this.getRequestHeaders();\n    const result = await lastValueFrom(\n      getBackendSrv().fetch<T>({\n        ...options,\n        method: 'POST',\n        headers: options?.headers ? { ...options.headers, ...headers } : headers,\n        data: data ?? { ...data },\n        url: `/api/datasources/uid/${this.uid}/resources/${path}`,\n      })\n    );\n    return result.data;\n  }\n\n  /**\n   * Run the datasource healthcheck\n   */\n  async callHealthCheck(): Promise<HealthCheckResult> {\n    return lastValueFrom(\n      getBackendSrv().fetch<HealthCheckResult>({\n        method: 'GET',\n        url: `/api/datasources/uid/${this.uid}/health`,\n        showErrorAlert: false,\n        headers: this.getRequestHeaders(),\n      })\n    )\n      .then((v: FetchResponse<HealthCheckResult>) => v.data)\n      .catch((err) => {\n        let properties: Record<string, string> = {\n          plugin_id: this.meta?.id || '',\n          plugin_version: this.meta?.info?.version || '',\n          datasource_healthcheck_status: err?.data?.status || 'error',\n          datasource_healthcheck_message: err?.data?.message || '',\n        };\n        reportInteraction('datasource_health_check_completed', properties);\n        return err.data;\n      });\n  }\n\n  /**\n   * Checks the plugin health\n   * see public/app/features/datasources/state/actions.ts for what needs to be returned here\n   */\n  async testDatasource(): Promise<TestDataSourceResponse> {\n    return this.callHealthCheck().then((res) => {\n      if (res.status === HealthStatus.OK) {\n        return {\n          status: 'success',\n          message: res.message,\n        };\n      }\n\n      return Promise.reject({\n        status: 'error',\n        message: res.message,\n        error: new HealthCheckError(res.message, res.details),\n      });\n    });\n  }\n}\n\n/**\n * @internal exported for tests\n */\nexport function toStreamingDataResponse<TQuery extends DataQuery = DataQuery>(\n  rsp: DataQueryResponse,\n  req: DataQueryRequest<TQuery>,\n  getter: (req: DataQueryRequest<TQuery>, frame: DataFrame) => Partial<StreamingFrameOptions>\n): Observable<DataQueryResponse> {\n  const live = getGrafanaLiveSrv();\n  if (!live) {\n    return of(rsp); // add warning?\n  }\n\n  const staticdata: DataFrame[] = [];\n  const streams: Array<Observable<DataQueryResponse>> = [];\n  for (const f of rsp.data) {\n    const addr = parseLiveChannelAddress(f.meta?.channel);\n    if (addr) {\n      const frame: DataFrame = f;\n      streams.push(\n        live.getDataStream({\n          addr,\n          buffer: getter(req, frame),\n          frame: dataFrameToJSON(f),\n        })\n      );\n    } else {\n      staticdata.push(f);\n    }\n  }\n  if (staticdata.length) {\n    streams.push(of({ ...rsp, data: staticdata }));\n  }\n  if (streams.length === 1) {\n    return streams[0]; // avoid merge wrapper\n  }\n  return merge(...streams);\n}\n\n/**\n * This allows data sources to customize the streaming connection query\n *\n * @public\n */\nexport type StreamOptionsProvider<TQuery extends DataQuery = DataQuery> = (\n  request: DataQueryRequest<TQuery>,\n  frame: DataFrame\n) => Partial<StreamingFrameOptions>;\n\n/**\n * @public\n */\nexport const standardStreamOptionsProvider: StreamOptionsProvider = (request: DataQueryRequest, frame: DataFrame) => {\n  const opts: Partial<StreamingFrameOptions> = {\n    maxLength: request.maxDataPoints ?? 500,\n    action: StreamingFrameAction.Append,\n  };\n\n  // For recent queries, clamp to the current time range\n  if (request.rangeRaw?.to === 'now') {\n    opts.maxDelta = request.range.to.valueOf() - request.range.from.valueOf();\n  }\n  return opts;\n};\n\n//@ts-ignore\nDataSourceWithBackend = makeClassES5Compatible(DataSourceWithBackend);\n\nexport { DataSourceWithBackend };\n","import * as React from 'react';\n\nimport { AbsoluteTimeRange, FieldConfigSource, PanelData } from '@grafana/data';\n\n/**\n * Describes the properties that can be passed to the PanelRenderer.\n *\n * @typeParam P - Panel options type for the panel being rendered.\n * @typeParam F - Field options type for the panel being rendered.\n *\n * @internal\n */\nexport interface PanelRendererProps<P extends object = {}, F extends object = {}> {\n  data?: PanelData;\n  pluginId: string;\n  title: string;\n  options?: Partial<P>;\n  onOptionsChange?: (options: P) => void;\n  onFieldConfigChange?: (config: FieldConfigSource<F>) => void;\n  onChangeTimeRange?: (timeRange: AbsoluteTimeRange) => void;\n  fieldConfig?: FieldConfigSource<Partial<F>>;\n  timeZone?: string;\n  width: number;\n  height: number;\n}\n\n/**\n * Simplified type with defaults that describes the PanelRenderer.\n *\n * @internal\n */\nexport type PanelRendererType<P extends object = {}, F extends object = {}> = React.ComponentType<\n  PanelRendererProps<P, F>\n>;\n\n/**\n * PanelRenderer component that will be set via the {@link setPanelRenderer} function\n * when Grafana starts. The implementation being used during runtime lives in Grafana\n * core.\n *\n * @internal\n */\nexport let PanelRenderer: PanelRendererType = () => {\n  return <div>PanelRenderer can only be used after Grafana instance has been started.</div>;\n};\n\n/**\n * Used to bootstrap the PanelRenderer during application start so the PanelRenderer\n * is exposed via runtime.\n *\n * @internal\n */\nexport function setPanelRenderer(renderer: PanelRendererType) {\n  PanelRenderer = renderer;\n}\n","import * as React from 'react';\n\nimport { FieldConfigSource, PanelData, VisualizationSuggestion } from '@grafana/data';\n\n/**\n * Describes the properties that can be passed to the PanelDataErrorView.\n *\n * @alpha\n */\nexport interface PanelDataErrorViewProps {\n  message?: string;\n  panelId: number;\n  data: PanelData;\n  fieldConfig?: FieldConfigSource;\n  needsTimeField?: boolean;\n  needsNumberField?: boolean;\n  needsStringField?: boolean;\n  suggestions?: VisualizationSuggestion[];\n}\n\n/**\n * Simplified type with defaults that describes the PanelDataErrorView.\n *\n * @internal\n */\nexport type PanelDataErrorViewType = React.ComponentType<PanelDataErrorViewProps>;\n\n/**\n * PanelDataErrorView allows panels to show a consistent error message when\n * the result structure does not meet expected criteria\n *\n * @alpha\n */\nexport let PanelDataErrorView: PanelDataErrorViewType = ({ message }) => {\n  return <div>Unable to render data: {message}.</div>;\n};\n\n/**\n * Used to bootstrap the PanelDataErrorView during application start so the\n * PanelDataErrorView is exposed via runtime.\n *\n * @internal\n */\nexport function setPanelDataErrorView(renderer: PanelDataErrorViewType) {\n  PanelDataErrorView = renderer;\n}\n","import { Observable } from 'rxjs';\n\nimport { DataQueryRequest, DataSourceApi, PanelData, QueryRunner } from '@grafana/data';\n\nlet factory: QueryRunnerFactory | undefined;\n\n/**\n * @internal\n */\nexport type QueryRunnerFactory = () => QueryRunner;\n\n/**\n * Used to bootstrap the {@link createQueryRunner} during application start.\n *\n * @internal\n */\nexport const setQueryRunnerFactory = (instance: QueryRunnerFactory): void => {\n  if (factory) {\n    throw new Error('Runner should only be set when Grafana is starting.');\n  }\n  factory = instance;\n};\n\n/**\n * Used to create QueryRunner instances from outside the core Grafana application.\n * This is helpful to be able to create a QueryRunner to execute queries in e.g. an app plugin.\n *\n * @internal\n */\nexport const createQueryRunner = (): QueryRunner => {\n  if (!factory) {\n    throw new Error('`createQueryRunner` can only be used after Grafana instance has started.');\n  }\n  return factory();\n};\n\ntype RunRequestFn = (\n  datasource: DataSourceApi,\n  request: DataQueryRequest,\n  queryFunction?: typeof datasource.query\n) => Observable<PanelData>;\n\nlet runRequest: RunRequestFn | undefined;\n\n/**\n * Used to exspose runRequest implementation to libraries, i.e. @grafana/scenes\n *\n * @internal\n */\nexport function setRunRequest(fn: RunRequestFn): void {\n  if (runRequest && process.env.NODE_ENV !== 'test') {\n    throw new Error('runRequest function should only be set once, when Grafana is starting.');\n  }\n  runRequest = fn;\n}\n\nexport function getRunRequest(): RunRequestFn {\n  if (!runRequest) {\n    throw new Error('getRunRequest can only be used after Grafana instance has started.');\n  }\n  return runRequest;\n}\n","import * as React from 'react';\n\nimport { NavModelItem, PageLayoutType } from '@grafana/data';\n\nexport interface PageInfoItem {\n  label: string;\n  value: React.ReactNode;\n}\n\nexport interface PluginPageProps {\n  /** Can be used to place actions inline with the heading */\n  info?: PageInfoItem[];\n  /** Can be used to place actions inline with the heading */\n  actions?: React.ReactNode;\n  /** Can be used to customize rendering of title */\n  renderTitle?: (title: string) => React.ReactNode;\n  /** Shown under main heading */\n  subTitle?: React.ReactNode;\n  pageNav?: NavModelItem;\n  children: React.ReactNode;\n  layout?: PageLayoutType;\n}\n\nexport type PluginPageType = React.ComponentType<PluginPageProps>;\n\nexport let PluginPage: PluginPageType = ({ children }) => {\n  return <div>{children}</div>;\n};\n\n/**\n * Used to bootstrap the PluginPage during application start\n * is exposed via runtime.\n *\n * @internal\n */\nexport function setPluginPage(component: PluginPageType) {\n  PluginPage = component;\n}\n","// Libraries\nimport { PureComponent } from 'react';\n\n// Components\nimport {\n  DataSourceInstanceSettings,\n  DataSourceRef,\n  getDataSourceUID,\n  isUnsignedPluginSignature,\n  SelectableValue,\n} from '@grafana/data';\nimport { selectors } from '@grafana/e2e-selectors';\nimport { ActionMeta, PluginSignatureBadge, Select, Stack } from '@grafana/ui';\n\nimport { getDataSourceSrv } from '../services/dataSourceSrv';\n\nimport { ExpressionDatasourceRef } from './../utils/DataSourceWithBackend';\n\n/**\n * Component props description for the {@link DataSourcePicker}\n *\n * @internal\n */\nexport interface DataSourcePickerProps {\n  onChange: (ds: DataSourceInstanceSettings) => void;\n  current: DataSourceRef | string | null; // uid\n  hideTextValue?: boolean;\n  onBlur?: () => void;\n  autoFocus?: boolean;\n  openMenuOnFocus?: boolean;\n  placeholder?: string;\n  tracing?: boolean;\n  mixed?: boolean;\n  dashboard?: boolean;\n  metrics?: boolean;\n  type?: string | string[];\n  annotations?: boolean;\n  variables?: boolean;\n  alerting?: boolean;\n  pluginId?: string;\n  /** If true,we show only DSs with logs; and if true, pluginId shouldnt be passed in */\n  logs?: boolean;\n  // If set to true and there is no value select will be empty, otherwise it will preselect default data source\n  noDefault?: boolean;\n  width?: number;\n  inputId?: string;\n  filter?: (dataSource: DataSourceInstanceSettings) => boolean;\n  onClear?: () => void;\n  invalid?: boolean;\n  disabled?: boolean;\n  isLoading?: boolean;\n}\n\n/**\n * Component state description for the {@link DataSourcePicker}\n *\n * @internal\n */\nexport interface DataSourcePickerState {\n  error?: string;\n}\n\n/**\n * Component to be able to select a datasource from the list of installed and enabled\n * datasources in the current Grafana instance.\n *\n * @internal\n */\nexport class DataSourcePicker extends PureComponent<DataSourcePickerProps, DataSourcePickerState> {\n  dataSourceSrv = getDataSourceSrv();\n\n  static defaultProps: Partial<DataSourcePickerProps> = {\n    autoFocus: false,\n    openMenuOnFocus: false,\n    placeholder: 'Select data source',\n  };\n\n  state: DataSourcePickerState = {};\n\n  constructor(props: DataSourcePickerProps) {\n    super(props);\n  }\n\n  componentDidMount() {\n    const { current } = this.props;\n    const dsSettings = this.dataSourceSrv.getInstanceSettings(current);\n    if (!dsSettings) {\n      this.setState({ error: 'Could not find data source ' + current });\n    }\n  }\n\n  onChange = (item: SelectableValue<string>, actionMeta: ActionMeta) => {\n    if (actionMeta.action === 'clear' && this.props.onClear) {\n      this.props.onClear();\n      return;\n    }\n\n    const dsSettings = this.dataSourceSrv.getInstanceSettings(item.value);\n\n    if (dsSettings) {\n      this.props.onChange(dsSettings);\n      this.setState({ error: undefined });\n    }\n  };\n\n  private getCurrentValue(): SelectableValue<string> | undefined {\n    const { current, hideTextValue, noDefault } = this.props;\n    if (!current && noDefault) {\n      return;\n    }\n\n    const ds = this.dataSourceSrv.getInstanceSettings(current);\n\n    if (ds) {\n      return {\n        label: ds.name.slice(0, 37),\n        value: ds.uid,\n        imgUrl: ds.meta.info.logos.small,\n        hideText: hideTextValue,\n        meta: ds.meta,\n      };\n    }\n\n    const uid = getDataSourceUID(current);\n\n    if (uid === ExpressionDatasourceRef.uid || uid === ExpressionDatasourceRef.name) {\n      return { label: uid, value: uid, hideText: hideTextValue };\n    }\n\n    return {\n      label: (uid ?? 'no name') + ' - not found',\n      value: uid ?? undefined,\n      imgUrl: '',\n      hideText: hideTextValue,\n    };\n  }\n\n  getDataSourceOptions() {\n    const { alerting, tracing, metrics, mixed, dashboard, variables, annotations, pluginId, type, filter, logs } =\n      this.props;\n\n    const options = this.dataSourceSrv\n      .getList({\n        alerting,\n        tracing,\n        metrics,\n        logs,\n        dashboard,\n        mixed,\n        variables,\n        annotations,\n        pluginId,\n        filter,\n        type,\n      })\n      .map((ds) => ({\n        value: ds.name,\n        label: `${ds.name}${ds.isDefault ? ' (default)' : ''}`,\n        imgUrl: ds.meta.info.logos.small,\n        meta: ds.meta,\n      }));\n\n    return options;\n  }\n\n  render() {\n    const {\n      autoFocus,\n      onBlur,\n      onClear,\n      openMenuOnFocus,\n      placeholder,\n      width,\n      inputId,\n      disabled = false,\n      isLoading = false,\n    } = this.props;\n    const { error } = this.state;\n    const options = this.getDataSourceOptions();\n    const value = this.getCurrentValue();\n    const isClearable = typeof onClear === 'function';\n\n    return (\n      <div\n        aria-label=\"Data source picker select container\"\n        data-testid={selectors.components.DataSourcePicker.container}\n      >\n        <Select\n          isLoading={isLoading}\n          disabled={disabled}\n          aria-label={'Select a data source'}\n          data-testid={selectors.components.DataSourcePicker.inputV2}\n          inputId={inputId || 'data-source-picker'}\n          className=\"ds-picker select-container\"\n          isMulti={false}\n          isClearable={isClearable}\n          backspaceRemovesValue={false}\n          onChange={this.onChange}\n          options={options}\n          autoFocus={autoFocus}\n          onBlur={onBlur}\n          width={width}\n          openMenuOnFocus={openMenuOnFocus}\n          maxMenuHeight={500}\n          placeholder={placeholder}\n          noOptionsMessage=\"No datasources found\"\n          value={value ?? null}\n          invalid={Boolean(error) || Boolean(this.props.invalid)}\n          getOptionLabel={(o) => {\n            if (o.meta && isUnsignedPluginSignature(o.meta.signature) && o !== value) {\n              return (\n                <Stack alignItems=\"center\" justifyContent=\"space-between\">\n                  <span>{o.label}</span> <PluginSignatureBadge status={o.meta.signature} />\n                </Stack>\n              );\n            }\n            return o.label || '';\n          }}\n        />\n      </div>\n    );\n  }\n}\n","import { DataSourceInstanceSettings, PluginMeta } from '@grafana/data';\n\nimport { config } from '../../config';\n\nexport type PluginEventProperties = {\n  grafana_version: string;\n  plugin_type: string;\n  plugin_version: string;\n  plugin_id: string;\n  plugin_name: string;\n};\n\nexport function createPluginEventProperties(meta: PluginMeta): PluginEventProperties {\n  return {\n    grafana_version: config.buildInfo.version,\n    plugin_type: String(meta.type),\n    plugin_version: meta.info.version,\n    plugin_id: meta.id,\n    plugin_name: meta.name,\n  };\n}\n\nexport type DataSourcePluginEventProperties = PluginEventProperties & {\n  datasource_uid: string;\n};\n\nexport function createDataSourcePluginEventProperties(\n  instanceSettings: DataSourceInstanceSettings\n): DataSourcePluginEventProperties {\n  return {\n    ...createPluginEventProperties(instanceSettings.meta),\n    datasource_uid: instanceSettings.uid,\n  };\n}\n","import { useMemo } from 'react';\n\nimport { isDataSourcePluginContext, usePluginContext } from '@grafana/data';\n\nimport { reportInteraction } from '../utils';\n\nimport { createDataSourcePluginEventProperties, createPluginEventProperties } from './eventProperties';\n\nconst namePrefix = 'grafana_plugin_';\n\nexport function usePluginInteractionReporter(): typeof reportInteraction {\n  const context = usePluginContext();\n\n  return useMemo(() => {\n    // Happens when the hook is not used inside a plugin (e.g. in core Grafana)\n    if (!context) {\n      throw new Error(\n        `No PluginContext found. The usePluginInteractionReporter() hook can only be used from a plugin.`\n      );\n    }\n\n    const info = isDataSourcePluginContext(context)\n      ? createDataSourcePluginEventProperties(context.instanceSettings)\n      : createPluginEventProperties(context.meta);\n\n    return (interactionName: string, properties?: Record<string, unknown>) => {\n      if (!validInteractionName(interactionName)) {\n        throw new Error(`Interactions reported in plugins should start with: \"${namePrefix}\".`);\n      }\n      return reportInteraction(interactionName, { ...properties, ...info });\n    };\n  }, [context]);\n}\n\nfunction validInteractionName(interactionName: string): boolean {\n  return interactionName.startsWith(namePrefix) && interactionName.length > namePrefix.length;\n}\n","type ReturnToPreviousHook = () => (title: string, href?: string) => void;\n\nlet rtpHook: ReturnToPreviousHook | undefined = undefined;\n\nexport const setReturnToPreviousHook = (hook: ReturnToPreviousHook) => {\n  rtpHook = hook;\n};\n\n/**\n * Guidelines:\n * - Only use the ‘Return to previous’ functionality when the user is sent to another context, such as from Alerting to a dashboard.\n * - Specify a button title that identifies the page to return to in the most understandable way. Do not use text such as ‘Back to the previous page’. Be specific.\n */\nexport const useReturnToPrevious: ReturnToPreviousHook = () => {\n  if (!rtpHook) {\n    if (process.env.NODE_ENV !== 'production') {\n      throw new Error('useReturnToPrevious hook not found in @grafana/runtime');\n    }\n    return () => console.error('ReturnToPrevious hook not found');\n  }\n\n  return rtpHook();\n};\n","type MegaMenuOpenHook = () => Readonly<[boolean, (open: boolean, persist?: boolean) => void]>;\n\nlet megaMenuOpenHook: MegaMenuOpenHook | undefined = undefined;\n\nexport const setMegaMenuOpenHook = (hook: MegaMenuOpenHook) => {\n  megaMenuOpenHook = hook;\n};\n\n/**\n * Guidelines:\n * - Should only be used in very specific circumstances where the mega menu needs to be opened or closed programmatically.\n */\nexport const useMegaMenuOpen: MegaMenuOpenHook = () => {\n  if (!megaMenuOpenHook) {\n    if (process.env.NODE_ENV !== 'production') {\n      throw new Error('useMegaMenuOpen hook not found in @grafana/runtime');\n    }\n    return [false, () => console.error('MegaMenuOpen hook not found')];\n  }\n\n  return megaMenuOpenHook();\n};\n","type ChromeHeaderHeightHook = () => number;\n\nlet chromeHeaderHeightHook: ChromeHeaderHeightHook | undefined = undefined;\n\nexport const setChromeHeaderHeightHook = (hook: ChromeHeaderHeightHook) => {\n  chromeHeaderHeightHook = hook;\n};\n\nexport const useChromeHeaderHeight = () => {\n  if (!chromeHeaderHeightHook) {\n    if (process.env.NODE_ENV !== 'production') {\n      throw new Error('useChromeHeaderHeight hook not found in @grafana/runtime');\n    }\n    console.error('useChromeHeaderHeight hook not found');\n  }\n\n  return chromeHeaderHeightHook?.();\n};\n","import * as React from 'react';\n\nexport interface EmbeddedDashboardProps {\n  uid?: string;\n  /**\n   * Use this property to override initial time and variable state.\n   * Example: ?from=now-5m&to=now&var-varname=value1\n   */\n  initialState?: string;\n  /**\n   * Is called when ever the internal embedded dashboards url state changes.\n   * Can be used to sync the internal url state (Which is not synced to URL) with the external context, or to\n   * preserve some of the state when moving to other embedded dashboards.\n   */\n  onStateChange?: (state: string) => void;\n}\n\n/**\n * Returns a React component that renders an embedded dashboard.\n * @alpha\n */\nexport let EmbeddedDashboard: React.ComponentType<EmbeddedDashboardProps> = () => {\n  throw new Error('EmbeddedDashboard requires runtime initialization');\n};\n\n/**\n *\n * @internal\n */\nexport function setEmbeddedDashboard(component: React.ComponentType<EmbeddedDashboardProps>) {\n  EmbeddedDashboard = component;\n}\n","import {\n  userHasPermission,\n  userHasPermissionInMetadata,\n  userHasAllPermissions,\n  userHasAnyPermission,\n  WithAccessControlMetadata,\n} from '@grafana/data';\n\nimport { getCurrentUser } from '../services/user';\n\nexport const hasPermission = (action: string) => userHasPermission(action, getCurrentUser());\n\nexport const hasPermissionInMetadata = (action: string, object: WithAccessControlMetadata) =>\n  userHasPermissionInMetadata(action, object);\n\nexport const hasAllPermissions = (actions: string[]) => userHasAllPermissions(actions, getCurrentUser());\n\nexport const hasAnyPermission = (actions: string[]) => userHasAnyPermission(actions, getCurrentUser());\n","import { DataQueryRequest } from '@grafana/data';\nimport { DataQuery } from '@grafana/schema';\n\nimport { config } from '../config';\nimport { getBackendSrv } from '../services';\n\nimport { DataSourceWithBackend } from './DataSourceWithBackend';\n\n/**\n * @alpha Experimental: Plugins implementing MigrationHandler interface will automatically have their queries migrated.\n */\nexport interface MigrationHandler {\n  hasBackendMigration: boolean;\n  shouldMigrate(query: DataQuery): boolean;\n}\n\nexport function isMigrationHandler(object: unknown): object is MigrationHandler {\n  return object instanceof DataSourceWithBackend && 'hasBackendMigration' in object && 'shouldMigrate' in object;\n}\n\nasync function postMigrateRequest<TQuery extends DataQuery>(queries: TQuery[]): Promise<TQuery[]> {\n  if (!(config.featureToggles.grafanaAPIServerWithExperimentalAPIs || config.featureToggles.datasourceAPIServers)) {\n    console.warn('migrateQuery is only available with the experimental API server');\n    return queries;\n  }\n\n  // Obtaining the GroupName from the plugin ID as done in the backend, this is temporary until we have a better way to obtain it\n  // https://github.com/grafana/grafana/blob/e013cd427cb0457177e11f19ebd30bc523b36c76/pkg/plugins/apiserver.go#L10\n  const dsnameURL = queries[0].datasource?.type?.replace(/^(grafana-)?(.*?)(-datasource)?$/, '$2');\n  const groupName = `${dsnameURL}.datasource.grafana.app`;\n  // Asuming apiVersion is v0alpha1, we'll need to obtain it from a trusted source\n  const apiVersion = 'v0alpha1';\n  const url = `/apis/${groupName}/${apiVersion}/namespaces/${config.namespace}/queryconvert`;\n  const request = {\n    queries: queries.map((query) => {\n      return {\n        ...query,\n        JSON: query, // JSON is not part of the type but it should be what holds the query\n      };\n    }),\n  };\n  const res = await getBackendSrv().post(url, request);\n  return res.queries.map((query: { JSON: TQuery }) => query.JSON);\n}\n\n/**\n * @alpha Experimental: Calls migration endpoint with one query. Requires grafanaAPIServerWithExperimentalAPIs or datasourceAPIServers feature toggle.\n */\nexport async function migrateQuery<TQuery extends DataQuery>(\n  datasource: MigrationHandler,\n  query: TQuery\n): Promise<TQuery> {\n  if (!datasource.hasBackendMigration || !datasource.shouldMigrate(query)) {\n    return query;\n  }\n  const res = await postMigrateRequest([query]);\n  return res[0];\n}\n\n/**\n * @alpha Experimental: Calls migration endpoint with multiple queries. Requires grafanaAPIServerWithExperimentalAPIs or datasourceAPIServers feature toggle.\n */\nexport async function migrateRequest<TQuery extends DataQuery>(\n  datasource: MigrationHandler,\n  request: DataQueryRequest<TQuery>\n): Promise<DataQueryRequest<TQuery>> {\n  if (!datasource.hasBackendMigration || !request.targets.some((query) => datasource.shouldMigrate(query))) {\n    return request;\n  }\n  const res = await postMigrateRequest(request.targets);\n  return { ...request, targets: res };\n}\n","import React, { useEffect, useState } from 'react';\nimport Skeleton from 'react-loading-skeleton';\n\nimport { DataSourceApi, DataSourceOptionsType, DataSourceQueryType, QueryEditorProps } from '@grafana/data';\nimport { DataQuery, DataSourceJsonData } from '@grafana/schema';\n\nimport { isMigrationHandler, migrateQuery } from '../utils/migrationHandler';\n\n/**\n * @alpha Experimental: QueryEditorWithMigration is a higher order component that wraps the QueryEditor component\n * and ensures that the query is migrated before being passed to the QueryEditor.\n */\nexport function QueryEditorWithMigration<\n  DSType extends DataSourceApi<TQuery, TOptions>,\n  TQuery extends DataQuery = DataSourceQueryType<DSType>,\n  TOptions extends DataSourceJsonData = DataSourceOptionsType<DSType>,\n>(QueryEditor: React.ComponentType<QueryEditorProps<DSType, TQuery, TOptions>>) {\n  const WithExtra = (props: QueryEditorProps<DSType, TQuery, TOptions>) => {\n    const [migrated, setMigrated] = useState(false);\n    const [query, setQuery] = useState(props.query);\n\n    useEffect(() => {\n      if (props.query && isMigrationHandler(props.datasource)) {\n        migrateQuery(props.datasource, props.query).then((migrated) => {\n          props.onChange(migrated);\n          setQuery(migrated);\n          setMigrated(true);\n        });\n      } else {\n        setMigrated(true);\n      }\n    }, []); // eslint-disable-line react-hooks/exhaustive-deps\n\n    useEffect(() => {\n      setQuery(props.query);\n    }, [props.query]);\n\n    if (!migrated) {\n      return <Skeleton containerTestId=\"react-loading-skeleton-testid\" height={75} />;\n    }\n    return <QueryEditor {...props} query={query} />;\n  };\n  return WithExtra;\n}\n","import { useCallback, useEffect, useState } from 'react';\n\nimport { DataSourceInstanceSettings } from '@grafana/data';\n\nimport { config } from '../config';\n\nimport { UserStorage } from './userStorage';\n\nconst FAVORITE_DATASOURCES_KEY = 'favoriteDatasources';\n\nexport type FavoriteDatasources = {\n  enabled: boolean;\n  isLoading: boolean;\n  favoriteDatasources: string[];\n  initialFavoriteDataSources: string[];\n  addFavoriteDatasource: (ds: DataSourceInstanceSettings) => void;\n  removeFavoriteDatasource: (ds: DataSourceInstanceSettings) => void;\n  isFavoriteDatasource: (dsUid: string) => boolean;\n};\n\n// Initialize user storage as a singleton\nconst userStorage = new UserStorage('grafana-runtime');\n\n/**\n * A hook for managing favorite data sources using user storage.\n * This hook provides functionality to store and retrieve a list of favorite data source UIDs\n * using the backend user storage (with localStorage fallback).\n *\n * @returns An object containing:\n * - A boolean indicating if the feature is enabled\n * - An array of favorite data source UIDs\n * - An array of favorite data source UIDs that were initially loaded from storage\n * - A function to add a data source to favorites\n * - A function to remove a data source from favorites\n * - A function to check if a data source is favorited\n * @public\n */\nexport function useFavoriteDatasources(): FavoriteDatasources {\n  const [favoriteDatasources, setFavoriteDatasources] = useState<string[]>([]);\n  const [initialFavoriteDataSources, setInitialFavoriteDataSources] = useState<string[]>([]);\n  const [isLoading, setIsLoading] = useState(false);\n\n  // Load favorites from storage on mount\n  useEffect(() => {\n    if (!config.featureToggles.favoriteDatasources) {\n      return;\n    }\n\n    const loadFavorites = async () => {\n      setIsLoading(true);\n      const stored = await userStorage.getItem(FAVORITE_DATASOURCES_KEY);\n      if (stored) {\n        const parsed = JSON.parse(stored);\n        setFavoriteDatasources(parsed);\n        setInitialFavoriteDataSources(parsed);\n      }\n      setIsLoading(false);\n    };\n\n    loadFavorites();\n  }, []);\n\n  // Helper function to save favorites to storage\n  const saveFavorites = useCallback(async (newFavorites: string[]) => {\n    setIsLoading(true);\n    await userStorage.setItem(FAVORITE_DATASOURCES_KEY, JSON.stringify(newFavorites));\n    setFavoriteDatasources(newFavorites);\n    setIsLoading(false);\n  }, []);\n\n  const addFavoriteDatasource = useCallback(\n    (ds: DataSourceInstanceSettings) => {\n      if (ds.meta.builtIn) {\n        // Prevent storing built-in datasources (-- Grafana --, -- Mixed --, -- Dashboard --)\n        return;\n      }\n\n      if (!favoriteDatasources.includes(ds.uid)) {\n        const newFavorites = [...favoriteDatasources, ds.uid];\n        saveFavorites(newFavorites);\n      }\n    },\n    [favoriteDatasources, saveFavorites]\n  );\n\n  const removeFavoriteDatasource = useCallback(\n    (ds: DataSourceInstanceSettings) => {\n      const newFavorites = favoriteDatasources.filter((uid) => uid !== ds.uid);\n      if (newFavorites.length !== favoriteDatasources.length) {\n        saveFavorites(newFavorites);\n      }\n    },\n    [favoriteDatasources, saveFavorites]\n  );\n\n  const isFavoriteDatasource = useCallback(\n    (dsUid: string) => {\n      return favoriteDatasources.includes(dsUid);\n    },\n    [favoriteDatasources]\n  );\n\n  if (!config.featureToggles.favoriteDatasources) {\n    return {\n      enabled: false,\n      isLoading: false,\n      favoriteDatasources: [],\n      initialFavoriteDataSources: [],\n      addFavoriteDatasource: () => {},\n      removeFavoriteDatasource: () => {},\n      isFavoriteDatasource: () => false,\n    };\n  }\n\n  return {\n    enabled: true,\n    isLoading,\n    favoriteDatasources,\n    addFavoriteDatasource,\n    removeFavoriteDatasource,\n    isFavoriteDatasource,\n    initialFavoriteDataSources,\n  };\n}\n","import * as React from 'react';\n\ninterface FolderPickerProps {\n  /* Folder UID to show as selected */\n  value?: string;\n\n  /** Show an invalid state around the folder picker */\n  invalid?: boolean;\n\n  /* Whether to show the root 'Dashboards' (formally General) folder as selectable */\n  showRootFolder?: boolean;\n\n  /* Folder UIDs to exclude from the picker, to prevent invalid operations */\n  excludeUIDs?: string[];\n\n  /* Start tree from this folder instead of root */\n  rootFolderUID?: string;\n\n  /* Show folders matching this permission, mainly used to also show folders user can view. Defaults to showing only folders user has Edit  */\n  permission?: 'view' | 'edit';\n\n  /* Callback for when the user selects a folder */\n  onChange?: (folderUID: string | undefined, folderName: string | undefined) => void;\n\n  /* Whether the picker should be clearable */\n  clearable?: boolean;\n}\n\ntype FolderPickerComponentType = React.ComponentType<FolderPickerProps>;\n\nlet FolderPickerComponent: FolderPickerComponentType | undefined;\n\n/**\n * Used to bootstrap the FolderPicker during application start\n *\n * @internal\n */\nexport function setFolderPicker(component: FolderPickerComponentType) {\n  FolderPickerComponent = component;\n}\n\nexport function FolderPicker(props: FolderPickerProps) {\n  if (FolderPickerComponent) {\n    return <FolderPickerComponent {...props} />;\n  }\n\n  if (process.env.NODE_ENV !== 'production') {\n    return <div>@grafana/runtime FolderPicker is not set</div>;\n  }\n\n  return null;\n}\n","import {\n  DataFrame,\n  DataLinkPostProcessor,\n  DataLinkTransformationConfig,\n  DataSourceInstanceSettings,\n  TimeRange,\n} from '@grafana/data';\n\nexport type CorrelationConfigQuery = {\n  field: string;\n  target: object; // for queries, this contains anything that would go in the query editor, so any extension off DataQuery a datasource would have, and needs to be generic.\n  transformations?: DataLinkTransformationConfig[];\n};\n\nexport type CorrelationConfigExternal = {\n  field: string;\n  target: {\n    url: string; // For external, this simply contains a URL\n  };\n  transformations?: DataLinkTransformationConfig[];\n};\n\ntype CorrelationBase = {\n  uid: string;\n  sourceUID: string;\n  label?: string;\n  description?: string;\n  provisioned: boolean;\n  orgId?: number;\n};\n\n/**\n * @alpha\n */\nexport type CorrelationExternal = CorrelationBase & {\n  type: 'external';\n  config: CorrelationConfigExternal;\n};\n\n/**\n * @alpha\n */\nexport type CorrelationQuery = CorrelationBase & {\n  type: 'query';\n  config: CorrelationConfigQuery;\n  targetUID: string;\n};\n\n/**\n * @alpha\n */\nexport type CorrelationData =\n  | (Omit<CorrelationExternal, 'sourceUID'> & {\n      source: DataSourceInstanceSettings;\n    })\n  | (Omit<CorrelationQuery, 'sourceUID' | 'targetUID'> & {\n      source: DataSourceInstanceSettings;\n      target: DataSourceInstanceSettings;\n    });\n\n/**\n * @alpha\n */\nexport interface CorrelationsData {\n  correlations: CorrelationData[];\n  page: number;\n  limit: number;\n  totalCount: number;\n}\n\n/**\n * Used to work with user defined correlations.\n * Should be accessed via {@link getCorrelationsService} function.\n *\n * @alpha\n */\nexport interface CorrelationsService {\n  /**\n   * Creates data links in data frames from provided correlations\n   *\n   * @param dataFrames list of data frames to be processed\n   * @param correlations list of of possible correlations that can be applied\n   * @param dataFrameRefIdToDataSourceUid a map that for provided refId references corresponding data source ui\n   */\n  attachCorrelationsToDataFrames: (\n    dataFrames: DataFrame[],\n    correlations: CorrelationData[],\n    dataFrameRefIdToDataSourceUid: Record<string, string>\n  ) => DataFrame[];\n\n  /**\n   * Creates a link post processor function that handles correlation transformations\n   *\n   * @param timeRange The current time range\n   */\n  correlationsDataLinkPostProcessorFactory: (timeRange: TimeRange) => DataLinkPostProcessor;\n\n  /**\n   * Loads all the correlations defined for the given data sources.\n   *\n   * @param sourceUIDs Data source UIDs\n   */\n  getCorrelationsBySourceUIDs: (sourceUIDs: string[]) => Promise<CorrelationsData>;\n}\n\nlet singletonInstance: CorrelationsService;\n\n/**\n * Used during startup by Grafana to set the CorrelationsService so it is available\n * via {@link getCorrelationsService} to the rest of the application.\n *\n * @internal\n */\nexport function setCorrelationsService(instance: CorrelationsService) {\n  singletonInstance = instance;\n}\n\n/**\n * Used to retrieve the {@link CorrelationsService}.\n *\n * @alpha\n */\nexport function getCorrelationsService(): CorrelationsService {\n  return singletonInstance;\n}\n"],"names":["singletonInstance","EchoEventType","merge","systemDateFormats","getThemeById","config","H","BehaviorSubject","urlUtil","deprecationWarning","locationService","createLogger","attachDebugger","React","useContext","BusEventBase","BusEventWithPayload","singleton","PluginExtensionTypes","jsx","Fragment","DataSourceApi","PluginType","createContext","useObservable","Observable","useMemo","MetaAnalyticsEventName","faro","LogLevel","LoadingState","data","dataFrameFromJSON","toDataFrame","FieldType","of","switchMap","catchError","lastValueFrom","get","error","usePluginContext","HealthStatus","PluginRequestHeaders","_a","getDataSourceRef","CoreApp","parseLiveChannelAddress","dataFrameToJSON","StreamingFrameAction","makeClassES5Compatible","PanelRenderer","PanelDataErrorView","PluginPage","PureComponent","getDataSourceUID","selectors","Select","isUnsignedPluginSignature","jsxs","Stack","PluginSignatureBadge","isDataSourcePluginContext","EmbeddedDashboard","userHasPermission","userHasPermissionInMetadata","userHasAllPermissions","userHasAnyPermission","useState","useEffect","migrated","Skeleton","useCallback"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4IO,SAAS,aAAsB,CAAA,EAAgC;AACpE,EAAA,OAAO,OAAO,CAAA,KAAM,QAAA,IAAY,MAAM,IAAA,IAAQ,QAAA,IAAY,KAAK,MAAA,IAAU,CAAA;AAC3E;AAuDA,IAAIA,mBAAA;AAQG,MAAM,aAAA,GAAgB,CAAC,QAAA,KAAyB;AACrD,EAAAA,mBAAA,GAAoB,QAAA;AACtB;AAQO,MAAM,gBAAgB,MAAkBA;;;AC7H/C,IAAIA,mBAAA;AAQG,SA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