@grafana/scenes 6.2.0--canary.1066.13575913588.0 → 6.2.0--canary.1062.13586374664.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -41,19 +41,19 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
41
41
  var uFuzzy__default = /*#__PURE__*/_interopDefaultLegacy(uFuzzy);
42
42
  var ReactGridLayout__default = /*#__PURE__*/_interopDefaultLegacy(ReactGridLayout);
43
43
 
44
- var __defProp$R = Object.defineProperty;
45
- var __getOwnPropSymbols$R = Object.getOwnPropertySymbols;
46
- var __hasOwnProp$R = Object.prototype.hasOwnProperty;
47
- var __propIsEnum$R = Object.prototype.propertyIsEnumerable;
48
- var __defNormalProp$R = (obj, key, value) => key in obj ? __defProp$R(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
49
- var __spreadValues$R = (a, b) => {
44
+ var __defProp$S = Object.defineProperty;
45
+ var __getOwnPropSymbols$S = Object.getOwnPropertySymbols;
46
+ var __hasOwnProp$S = Object.prototype.hasOwnProperty;
47
+ var __propIsEnum$S = Object.prototype.propertyIsEnumerable;
48
+ var __defNormalProp$S = (obj, key, value) => key in obj ? __defProp$S(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
49
+ var __spreadValues$S = (a, b) => {
50
50
  for (var prop in b || (b = {}))
51
- if (__hasOwnProp$R.call(b, prop))
52
- __defNormalProp$R(a, prop, b[prop]);
53
- if (__getOwnPropSymbols$R)
54
- for (var prop of __getOwnPropSymbols$R(b)) {
55
- if (__propIsEnum$R.call(b, prop))
56
- __defNormalProp$R(a, prop, b[prop]);
51
+ if (__hasOwnProp$S.call(b, prop))
52
+ __defNormalProp$S(a, prop, b[prop]);
53
+ if (__getOwnPropSymbols$S)
54
+ for (var prop of __getOwnPropSymbols$S(b)) {
55
+ if (__propIsEnum$S.call(b, prop))
56
+ __defNormalProp$S(a, prop, b[prop]);
57
57
  }
58
58
  return a;
59
59
  };
@@ -62,7 +62,7 @@ function useAppQueryParams() {
62
62
  return runtime.locationSearchToObject(location.search || "");
63
63
  }
64
64
  function getUrlWithAppState(path, searchObject, preserveParams) {
65
- const paramsCopy = __spreadValues$R({}, searchObject);
65
+ const paramsCopy = __spreadValues$S({}, searchObject);
66
66
  if (preserveParams) {
67
67
  for (const key of Object.keys(paramsCopy)) {
68
68
  if (!preserveParams.includes(key)) {
@@ -92,21 +92,21 @@ function useSceneRouteMatch(path) {
92
92
  return match;
93
93
  }
94
94
 
95
- var __defProp$Q = Object.defineProperty;
95
+ var __defProp$R = Object.defineProperty;
96
96
  var __defProps$y = Object.defineProperties;
97
97
  var __getOwnPropDescs$y = Object.getOwnPropertyDescriptors;
98
- var __getOwnPropSymbols$Q = Object.getOwnPropertySymbols;
99
- var __hasOwnProp$Q = Object.prototype.hasOwnProperty;
100
- var __propIsEnum$Q = Object.prototype.propertyIsEnumerable;
101
- var __defNormalProp$Q = (obj, key, value) => key in obj ? __defProp$Q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
102
- var __spreadValues$Q = (a, b) => {
98
+ var __getOwnPropSymbols$R = Object.getOwnPropertySymbols;
99
+ var __hasOwnProp$R = Object.prototype.hasOwnProperty;
100
+ var __propIsEnum$R = Object.prototype.propertyIsEnumerable;
101
+ var __defNormalProp$R = (obj, key, value) => key in obj ? __defProp$R(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
102
+ var __spreadValues$R = (a, b) => {
103
103
  for (var prop in b || (b = {}))
104
- if (__hasOwnProp$Q.call(b, prop))
105
- __defNormalProp$Q(a, prop, b[prop]);
106
- if (__getOwnPropSymbols$Q)
107
- for (var prop of __getOwnPropSymbols$Q(b)) {
108
- if (__propIsEnum$Q.call(b, prop))
109
- __defNormalProp$Q(a, prop, b[prop]);
104
+ if (__hasOwnProp$R.call(b, prop))
105
+ __defNormalProp$R(a, prop, b[prop]);
106
+ if (__getOwnPropSymbols$R)
107
+ for (var prop of __getOwnPropSymbols$R(b)) {
108
+ if (__propIsEnum$R.call(b, prop))
109
+ __defNormalProp$R(a, prop, b[prop]);
110
110
  }
111
111
  return a;
112
112
  };
@@ -116,7 +116,7 @@ function registerRuntimePanelPlugin({ pluginId, plugin }) {
116
116
  if (runtimePanelPlugins.has(pluginId)) {
117
117
  throw new Error(`A runtime panel plugin with id ${pluginId} has already been registered`);
118
118
  }
119
- plugin.meta = __spreadProps$y(__spreadValues$Q({}, plugin.meta), {
119
+ plugin.meta = __spreadProps$y(__spreadValues$R({}, plugin.meta), {
120
120
  id: pluginId,
121
121
  name: pluginId,
122
122
  module: "runtime plugin",
@@ -144,21 +144,21 @@ function loadPanelPluginSync(pluginId) {
144
144
  return (_a = getPanelPluginFromCache(pluginId)) != null ? _a : runtimePanelPlugins.get(pluginId);
145
145
  }
146
146
 
147
- var __defProp$P = Object.defineProperty;
147
+ var __defProp$Q = Object.defineProperty;
148
148
  var __defProps$x = Object.defineProperties;
149
149
  var __getOwnPropDescs$x = Object.getOwnPropertyDescriptors;
150
- var __getOwnPropSymbols$P = Object.getOwnPropertySymbols;
151
- var __hasOwnProp$P = Object.prototype.hasOwnProperty;
152
- var __propIsEnum$P = Object.prototype.propertyIsEnumerable;
153
- var __defNormalProp$P = (obj, key, value) => key in obj ? __defProp$P(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
154
- var __spreadValues$P = (a, b) => {
150
+ var __getOwnPropSymbols$Q = Object.getOwnPropertySymbols;
151
+ var __hasOwnProp$Q = Object.prototype.hasOwnProperty;
152
+ var __propIsEnum$Q = Object.prototype.propertyIsEnumerable;
153
+ var __defNormalProp$Q = (obj, key, value) => key in obj ? __defProp$Q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
154
+ var __spreadValues$Q = (a, b) => {
155
155
  for (var prop in b || (b = {}))
156
- if (__hasOwnProp$P.call(b, prop))
157
- __defNormalProp$P(a, prop, b[prop]);
158
- if (__getOwnPropSymbols$P)
159
- for (var prop of __getOwnPropSymbols$P(b)) {
160
- if (__propIsEnum$P.call(b, prop))
161
- __defNormalProp$P(a, prop, b[prop]);
156
+ if (__hasOwnProp$Q.call(b, prop))
157
+ __defNormalProp$Q(a, prop, b[prop]);
158
+ if (__getOwnPropSymbols$Q)
159
+ for (var prop of __getOwnPropSymbols$Q(b)) {
160
+ if (__propIsEnum$Q.call(b, prop))
161
+ __defNormalProp$Q(a, prop, b[prop]);
162
162
  }
163
163
  return a;
164
164
  };
@@ -166,11 +166,11 @@ var __spreadProps$x = (a, b) => __defProps$x(a, __getOwnPropDescs$x(b));
166
166
  var __objRest$5 = (source, exclude) => {
167
167
  var target = {};
168
168
  for (var prop in source)
169
- if (__hasOwnProp$P.call(source, prop) && exclude.indexOf(prop) < 0)
169
+ if (__hasOwnProp$Q.call(source, prop) && exclude.indexOf(prop) < 0)
170
170
  target[prop] = source[prop];
171
- if (source != null && __getOwnPropSymbols$P)
172
- for (var prop of __getOwnPropSymbols$P(source)) {
173
- if (exclude.indexOf(prop) < 0 && __propIsEnum$P.call(source, prop))
171
+ if (source != null && __getOwnPropSymbols$Q)
172
+ for (var prop of __getOwnPropSymbols$Q(source)) {
173
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$Q.call(source, prop))
174
174
  target[prop] = source[prop];
175
175
  }
176
176
  return target;
@@ -188,7 +188,7 @@ function SceneComponentWrapperWithoutMemo(_a) {
188
188
  if (!model.isActive && !model.renderBeforeActivation) {
189
189
  return null;
190
190
  }
191
- return /* @__PURE__ */ React__default["default"].createElement(Component, __spreadProps$x(__spreadValues$P({}, otherProps), {
191
+ return /* @__PURE__ */ React__default["default"].createElement(Component, __spreadProps$x(__spreadValues$Q({}, otherProps), {
192
192
  model
193
193
  }));
194
194
  }
@@ -234,19 +234,19 @@ class SceneObjectRef {
234
234
  }
235
235
  _ref = new WeakMap();
236
236
 
237
- var __defProp$O = Object.defineProperty;
238
- var __getOwnPropSymbols$O = Object.getOwnPropertySymbols;
239
- var __hasOwnProp$O = Object.prototype.hasOwnProperty;
240
- var __propIsEnum$O = Object.prototype.propertyIsEnumerable;
241
- var __defNormalProp$O = (obj, key, value) => key in obj ? __defProp$O(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
242
- var __spreadValues$O = (a, b) => {
237
+ var __defProp$P = Object.defineProperty;
238
+ var __getOwnPropSymbols$P = Object.getOwnPropertySymbols;
239
+ var __hasOwnProp$P = Object.prototype.hasOwnProperty;
240
+ var __propIsEnum$P = Object.prototype.propertyIsEnumerable;
241
+ var __defNormalProp$P = (obj, key, value) => key in obj ? __defProp$P(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
242
+ var __spreadValues$P = (a, b) => {
243
243
  for (var prop in b || (b = {}))
244
- if (__hasOwnProp$O.call(b, prop))
245
- __defNormalProp$O(a, prop, b[prop]);
246
- if (__getOwnPropSymbols$O)
247
- for (var prop of __getOwnPropSymbols$O(b)) {
248
- if (__propIsEnum$O.call(b, prop))
249
- __defNormalProp$O(a, prop, b[prop]);
244
+ if (__hasOwnProp$P.call(b, prop))
245
+ __defNormalProp$P(a, prop, b[prop]);
246
+ if (__getOwnPropSymbols$P)
247
+ for (var prop of __getOwnPropSymbols$P(b)) {
248
+ if (__propIsEnum$P.call(b, prop))
249
+ __defNormalProp$P(a, prop, b[prop]);
250
250
  }
251
251
  return a;
252
252
  };
@@ -313,7 +313,7 @@ class SceneObjectBase {
313
313
  }
314
314
  setState(update) {
315
315
  const prevState = this._state;
316
- const newState = __spreadValues$O(__spreadValues$O({}, this._state), update);
316
+ const newState = __spreadValues$P(__spreadValues$P({}, this._state), update);
317
317
  this._state = Object.freeze(newState);
318
318
  this._setParent(update);
319
319
  this._handleActivationOfChangedStateProps(prevState, newState);
@@ -509,19 +509,19 @@ function forEachChild(state, callback) {
509
509
  }
510
510
  }
511
511
 
512
- var __defProp$N = Object.defineProperty;
513
- var __getOwnPropSymbols$N = Object.getOwnPropertySymbols;
514
- var __hasOwnProp$N = Object.prototype.hasOwnProperty;
515
- var __propIsEnum$N = Object.prototype.propertyIsEnumerable;
516
- var __defNormalProp$N = (obj, key, value) => key in obj ? __defProp$N(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
517
- var __spreadValues$N = (a, b) => {
512
+ var __defProp$O = Object.defineProperty;
513
+ var __getOwnPropSymbols$O = Object.getOwnPropertySymbols;
514
+ var __hasOwnProp$O = Object.prototype.hasOwnProperty;
515
+ var __propIsEnum$O = Object.prototype.propertyIsEnumerable;
516
+ var __defNormalProp$O = (obj, key, value) => key in obj ? __defProp$O(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
517
+ var __spreadValues$O = (a, b) => {
518
518
  for (var prop in b || (b = {}))
519
- if (__hasOwnProp$N.call(b, prop))
520
- __defNormalProp$N(a, prop, b[prop]);
521
- if (__getOwnPropSymbols$N)
522
- for (var prop of __getOwnPropSymbols$N(b)) {
523
- if (__propIsEnum$N.call(b, prop))
524
- __defNormalProp$N(a, prop, b[prop]);
519
+ if (__hasOwnProp$O.call(b, prop))
520
+ __defNormalProp$O(a, prop, b[prop]);
521
+ if (__getOwnPropSymbols$O)
522
+ for (var prop of __getOwnPropSymbols$O(b)) {
523
+ if (__propIsEnum$O.call(b, prop))
524
+ __defNormalProp$O(a, prop, b[prop]);
525
525
  }
526
526
  return a;
527
527
  };
@@ -530,7 +530,7 @@ function cloneSceneObject(sceneObject, withState) {
530
530
  return new sceneObject.constructor(clonedState);
531
531
  }
532
532
  function cloneSceneObjectState(sceneState, withState) {
533
- const clonedState = __spreadValues$N({}, sceneState);
533
+ const clonedState = __spreadValues$O({}, sceneState);
534
534
  Object.assign(clonedState, withState);
535
535
  for (const key in clonedState) {
536
536
  if (withState && withState[key] !== void 0) {
@@ -811,21 +811,21 @@ function calculateNetworkTime(requests) {
811
811
  return totalNetworkTime;
812
812
  }
813
813
 
814
- var __defProp$M = Object.defineProperty;
814
+ var __defProp$N = Object.defineProperty;
815
815
  var __defProps$w = Object.defineProperties;
816
816
  var __getOwnPropDescs$w = Object.getOwnPropertyDescriptors;
817
- var __getOwnPropSymbols$M = Object.getOwnPropertySymbols;
818
- var __hasOwnProp$M = Object.prototype.hasOwnProperty;
819
- var __propIsEnum$M = Object.prototype.propertyIsEnumerable;
820
- var __defNormalProp$M = (obj, key, value) => key in obj ? __defProp$M(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
821
- var __spreadValues$M = (a, b) => {
817
+ var __getOwnPropSymbols$N = Object.getOwnPropertySymbols;
818
+ var __hasOwnProp$N = Object.prototype.hasOwnProperty;
819
+ var __propIsEnum$N = Object.prototype.propertyIsEnumerable;
820
+ var __defNormalProp$N = (obj, key, value) => key in obj ? __defProp$N(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
821
+ var __spreadValues$N = (a, b) => {
822
822
  for (var prop in b || (b = {}))
823
- if (__hasOwnProp$M.call(b, prop))
824
- __defNormalProp$M(a, prop, b[prop]);
825
- if (__getOwnPropSymbols$M)
826
- for (var prop of __getOwnPropSymbols$M(b)) {
827
- if (__propIsEnum$M.call(b, prop))
828
- __defNormalProp$M(a, prop, b[prop]);
823
+ if (__hasOwnProp$N.call(b, prop))
824
+ __defNormalProp$N(a, prop, b[prop]);
825
+ if (__getOwnPropSymbols$N)
826
+ for (var prop of __getOwnPropSymbols$N(b)) {
827
+ if (__propIsEnum$N.call(b, prop))
828
+ __defNormalProp$N(a, prop, b[prop]);
829
829
  }
830
830
  return a;
831
831
  };
@@ -854,7 +854,7 @@ function isQueryController(s) {
854
854
  }
855
855
  class SceneQueryController extends SceneObjectBase {
856
856
  constructor(state = {}) {
857
- super(__spreadProps$w(__spreadValues$M({}, state), { isRunning: false }));
857
+ super(__spreadProps$w(__spreadValues$N({}, state), { isRunning: false }));
858
858
  this.isQueryController = true;
859
859
  this.profiler = new SceneRenderProfiler(this);
860
860
  __privateAdd$2(this, _running, /* @__PURE__ */ new Set());
@@ -935,25 +935,25 @@ function getQueryController(sceneObject) {
935
935
  return void 0;
936
936
  }
937
937
 
938
- var __defProp$L = Object.defineProperty;
939
- var __getOwnPropSymbols$L = Object.getOwnPropertySymbols;
940
- var __hasOwnProp$L = Object.prototype.hasOwnProperty;
941
- var __propIsEnum$L = Object.prototype.propertyIsEnumerable;
942
- var __defNormalProp$L = (obj, key, value) => key in obj ? __defProp$L(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
943
- var __spreadValues$L = (a, b) => {
938
+ var __defProp$M = Object.defineProperty;
939
+ var __getOwnPropSymbols$M = Object.getOwnPropertySymbols;
940
+ var __hasOwnProp$M = Object.prototype.hasOwnProperty;
941
+ var __propIsEnum$M = Object.prototype.propertyIsEnumerable;
942
+ var __defNormalProp$M = (obj, key, value) => key in obj ? __defProp$M(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
943
+ var __spreadValues$M = (a, b) => {
944
944
  for (var prop in b || (b = {}))
945
- if (__hasOwnProp$L.call(b, prop))
946
- __defNormalProp$L(a, prop, b[prop]);
947
- if (__getOwnPropSymbols$L)
948
- for (var prop of __getOwnPropSymbols$L(b)) {
949
- if (__propIsEnum$L.call(b, prop))
950
- __defNormalProp$L(a, prop, b[prop]);
945
+ if (__hasOwnProp$M.call(b, prop))
946
+ __defNormalProp$M(a, prop, b[prop]);
947
+ if (__getOwnPropSymbols$M)
948
+ for (var prop of __getOwnPropSymbols$M(b)) {
949
+ if (__propIsEnum$M.call(b, prop))
950
+ __defNormalProp$M(a, prop, b[prop]);
951
951
  }
952
952
  return a;
953
953
  };
954
954
  class SceneDataNode extends SceneObjectBase {
955
955
  constructor(state) {
956
- super(__spreadValues$L({
956
+ super(__spreadValues$M({
957
957
  data: emptyPanelData
958
958
  }, state));
959
959
  }
@@ -1087,19 +1087,19 @@ function isValid$1(value, roundUp, timeZone) {
1087
1087
  return parsed.isValid();
1088
1088
  }
1089
1089
 
1090
- var __defProp$K = Object.defineProperty;
1091
- var __getOwnPropSymbols$K = Object.getOwnPropertySymbols;
1092
- var __hasOwnProp$K = Object.prototype.hasOwnProperty;
1093
- var __propIsEnum$K = Object.prototype.propertyIsEnumerable;
1094
- var __defNormalProp$K = (obj, key, value) => key in obj ? __defProp$K(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1095
- var __spreadValues$K = (a, b) => {
1090
+ var __defProp$L = Object.defineProperty;
1091
+ var __getOwnPropSymbols$L = Object.getOwnPropertySymbols;
1092
+ var __hasOwnProp$L = Object.prototype.hasOwnProperty;
1093
+ var __propIsEnum$L = Object.prototype.propertyIsEnumerable;
1094
+ var __defNormalProp$L = (obj, key, value) => key in obj ? __defProp$L(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1095
+ var __spreadValues$L = (a, b) => {
1096
1096
  for (var prop in b || (b = {}))
1097
- if (__hasOwnProp$K.call(b, prop))
1098
- __defNormalProp$K(a, prop, b[prop]);
1099
- if (__getOwnPropSymbols$K)
1100
- for (var prop of __getOwnPropSymbols$K(b)) {
1101
- if (__propIsEnum$K.call(b, prop))
1102
- __defNormalProp$K(a, prop, b[prop]);
1097
+ if (__hasOwnProp$L.call(b, prop))
1098
+ __defNormalProp$L(a, prop, b[prop]);
1099
+ if (__getOwnPropSymbols$L)
1100
+ for (var prop of __getOwnPropSymbols$L(b)) {
1101
+ if (__propIsEnum$L.call(b, prop))
1102
+ __defNormalProp$L(a, prop, b[prop]);
1103
1103
  }
1104
1104
  return a;
1105
1105
  };
@@ -1118,7 +1118,7 @@ class SceneTimeRange extends SceneObjectBase {
1118
1118
  state.weekStart
1119
1119
  );
1120
1120
  const refreshOnActivate = (_a = state.refreshOnActivate) != null ? _a : { percent: 10 };
1121
- super(__spreadValues$K({ from, to, timeZone, value, refreshOnActivate }, state));
1121
+ super(__spreadValues$L({ from, to, timeZone, value, refreshOnActivate }, state));
1122
1122
  this._urlSync = new SceneObjectUrlSyncConfig(this, { keys: ["from", "to", "timezone", "time", "time.window"] });
1123
1123
  this.onTimeRangeChange = (timeRange) => {
1124
1124
  const update = {};
@@ -2116,21 +2116,21 @@ function collectAllVariables(sceneObject, record = {}) {
2116
2116
  return record;
2117
2117
  }
2118
2118
 
2119
- var __defProp$J = Object.defineProperty;
2119
+ var __defProp$K = Object.defineProperty;
2120
2120
  var __defProps$v = Object.defineProperties;
2121
2121
  var __getOwnPropDescs$v = Object.getOwnPropertyDescriptors;
2122
- var __getOwnPropSymbols$J = Object.getOwnPropertySymbols;
2123
- var __hasOwnProp$J = Object.prototype.hasOwnProperty;
2124
- var __propIsEnum$J = Object.prototype.propertyIsEnumerable;
2125
- var __defNormalProp$J = (obj, key, value) => key in obj ? __defProp$J(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2126
- var __spreadValues$J = (a, b) => {
2122
+ var __getOwnPropSymbols$K = Object.getOwnPropertySymbols;
2123
+ var __hasOwnProp$K = Object.prototype.hasOwnProperty;
2124
+ var __propIsEnum$K = Object.prototype.propertyIsEnumerable;
2125
+ var __defNormalProp$K = (obj, key, value) => key in obj ? __defProp$K(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2126
+ var __spreadValues$K = (a, b) => {
2127
2127
  for (var prop in b || (b = {}))
2128
- if (__hasOwnProp$J.call(b, prop))
2129
- __defNormalProp$J(a, prop, b[prop]);
2130
- if (__getOwnPropSymbols$J)
2131
- for (var prop of __getOwnPropSymbols$J(b)) {
2132
- if (__propIsEnum$J.call(b, prop))
2133
- __defNormalProp$J(a, prop, b[prop]);
2128
+ if (__hasOwnProp$K.call(b, prop))
2129
+ __defNormalProp$K(a, prop, b[prop]);
2130
+ if (__getOwnPropSymbols$K)
2131
+ for (var prop of __getOwnPropSymbols$K(b)) {
2132
+ if (__propIsEnum$K.call(b, prop))
2133
+ __defNormalProp$K(a, prop, b[prop]);
2134
2134
  }
2135
2135
  return a;
2136
2136
  };
@@ -2150,7 +2150,7 @@ function getTemplateProxyForField(field, frame, frames) {
2150
2150
  if (!field.labels) {
2151
2151
  return "";
2152
2152
  }
2153
- return __spreadProps$v(__spreadValues$J({}, field.labels), {
2153
+ return __spreadProps$v(__spreadValues$K({}, field.labels), {
2154
2154
  __values: Object.values(field.labels).sort().join(", "),
2155
2155
  toString: () => {
2156
2156
  return data.formatLabels(field.labels, "", true);
@@ -2646,21 +2646,21 @@ function isExtraQueryProvider(obj) {
2646
2646
  return typeof obj === "object" && "getExtraQueries" in obj;
2647
2647
  }
2648
2648
 
2649
- var __defProp$I = Object.defineProperty;
2649
+ var __defProp$J = Object.defineProperty;
2650
2650
  var __defProps$u = Object.defineProperties;
2651
2651
  var __getOwnPropDescs$u = Object.getOwnPropertyDescriptors;
2652
- var __getOwnPropSymbols$I = Object.getOwnPropertySymbols;
2653
- var __hasOwnProp$I = Object.prototype.hasOwnProperty;
2654
- var __propIsEnum$I = Object.prototype.propertyIsEnumerable;
2655
- var __defNormalProp$I = (obj, key, value) => key in obj ? __defProp$I(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2656
- var __spreadValues$I = (a, b) => {
2652
+ var __getOwnPropSymbols$J = Object.getOwnPropertySymbols;
2653
+ var __hasOwnProp$J = Object.prototype.hasOwnProperty;
2654
+ var __propIsEnum$J = Object.prototype.propertyIsEnumerable;
2655
+ var __defNormalProp$J = (obj, key, value) => key in obj ? __defProp$J(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2656
+ var __spreadValues$J = (a, b) => {
2657
2657
  for (var prop in b || (b = {}))
2658
- if (__hasOwnProp$I.call(b, prop))
2659
- __defNormalProp$I(a, prop, b[prop]);
2660
- if (__getOwnPropSymbols$I)
2661
- for (var prop of __getOwnPropSymbols$I(b)) {
2662
- if (__propIsEnum$I.call(b, prop))
2663
- __defNormalProp$I(a, prop, b[prop]);
2658
+ if (__hasOwnProp$J.call(b, prop))
2659
+ __defNormalProp$J(a, prop, b[prop]);
2660
+ if (__getOwnPropSymbols$J)
2661
+ for (var prop of __getOwnPropSymbols$J(b)) {
2662
+ if (__propIsEnum$J.call(b, prop))
2663
+ __defNormalProp$J(a, prop, b[prop]);
2664
2664
  }
2665
2665
  return a;
2666
2666
  };
@@ -2677,7 +2677,7 @@ const extraQueryProcessingOperator = (processors) => (data) => {
2677
2677
  }),
2678
2678
  rxjs.map(([primary, ...processedSecondaries]) => {
2679
2679
  var _a;
2680
- return __spreadProps$u(__spreadValues$I({}, primary), {
2680
+ return __spreadProps$u(__spreadValues$J({}, primary), {
2681
2681
  series: [...primary.series, ...processedSecondaries.flatMap((s) => s.series)],
2682
2682
  annotations: [...(_a = primary.annotations) != null ? _a : [], ...processedSecondaries.flatMap((s) => {
2683
2683
  var _a2;
@@ -2688,21 +2688,21 @@ const extraQueryProcessingOperator = (processors) => (data) => {
2688
2688
  );
2689
2689
  };
2690
2690
 
2691
- var __defProp$H = Object.defineProperty;
2691
+ var __defProp$I = Object.defineProperty;
2692
2692
  var __defProps$t = Object.defineProperties;
2693
2693
  var __getOwnPropDescs$t = Object.getOwnPropertyDescriptors;
2694
- var __getOwnPropSymbols$H = Object.getOwnPropertySymbols;
2695
- var __hasOwnProp$H = Object.prototype.hasOwnProperty;
2696
- var __propIsEnum$H = Object.prototype.propertyIsEnumerable;
2697
- var __defNormalProp$H = (obj, key, value) => key in obj ? __defProp$H(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2698
- var __spreadValues$H = (a, b) => {
2694
+ var __getOwnPropSymbols$I = Object.getOwnPropertySymbols;
2695
+ var __hasOwnProp$I = Object.prototype.hasOwnProperty;
2696
+ var __propIsEnum$I = Object.prototype.propertyIsEnumerable;
2697
+ var __defNormalProp$I = (obj, key, value) => key in obj ? __defProp$I(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2698
+ var __spreadValues$I = (a, b) => {
2699
2699
  for (var prop in b || (b = {}))
2700
- if (__hasOwnProp$H.call(b, prop))
2701
- __defNormalProp$H(a, prop, b[prop]);
2702
- if (__getOwnPropSymbols$H)
2703
- for (var prop of __getOwnPropSymbols$H(b)) {
2704
- if (__propIsEnum$H.call(b, prop))
2705
- __defNormalProp$H(a, prop, b[prop]);
2700
+ if (__hasOwnProp$I.call(b, prop))
2701
+ __defNormalProp$I(a, prop, b[prop]);
2702
+ if (__getOwnPropSymbols$I)
2703
+ for (var prop of __getOwnPropSymbols$I(b)) {
2704
+ if (__propIsEnum$I.call(b, prop))
2705
+ __defNormalProp$I(a, prop, b[prop]);
2706
2706
  }
2707
2707
  return a;
2708
2708
  };
@@ -2758,11 +2758,11 @@ function filterAnnotations(data, filters) {
2758
2758
  continue;
2759
2759
  }
2760
2760
  }
2761
- fields.push(__spreadProps$t(__spreadValues$H({}, field), {
2761
+ fields.push(__spreadProps$t(__spreadValues$I({}, field), {
2762
2762
  values: buffer
2763
2763
  }));
2764
2764
  }
2765
- processed.push(__spreadProps$t(__spreadValues$H({}, frame), {
2765
+ processed.push(__spreadProps$t(__spreadValues$I({}, frame), {
2766
2766
  fields,
2767
2767
  length: frameLength
2768
2768
  }));
@@ -2843,21 +2843,21 @@ function getOptionSearcher(options, includeAll = false) {
2843
2843
  return (search) => fuzzySearch(search).map((i) => allOptions[i]);
2844
2844
  }
2845
2845
 
2846
- var __defProp$G = Object.defineProperty;
2846
+ var __defProp$H = Object.defineProperty;
2847
2847
  var __defProps$s = Object.defineProperties;
2848
2848
  var __getOwnPropDescs$s = Object.getOwnPropertyDescriptors;
2849
- var __getOwnPropSymbols$G = Object.getOwnPropertySymbols;
2850
- var __hasOwnProp$G = Object.prototype.hasOwnProperty;
2851
- var __propIsEnum$G = Object.prototype.propertyIsEnumerable;
2852
- var __defNormalProp$G = (obj, key, value) => key in obj ? __defProp$G(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2853
- var __spreadValues$G = (a, b) => {
2849
+ var __getOwnPropSymbols$H = Object.getOwnPropertySymbols;
2850
+ var __hasOwnProp$H = Object.prototype.hasOwnProperty;
2851
+ var __propIsEnum$H = Object.prototype.propertyIsEnumerable;
2852
+ var __defNormalProp$H = (obj, key, value) => key in obj ? __defProp$H(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2853
+ var __spreadValues$H = (a, b) => {
2854
2854
  for (var prop in b || (b = {}))
2855
- if (__hasOwnProp$G.call(b, prop))
2856
- __defNormalProp$G(a, prop, b[prop]);
2857
- if (__getOwnPropSymbols$G)
2858
- for (var prop of __getOwnPropSymbols$G(b)) {
2859
- if (__propIsEnum$G.call(b, prop))
2860
- __defNormalProp$G(a, prop, b[prop]);
2855
+ if (__hasOwnProp$H.call(b, prop))
2856
+ __defNormalProp$H(a, prop, b[prop]);
2857
+ if (__getOwnPropSymbols$H)
2858
+ for (var prop of __getOwnPropSymbols$H(b)) {
2859
+ if (__propIsEnum$H.call(b, prop))
2860
+ __defNormalProp$H(a, prop, b[prop]);
2861
2861
  }
2862
2862
  return a;
2863
2863
  };
@@ -2865,11 +2865,11 @@ var __spreadProps$s = (a, b) => __defProps$s(a, __getOwnPropDescs$s(b));
2865
2865
  var __objRest$4 = (source, exclude) => {
2866
2866
  var target = {};
2867
2867
  for (var prop in source)
2868
- if (__hasOwnProp$G.call(source, prop) && exclude.indexOf(prop) < 0)
2868
+ if (__hasOwnProp$H.call(source, prop) && exclude.indexOf(prop) < 0)
2869
2869
  target[prop] = source[prop];
2870
- if (source != null && __getOwnPropSymbols$G)
2871
- for (var prop of __getOwnPropSymbols$G(source)) {
2872
- if (exclude.indexOf(prop) < 0 && __propIsEnum$G.call(source, prop))
2870
+ if (source != null && __getOwnPropSymbols$H)
2871
+ for (var prop of __getOwnPropSymbols$H(source)) {
2872
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$H.call(source, prop))
2873
2873
  target[prop] = source[prop];
2874
2874
  }
2875
2875
  return target;
@@ -3030,7 +3030,7 @@ const OptionWithCheckbox = ({
3030
3030
  const theme = ui.useTheme2();
3031
3031
  const selectStyles = ui.getSelectStyles(theme);
3032
3032
  const optionStyles = ui.useStyles2(getOptionStyles);
3033
- return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$s(__spreadValues$G({
3033
+ return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$s(__spreadValues$H({
3034
3034
  ref: innerRef,
3035
3035
  className: css.cx(selectStyles.option, isFocused && selectStyles.optionFocused)
3036
3036
  }, rest), {
@@ -3195,28 +3195,28 @@ function wrapInSafeSerializableSceneObject(sceneObject) {
3195
3195
  return { value: sceneObject, text: "__sceneObject" };
3196
3196
  }
3197
3197
 
3198
- var __defProp$F = Object.defineProperty;
3198
+ var __defProp$G = Object.defineProperty;
3199
3199
  var __defProps$r = Object.defineProperties;
3200
3200
  var __getOwnPropDescs$r = Object.getOwnPropertyDescriptors;
3201
- var __getOwnPropSymbols$F = Object.getOwnPropertySymbols;
3202
- var __hasOwnProp$F = Object.prototype.hasOwnProperty;
3203
- var __propIsEnum$F = Object.prototype.propertyIsEnumerable;
3204
- var __defNormalProp$F = (obj, key, value) => key in obj ? __defProp$F(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3205
- var __spreadValues$F = (a, b) => {
3201
+ var __getOwnPropSymbols$G = Object.getOwnPropertySymbols;
3202
+ var __hasOwnProp$G = Object.prototype.hasOwnProperty;
3203
+ var __propIsEnum$G = Object.prototype.propertyIsEnumerable;
3204
+ var __defNormalProp$G = (obj, key, value) => key in obj ? __defProp$G(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3205
+ var __spreadValues$G = (a, b) => {
3206
3206
  for (var prop in b || (b = {}))
3207
- if (__hasOwnProp$F.call(b, prop))
3208
- __defNormalProp$F(a, prop, b[prop]);
3209
- if (__getOwnPropSymbols$F)
3210
- for (var prop of __getOwnPropSymbols$F(b)) {
3211
- if (__propIsEnum$F.call(b, prop))
3212
- __defNormalProp$F(a, prop, b[prop]);
3207
+ if (__hasOwnProp$G.call(b, prop))
3208
+ __defNormalProp$G(a, prop, b[prop]);
3209
+ if (__getOwnPropSymbols$G)
3210
+ for (var prop of __getOwnPropSymbols$G(b)) {
3211
+ if (__propIsEnum$G.call(b, prop))
3212
+ __defNormalProp$G(a, prop, b[prop]);
3213
3213
  }
3214
3214
  return a;
3215
3215
  };
3216
3216
  var __spreadProps$r = (a, b) => __defProps$r(a, __getOwnPropDescs$r(b));
3217
3217
  class GroupByVariable extends MultiValueVariable {
3218
3218
  constructor(initialState) {
3219
- super(__spreadProps$r(__spreadValues$F({
3219
+ super(__spreadProps$r(__spreadValues$G({
3220
3220
  isMulti: true,
3221
3221
  name: "",
3222
3222
  value: [],
@@ -3247,7 +3247,7 @@ class GroupByVariable extends MultiValueVariable {
3247
3247
  const queries = getQueriesForVariables(this);
3248
3248
  const otherFilters = this.state.baseFilters || [];
3249
3249
  const timeRange = sceneGraph.getTimeRange(this).state.value;
3250
- const response = await ds.getTagKeys(__spreadValues$F({
3250
+ const response = await ds.getTagKeys(__spreadValues$G({
3251
3251
  filters: otherFilters,
3252
3252
  queries,
3253
3253
  timeRange
@@ -3608,19 +3608,19 @@ function getAdhocOptionSearcher(options) {
3608
3608
  return (search) => fuzzySearch(search).map((i) => options[i]);
3609
3609
  }
3610
3610
 
3611
- var __defProp$E = Object.defineProperty;
3612
- var __getOwnPropSymbols$E = Object.getOwnPropertySymbols;
3613
- var __hasOwnProp$E = Object.prototype.hasOwnProperty;
3614
- var __propIsEnum$E = Object.prototype.propertyIsEnumerable;
3615
- var __defNormalProp$E = (obj, key, value) => key in obj ? __defProp$E(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3616
- var __spreadValues$E = (a, b) => {
3611
+ var __defProp$F = Object.defineProperty;
3612
+ var __getOwnPropSymbols$F = Object.getOwnPropertySymbols;
3613
+ var __hasOwnProp$F = Object.prototype.hasOwnProperty;
3614
+ var __propIsEnum$F = Object.prototype.propertyIsEnumerable;
3615
+ var __defNormalProp$F = (obj, key, value) => key in obj ? __defProp$F(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3616
+ var __spreadValues$F = (a, b) => {
3617
3617
  for (var prop in b || (b = {}))
3618
- if (__hasOwnProp$E.call(b, prop))
3619
- __defNormalProp$E(a, prop, b[prop]);
3620
- if (__getOwnPropSymbols$E)
3621
- for (var prop of __getOwnPropSymbols$E(b)) {
3622
- if (__propIsEnum$E.call(b, prop))
3623
- __defNormalProp$E(a, prop, b[prop]);
3618
+ if (__hasOwnProp$F.call(b, prop))
3619
+ __defNormalProp$F(a, prop, b[prop]);
3620
+ if (__getOwnPropSymbols$F)
3621
+ for (var prop of __getOwnPropSymbols$F(b)) {
3622
+ if (__propIsEnum$F.call(b, prop))
3623
+ __defNormalProp$F(a, prop, b[prop]);
3624
3624
  }
3625
3625
  return a;
3626
3626
  };
@@ -3632,7 +3632,7 @@ function keyLabelToOption(key, label) {
3632
3632
  }
3633
3633
  const filterNoOp = () => true;
3634
3634
  function AdHocFilterRenderer({ filter, model }) {
3635
- var _a, _b, _c;
3635
+ var _a, _b, _c, _d, _e;
3636
3636
  const styles = ui.useStyles2(getStyles$f);
3637
3637
  const [keys, setKeys] = React.useState([]);
3638
3638
  const [values, setValues] = React.useState([]);
@@ -3709,10 +3709,9 @@ function AdHocFilterRenderer({ filter, model }) {
3709
3709
  });
3710
3710
  }
3711
3711
  };
3712
- const valueSelect = /* @__PURE__ */ React__default["default"].createElement(ui.Select, __spreadValues$E({
3712
+ const valueSelect = /* @__PURE__ */ React__default["default"].createElement(ui.Select, __spreadValues$F({
3713
3713
  virtualized: true,
3714
- allowCustomValue: model.state.allowCustomValue !== false,
3715
- createOptionPosition: model.state.allowCustomValue === "first" ? "first" : "last",
3714
+ allowCustomValue: (_b = model.state.allowCustomValue) != null ? _b : true,
3716
3715
  isValidNewOption: (inputValue) => inputValue.trim().length > 0,
3717
3716
  allowCreateWhileLoading: true,
3718
3717
  formatCreateLabel: (inputValue) => `Use custom value: ${inputValue}`,
@@ -3762,8 +3761,7 @@ function AdHocFilterRenderer({ filter, model }) {
3762
3761
  disabled: model.state.readOnly,
3763
3762
  className: css.cx(styles.key, isKeysOpen ? styles.widthWhenOpen : void 0),
3764
3763
  width: "auto",
3765
- allowCustomValue: model.state.allowCustomValue !== false,
3766
- createOptionPosition: model.state.allowCustomValue === "first" ? "first" : "last",
3764
+ allowCustomValue: (_c = model.state.allowCustomValue) != null ? _c : true,
3767
3765
  value: keyValue,
3768
3766
  placeholder: "Select label",
3769
3767
  options: handleOptionGroups(keys),
@@ -3816,7 +3814,7 @@ function AdHocFilterRenderer({ filter, model }) {
3816
3814
  if (filter.key) {
3817
3815
  const label = /* @__PURE__ */ React__default["default"].createElement(ControlsLabel, {
3818
3816
  layout: "vertical",
3819
- label: (_b = filter.key) != null ? _b : "",
3817
+ label: (_d = filter.key) != null ? _d : "",
3820
3818
  onRemove: () => model._removeFilter(filter)
3821
3819
  });
3822
3820
  return /* @__PURE__ */ React__default["default"].createElement(ui.Field, {
@@ -3843,7 +3841,7 @@ function AdHocFilterRenderer({ filter, model }) {
3843
3841
  title: "Remove filter",
3844
3842
  className: styles.removeButton,
3845
3843
  icon: "times",
3846
- "data-testid": `AdHocFilter-remove-${(_c = filter.key) != null ? _c : ""}`,
3844
+ "data-testid": `AdHocFilter-remove-${(_e = filter.key) != null ? _e : ""}`,
3847
3845
  onClick: () => model._removeFilter(filter)
3848
3846
  }));
3849
3847
  }
@@ -3925,31 +3923,72 @@ function AdHocFilterBuilder({ model, addFilterButtonText }) {
3925
3923
  });
3926
3924
  }
3927
3925
 
3926
+ var __defProp$E = Object.defineProperty;
3927
+ var __getOwnPropSymbols$E = Object.getOwnPropertySymbols;
3928
+ var __hasOwnProp$E = Object.prototype.hasOwnProperty;
3929
+ var __propIsEnum$E = Object.prototype.propertyIsEnumerable;
3930
+ var __defNormalProp$E = (obj, key, value) => key in obj ? __defProp$E(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3931
+ var __spreadValues$E = (a, b) => {
3932
+ for (var prop in b || (b = {}))
3933
+ if (__hasOwnProp$E.call(b, prop))
3934
+ __defNormalProp$E(a, prop, b[prop]);
3935
+ if (__getOwnPropSymbols$E)
3936
+ for (var prop of __getOwnPropSymbols$E(b)) {
3937
+ if (__propIsEnum$E.call(b, prop))
3938
+ __defNormalProp$E(a, prop, b[prop]);
3939
+ }
3940
+ return a;
3941
+ };
3928
3942
  class AdHocFiltersVariableUrlSyncHandler {
3929
3943
  constructor(_variable) {
3930
3944
  this._variable = _variable;
3931
3945
  }
3946
+ getInjectedKey() {
3947
+ return `var-injected-${this._variable.state.name}`;
3948
+ }
3932
3949
  getKey() {
3933
3950
  return `var-${this._variable.state.name}`;
3934
3951
  }
3935
3952
  getKeys() {
3936
- return [this.getKey()];
3953
+ return [this.getKey(), this.getInjectedKey()];
3937
3954
  }
3938
3955
  getUrlState() {
3939
3956
  const filters = this._variable.state.filters;
3940
- if (filters.length === 0) {
3941
- return { [this.getKey()]: [""] };
3957
+ const baseFilters = this._variable.state.baseFilters;
3958
+ let value = [""];
3959
+ let baseValue = [""];
3960
+ if (filters.length === 0 && (baseFilters == null ? void 0 : baseFilters.length) === 0) {
3961
+ return { [this.getKey()]: value };
3962
+ }
3963
+ if (filters.length) {
3964
+ value = filters.filter(isFilterComplete).filter((filter) => !filter.hidden).map((filter) => toArray(filter).map(escapeUrlPipeDelimiters).join("|"));
3965
+ }
3966
+ if (baseFilters == null ? void 0 : baseFilters.length) {
3967
+ baseValue = baseFilters == null ? void 0 : baseFilters.filter(isFilterComplete).filter((filter) => !filter.hidden && filter.origin).map(
3968
+ (filter) => {
3969
+ var _a, _b;
3970
+ return toArray(filter).map(escapeUrlPipeDelimiters).join("|").concat(`\\${(_b = (_a = filter.originalValue) == null ? void 0 : _a.map(escapeUrlPipeDelimiters).join("|")) != null ? _b : ""}\\${filter.origin}`);
3971
+ }
3972
+ );
3942
3973
  }
3943
- const value = filters.filter(isFilterComplete).filter((filter) => !filter.hidden).map((filter) => toArray(filter).map(escapeUrlPipeDelimiters).join("|"));
3944
- return { [this.getKey()]: value };
3974
+ return __spreadValues$E({
3975
+ [this.getKey()]: value
3976
+ }, (baseFilters == null ? void 0 : baseFilters.length) ? { [this.getInjectedKey()]: baseValue } : {});
3945
3977
  }
3946
3978
  updateFromUrl(values) {
3947
3979
  const urlValue = values[this.getKey()];
3948
- if (urlValue == null) {
3980
+ const urlValueBaseFilters = values[this.getInjectedKey()];
3981
+ if (urlValue == null && urlValueBaseFilters == null) {
3949
3982
  return;
3950
3983
  }
3951
- const filters = deserializeUrlToFilters(urlValue);
3952
- this._variable.setState({ filters });
3984
+ if (urlValue) {
3985
+ const filters = deserializeUrlToFilters(urlValue);
3986
+ this._variable.setState({ filters });
3987
+ }
3988
+ if (urlValueBaseFilters) {
3989
+ const baseFilters = deserializeUrlToFilters(urlValueBaseFilters);
3990
+ this._variable.setState({ baseFilters });
3991
+ }
3953
3992
  }
3954
3993
  }
3955
3994
  function deserializeUrlToFilters(value) {
@@ -3974,10 +4013,12 @@ function toArray(filter) {
3974
4013
  return result;
3975
4014
  }
3976
4015
  function toFilter(urlValue) {
4016
+ var _a;
3977
4017
  if (typeof urlValue !== "string" || urlValue.length === 0) {
3978
4018
  return null;
3979
4019
  }
3980
- const [key, keyLabel, operator, _operatorLabel, ...values] = urlValue.split("|").reduce((acc, v) => {
4020
+ const [filter, originalValues, origin] = urlValue.split("\\");
4021
+ const [key, keyLabel, operator, _operatorLabel, ...values] = filter.split("|").reduce((acc, v) => {
3981
4022
  const [key2, label] = v.split(",");
3982
4023
  acc.push(key2, label != null ? label : key2);
3983
4024
  return acc;
@@ -3989,9 +4030,14 @@ function toFilter(urlValue) {
3989
4030
  value: values[0],
3990
4031
  values: isMultiValueOperator(operator) ? values.filter((_, index) => index % 2 === 0) : void 0,
3991
4032
  valueLabels: values.filter((_, index) => index % 2 === 1),
3992
- condition: ""
4033
+ condition: "",
4034
+ origin: isFilterOrigin(origin) ? origin : void 0,
4035
+ originalValue: originalValues && originalValues.length ? (_a = originalValues.split("|")) != null ? _a : [originalValues] : void 0
3993
4036
  };
3994
4037
  }
4038
+ function isFilterOrigin(value) {
4039
+ return value === FilterOrigin.Scopes || value === FilterOrigin.Dashboards;
4040
+ }
3995
4041
  function isFilter(filter) {
3996
4042
  return filter !== null && typeof filter.key === "string" && typeof filter.value === "string";
3997
4043
  }
@@ -4614,19 +4660,11 @@ const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model,
4614
4660
  handleOptionGroups(optionsSearcher(preventFiltering ? "" : inputValue, filterInputType))
4615
4661
  );
4616
4662
  if (allowCustomValue && filterInputType !== "operator" && inputValue) {
4617
- if (allowCustomValue === "first") {
4618
- filteredDropDownItems.unshift({
4619
- value: inputValue.trim(),
4620
- label: inputValue.trim(),
4621
- isCustom: true
4622
- });
4623
- } else {
4624
- filteredDropDownItems.push({
4625
- value: inputValue.trim(),
4626
- label: inputValue.trim(),
4627
- isCustom: true
4628
- });
4629
- }
4663
+ filteredDropDownItems.push({
4664
+ value: inputValue.trim(),
4665
+ label: inputValue.trim(),
4666
+ isCustom: true
4667
+ });
4630
4668
  }
4631
4669
  const onAddCustomValue = model.state.onAddCustomValue;
4632
4670
  const maxOptionWidth = setupDropdownAccessibility(filteredDropDownItems, listRef, disabledIndicesRef);
@@ -5132,13 +5170,13 @@ function AdHocFilterPill({ filter, model, readOnly, focusOnWipInputRef }) {
5132
5170
  const handleChangeViewMode = React.useCallback(
5133
5171
  (event, shouldFocusOnPillWrapperOverride) => {
5134
5172
  event == null ? void 0 : event.stopPropagation();
5135
- if (readOnly || filter.origin) {
5173
+ if (readOnly) {
5136
5174
  return;
5137
5175
  }
5138
5176
  setShouldFocusOnPillWrapper(shouldFocusOnPillWrapperOverride != null ? shouldFocusOnPillWrapperOverride : !viewMode);
5139
5177
  setViewMode(!viewMode);
5140
5178
  },
5141
- [readOnly, viewMode, filter.origin]
5179
+ [readOnly, viewMode]
5142
5180
  );
5143
5181
  React.useEffect(() => {
5144
5182
  var _a2;
@@ -5202,11 +5240,20 @@ function AdHocFilterPill({ filter, model, readOnly, focusOnWipInputRef }) {
5202
5240
  size: "md",
5203
5241
  className: styles.pillIcon,
5204
5242
  tooltip: `Remove filter with key ${keyLabel}`
5205
- }) : null, filter.origin && /* @__PURE__ */ React__default["default"].createElement(ui.IconButton, {
5243
+ }) : null, filter.origin && !filter.originalValue && /* @__PURE__ */ React__default["default"].createElement(ui.IconButton, {
5206
5244
  name: "info-circle",
5207
5245
  size: "md",
5208
5246
  className: styles.pillIcon,
5209
5247
  tooltip: `This is a ${filter.origin} injected filter`
5248
+ }), filter.origin && filter.originalValue && /* @__PURE__ */ React__default["default"].createElement(ui.IconButton, {
5249
+ onClick: (e) => {
5250
+ e.stopPropagation();
5251
+ model.restoreOriginalFilterValue(filter);
5252
+ },
5253
+ name: "history",
5254
+ size: "md",
5255
+ className: styles.pillIcon,
5256
+ tooltip: `Restore filter to its original value`
5210
5257
  }));
5211
5258
  }
5212
5259
  return /* @__PURE__ */ React__default["default"].createElement(AdHocCombobox, {
@@ -5404,14 +5451,17 @@ const OPERATORS = [
5404
5451
  ];
5405
5452
  class AdHocFiltersVariable extends SceneObjectBase {
5406
5453
  constructor(state) {
5407
- var _a, _b;
5454
+ var _a, _b, _c, _d, _e;
5408
5455
  super(__spreadValues$z({
5409
5456
  type: "adhoc",
5410
5457
  name: (_a = state.name) != null ? _a : "Filters",
5411
5458
  filters: [],
5412
5459
  datasource: null,
5413
5460
  applyMode: "auto",
5414
- filterExpression: (_b = state.filterExpression) != null ? _b : renderExpression(state.expressionBuilder, state.filters)
5461
+ filterExpression: (_e = state.filterExpression) != null ? _e : renderExpression(state.expressionBuilder, [
5462
+ ...(_c = (_b = state.baseFilters) == null ? void 0 : _b.filter((filter) => filter.origin)) != null ? _c : [],
5463
+ ...(_d = state.filters) != null ? _d : []
5464
+ ])
5415
5465
  }, state));
5416
5466
  this._scopedVars = { __sceneObject: wrapInSafeSerializableSceneObject(this) };
5417
5467
  this._dataSourceSrv = runtime.getDataSourceSrv();
@@ -5421,9 +5471,15 @@ class AdHocFiltersVariable extends SceneObjectBase {
5421
5471
  }
5422
5472
  }
5423
5473
  setState(update) {
5474
+ var _a, _b, _c;
5424
5475
  let filterExpressionChanged = false;
5425
- if (update.filters && update.filters !== this.state.filters && !update.filterExpression) {
5426
- update.filterExpression = renderExpression(this.state.expressionBuilder, update.filters);
5476
+ if ((update.filters && update.filters !== this.state.filters || update.baseFilters && update.baseFilters !== this.state.baseFilters) && !update.filterExpression) {
5477
+ const filters = (_a = update.filters) != null ? _a : this.state.filters;
5478
+ const baseFilters = (_b = update.baseFilters) != null ? _b : this.state.baseFilters;
5479
+ update.filterExpression = renderExpression(this.state.expressionBuilder, [
5480
+ ...(_c = baseFilters == null ? void 0 : baseFilters.filter((filter) => filter.origin)) != null ? _c : [],
5481
+ ...filters != null ? filters : []
5482
+ ]);
5427
5483
  filterExpressionChanged = update.filterExpression !== this.state.filterExpression;
5428
5484
  }
5429
5485
  super.setState(update);
@@ -5432,10 +5488,14 @@ class AdHocFiltersVariable extends SceneObjectBase {
5432
5488
  }
5433
5489
  }
5434
5490
  updateFilters(filters, options) {
5491
+ var _a, _b;
5435
5492
  let filterExpressionChanged = false;
5436
5493
  let filterExpression = void 0;
5437
5494
  if (filters && filters !== this.state.filters) {
5438
- filterExpression = renderExpression(this.state.expressionBuilder, filters);
5495
+ filterExpression = renderExpression(this.state.expressionBuilder, [
5496
+ ...(_b = (_a = this.state.baseFilters) == null ? void 0 : _a.filter((filter) => filter.origin)) != null ? _b : [],
5497
+ ...filters
5498
+ ]);
5439
5499
  filterExpressionChanged = filterExpression !== this.state.filterExpression;
5440
5500
  }
5441
5501
  super.setState({
@@ -5446,11 +5506,33 @@ class AdHocFiltersVariable extends SceneObjectBase {
5446
5506
  this.publishEvent(new SceneVariableValueChangedEvent(this), true);
5447
5507
  }
5448
5508
  }
5509
+ restoreOriginalFilterValue(filter) {
5510
+ const originalBaseFilter = filter.originalValue;
5511
+ if (originalBaseFilter == null ? void 0 : originalBaseFilter.length) {
5512
+ this._updateFilter(filter, {
5513
+ value: originalBaseFilter[0],
5514
+ values: originalBaseFilter,
5515
+ valueLabels: originalBaseFilter,
5516
+ originalValue: void 0
5517
+ });
5518
+ }
5519
+ }
5449
5520
  getValue() {
5450
5521
  return this.state.filterExpression;
5451
5522
  }
5452
5523
  _updateFilter(filter, update) {
5453
- const { filters, _wip } = this.state;
5524
+ var _a;
5525
+ const { baseFilters, filters, _wip } = this.state;
5526
+ if (filter.origin) {
5527
+ if (!filter.originalValue && !update.originalValue) {
5528
+ update.originalValue = filter.values ? filter.values : [filter.value];
5529
+ }
5530
+ const updatedBaseFilters = (_a = baseFilters == null ? void 0 : baseFilters.map((f) => {
5531
+ return f === filter ? __spreadValues$z(__spreadValues$z({}, f), update) : f;
5532
+ })) != null ? _a : [];
5533
+ this.setState({ baseFilters: updatedBaseFilters });
5534
+ return;
5535
+ }
5454
5536
  if (filter === _wip) {
5455
5537
  if ("value" in update && update["value"] !== "") {
5456
5538
  this.setState({ filters: [...filters, __spreadValues$z(__spreadValues$z({}, _wip), update)], _wip: void 0 });
@@ -5536,7 +5618,7 @@ class AdHocFiltersVariable extends SceneObjectBase {
5536
5618
  return keys.map(toSelectableValue);
5537
5619
  }
5538
5620
  async _getValuesFor(filter) {
5539
- var _a, _b, _c;
5621
+ var _a, _b, _c, _d;
5540
5622
  const override = await ((_b = (_a = this.state).getTagValuesProvider) == null ? void 0 : _b.call(_a, this, filter));
5541
5623
  if (override && override.replace) {
5542
5624
  return dataFromResponse(override.values).map(toSelectableValue);
@@ -5545,7 +5627,8 @@ class AdHocFiltersVariable extends SceneObjectBase {
5545
5627
  if (!ds || !ds.getTagValues) {
5546
5628
  return [];
5547
5629
  }
5548
- const otherFilters = this.state.filters.filter((f) => f.key !== filter.key).concat((_c = this.state.baseFilters) != null ? _c : []);
5630
+ const filteredBaseFilters = (_d = (_c = this.state.baseFilters) == null ? void 0 : _c.filter((f) => f.origin && f.key !== filter.key)) != null ? _d : [];
5631
+ const otherFilters = this.state.filters.filter((f) => f.key !== filter.key).concat(filteredBaseFilters);
5549
5632
  const timeRange = sceneGraph.getTimeRange(this).state.value;
5550
5633
  const queries = this.state.useQueriesAsFilterForOptions ? getQueriesForVariables(this) : void 0;
5551
5634
  const response = await ds.getTagValues(__spreadValues$z({