@grafana/scenes 5.5.2--canary.830.10005065313.0 → 5.6.1--canary.840.10038144895.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/esm/core/SceneTimeRange.js +13 -9
  3. package/dist/esm/core/SceneTimeRange.js.map +1 -1
  4. package/dist/esm/index.js +1 -0
  5. package/dist/esm/index.js.map +1 -1
  6. package/dist/esm/querying/SceneQueryRunner.js +2 -1
  7. package/dist/esm/querying/SceneQueryRunner.js.map +1 -1
  8. package/dist/esm/querying/layers/annotations/AnnotationsDataLayer.js +4 -1
  9. package/dist/esm/querying/layers/annotations/AnnotationsDataLayer.js.map +1 -1
  10. package/dist/esm/querying/layers/annotations/standardAnnotationQuery.js +2 -1
  11. package/dist/esm/querying/layers/annotations/standardAnnotationQuery.js.map +1 -1
  12. package/dist/esm/utils/SafeSerializableSceneObject.js +39 -0
  13. package/dist/esm/utils/SafeSerializableSceneObject.js.map +1 -0
  14. package/dist/esm/variables/adhoc/AdHocFilterRenderer.js +4 -1
  15. package/dist/esm/variables/adhoc/AdHocFilterRenderer.js.map +1 -1
  16. package/dist/esm/variables/adhoc/AdHocFiltersVariable.js +6 -13
  17. package/dist/esm/variables/adhoc/AdHocFiltersVariable.js.map +1 -1
  18. package/dist/esm/variables/groupby/GroupByVariable.js +8 -5
  19. package/dist/esm/variables/groupby/GroupByVariable.js.map +1 -1
  20. package/dist/esm/variables/variants/query/QueryVariable.js +3 -2
  21. package/dist/esm/variables/variants/query/QueryVariable.js.map +1 -1
  22. package/dist/index.d.ts +12 -5
  23. package/dist/index.js +288 -806
  24. package/dist/index.js.map +1 -1
  25. package/package.json +2 -3
  26. package/dist/esm/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersCombobox.js +0 -406
  27. package/dist/esm/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersCombobox.js.map +0 -1
  28. package/dist/esm/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersComboboxEditSwitch.js +0 -113
  29. package/dist/esm/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersComboboxEditSwitch.js.map +0 -1
  30. package/dist/esm/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersComboboxRenderer.js +0 -63
  31. package/dist/esm/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersComboboxRenderer.js.map +0 -1
package/dist/index.js CHANGED
@@ -14,8 +14,6 @@ var ui = require('@grafana/ui');
14
14
  var e2eSelectors = require('@grafana/e2e-selectors');
15
15
  var css = require('@emotion/css');
16
16
  var uFuzzy = require('@leeoniya/ufuzzy');
17
- var react = require('@floating-ui/react');
18
- var reactDom = require('react-dom');
19
17
  var reactUse = require('react-use');
20
18
  var operators = require('rxjs/operators');
21
19
  var ReactGridLayout = require('react-grid-layout');
@@ -43,19 +41,19 @@ var uFuzzy__default = /*#__PURE__*/_interopDefaultLegacy(uFuzzy);
43
41
  var ReactGridLayout__default = /*#__PURE__*/_interopDefaultLegacy(ReactGridLayout);
44
42
  var AutoSizer__default = /*#__PURE__*/_interopDefaultLegacy(AutoSizer);
45
43
 
46
- var __defProp$M = Object.defineProperty;
47
- var __getOwnPropSymbols$M = Object.getOwnPropertySymbols;
48
- var __hasOwnProp$M = Object.prototype.hasOwnProperty;
49
- var __propIsEnum$M = Object.prototype.propertyIsEnumerable;
50
- var __defNormalProp$M = (obj, key, value) => key in obj ? __defProp$M(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
51
- var __spreadValues$M = (a, b) => {
44
+ var __defProp$K = Object.defineProperty;
45
+ var __getOwnPropSymbols$K = Object.getOwnPropertySymbols;
46
+ var __hasOwnProp$K = Object.prototype.hasOwnProperty;
47
+ var __propIsEnum$K = Object.prototype.propertyIsEnumerable;
48
+ var __defNormalProp$K = (obj, key, value) => key in obj ? __defProp$K(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
49
+ var __spreadValues$K = (a, b) => {
52
50
  for (var prop in b || (b = {}))
53
- if (__hasOwnProp$M.call(b, prop))
54
- __defNormalProp$M(a, prop, b[prop]);
55
- if (__getOwnPropSymbols$M)
56
- for (var prop of __getOwnPropSymbols$M(b)) {
57
- if (__propIsEnum$M.call(b, prop))
58
- __defNormalProp$M(a, prop, b[prop]);
51
+ if (__hasOwnProp$K.call(b, prop))
52
+ __defNormalProp$K(a, prop, b[prop]);
53
+ if (__getOwnPropSymbols$K)
54
+ for (var prop of __getOwnPropSymbols$K(b)) {
55
+ if (__propIsEnum$K.call(b, prop))
56
+ __defNormalProp$K(a, prop, b[prop]);
59
57
  }
60
58
  return a;
61
59
  };
@@ -64,7 +62,7 @@ function useAppQueryParams() {
64
62
  return runtime.locationSearchToObject(location.search || "");
65
63
  }
66
64
  function getUrlWithAppState(path, preserveParams) {
67
- const paramsCopy = __spreadValues$M({}, runtime.locationService.getSearchObject());
65
+ const paramsCopy = __spreadValues$K({}, runtime.locationService.getSearchObject());
68
66
  if (preserveParams) {
69
67
  for (const key of Object.keys(paramsCopy)) {
70
68
  if (!preserveParams.includes(key)) {
@@ -78,31 +76,31 @@ function renderSceneComponentWithRouteProps(sceneObject, routeProps) {
78
76
  return React__default["default"].createElement(sceneObject.Component, { model: sceneObject, routeProps });
79
77
  }
80
78
 
81
- var __defProp$L = Object.defineProperty;
82
- var __defProps$v = Object.defineProperties;
83
- var __getOwnPropDescs$v = Object.getOwnPropertyDescriptors;
84
- var __getOwnPropSymbols$L = Object.getOwnPropertySymbols;
85
- var __hasOwnProp$L = Object.prototype.hasOwnProperty;
86
- var __propIsEnum$L = Object.prototype.propertyIsEnumerable;
87
- var __defNormalProp$L = (obj, key, value) => key in obj ? __defProp$L(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
88
- var __spreadValues$L = (a, b) => {
79
+ var __defProp$J = Object.defineProperty;
80
+ var __defProps$t = Object.defineProperties;
81
+ var __getOwnPropDescs$t = Object.getOwnPropertyDescriptors;
82
+ var __getOwnPropSymbols$J = Object.getOwnPropertySymbols;
83
+ var __hasOwnProp$J = Object.prototype.hasOwnProperty;
84
+ var __propIsEnum$J = Object.prototype.propertyIsEnumerable;
85
+ var __defNormalProp$J = (obj, key, value) => key in obj ? __defProp$J(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
86
+ var __spreadValues$J = (a, b) => {
89
87
  for (var prop in b || (b = {}))
90
- if (__hasOwnProp$L.call(b, prop))
91
- __defNormalProp$L(a, prop, b[prop]);
92
- if (__getOwnPropSymbols$L)
93
- for (var prop of __getOwnPropSymbols$L(b)) {
94
- if (__propIsEnum$L.call(b, prop))
95
- __defNormalProp$L(a, prop, b[prop]);
88
+ if (__hasOwnProp$J.call(b, prop))
89
+ __defNormalProp$J(a, prop, b[prop]);
90
+ if (__getOwnPropSymbols$J)
91
+ for (var prop of __getOwnPropSymbols$J(b)) {
92
+ if (__propIsEnum$J.call(b, prop))
93
+ __defNormalProp$J(a, prop, b[prop]);
96
94
  }
97
95
  return a;
98
96
  };
99
- var __spreadProps$v = (a, b) => __defProps$v(a, __getOwnPropDescs$v(b));
97
+ var __spreadProps$t = (a, b) => __defProps$t(a, __getOwnPropDescs$t(b));
100
98
  const runtimePanelPlugins = /* @__PURE__ */ new Map();
101
99
  function registerRuntimePanelPlugin({ pluginId, plugin }) {
102
100
  if (runtimePanelPlugins.has(pluginId)) {
103
101
  throw new Error(`A runtime panel plugin with id ${pluginId} has already been registered`);
104
102
  }
105
- plugin.meta = __spreadProps$v(__spreadValues$L({}, plugin.meta), {
103
+ plugin.meta = __spreadProps$t(__spreadValues$J({}, plugin.meta), {
106
104
  id: pluginId,
107
105
  name: pluginId,
108
106
  module: "runtime plugin",
@@ -130,39 +128,39 @@ function loadPanelPluginSync(pluginId) {
130
128
  return (_a = getPanelPluginFromCache(pluginId)) != null ? _a : runtimePanelPlugins.get(pluginId);
131
129
  }
132
130
 
133
- var __defProp$K = Object.defineProperty;
134
- var __defProps$u = Object.defineProperties;
135
- var __getOwnPropDescs$u = Object.getOwnPropertyDescriptors;
136
- var __getOwnPropSymbols$K = Object.getOwnPropertySymbols;
137
- var __hasOwnProp$K = Object.prototype.hasOwnProperty;
138
- var __propIsEnum$K = Object.prototype.propertyIsEnumerable;
139
- var __defNormalProp$K = (obj, key, value) => key in obj ? __defProp$K(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
140
- var __spreadValues$K = (a, b) => {
131
+ var __defProp$I = Object.defineProperty;
132
+ var __defProps$s = Object.defineProperties;
133
+ var __getOwnPropDescs$s = Object.getOwnPropertyDescriptors;
134
+ var __getOwnPropSymbols$I = Object.getOwnPropertySymbols;
135
+ var __hasOwnProp$I = Object.prototype.hasOwnProperty;
136
+ var __propIsEnum$I = Object.prototype.propertyIsEnumerable;
137
+ var __defNormalProp$I = (obj, key, value) => key in obj ? __defProp$I(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
138
+ var __spreadValues$I = (a, b) => {
141
139
  for (var prop in b || (b = {}))
142
- if (__hasOwnProp$K.call(b, prop))
143
- __defNormalProp$K(a, prop, b[prop]);
144
- if (__getOwnPropSymbols$K)
145
- for (var prop of __getOwnPropSymbols$K(b)) {
146
- if (__propIsEnum$K.call(b, prop))
147
- __defNormalProp$K(a, prop, b[prop]);
140
+ if (__hasOwnProp$I.call(b, prop))
141
+ __defNormalProp$I(a, prop, b[prop]);
142
+ if (__getOwnPropSymbols$I)
143
+ for (var prop of __getOwnPropSymbols$I(b)) {
144
+ if (__propIsEnum$I.call(b, prop))
145
+ __defNormalProp$I(a, prop, b[prop]);
148
146
  }
149
147
  return a;
150
148
  };
151
- var __spreadProps$u = (a, b) => __defProps$u(a, __getOwnPropDescs$u(b));
152
- var __objRest$5 = (source, exclude) => {
149
+ var __spreadProps$s = (a, b) => __defProps$s(a, __getOwnPropDescs$s(b));
150
+ var __objRest$4 = (source, exclude) => {
153
151
  var target = {};
154
152
  for (var prop in source)
155
- if (__hasOwnProp$K.call(source, prop) && exclude.indexOf(prop) < 0)
153
+ if (__hasOwnProp$I.call(source, prop) && exclude.indexOf(prop) < 0)
156
154
  target[prop] = source[prop];
157
- if (source != null && __getOwnPropSymbols$K)
158
- for (var prop of __getOwnPropSymbols$K(source)) {
159
- if (exclude.indexOf(prop) < 0 && __propIsEnum$K.call(source, prop))
155
+ if (source != null && __getOwnPropSymbols$I)
156
+ for (var prop of __getOwnPropSymbols$I(source)) {
157
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$I.call(source, prop))
160
158
  target[prop] = source[prop];
161
159
  }
162
160
  return target;
163
161
  };
164
162
  function SceneComponentWrapperWithoutMemo(_a) {
165
- var _b = _a, { model } = _b, otherProps = __objRest$5(_b, ["model"]);
163
+ var _b = _a, { model } = _b, otherProps = __objRest$4(_b, ["model"]);
166
164
  var _a2;
167
165
  const Component = (_a2 = model.constructor["Component"]) != null ? _a2 : EmptyRenderer;
168
166
  const [_, setValue] = React.useState(0);
@@ -174,7 +172,7 @@ function SceneComponentWrapperWithoutMemo(_a) {
174
172
  if (!model.isActive) {
175
173
  return null;
176
174
  }
177
- return /* @__PURE__ */ React__default["default"].createElement(Component, __spreadProps$u(__spreadValues$K({}, otherProps), {
175
+ return /* @__PURE__ */ React__default["default"].createElement(Component, __spreadProps$s(__spreadValues$I({}, otherProps), {
178
176
  model
179
177
  }));
180
178
  }
@@ -190,49 +188,49 @@ class UserActionEvent extends data.BusEventWithPayload {
190
188
  }
191
189
  UserActionEvent.type = "scene-object-user-action";
192
190
 
193
- var __accessCheck$2 = (obj, member, msg) => {
191
+ var __accessCheck$3 = (obj, member, msg) => {
194
192
  if (!member.has(obj))
195
193
  throw TypeError("Cannot " + msg);
196
194
  };
197
- var __privateGet$2 = (obj, member, getter) => {
198
- __accessCheck$2(obj, member, "read from private field");
195
+ var __privateGet$3 = (obj, member, getter) => {
196
+ __accessCheck$3(obj, member, "read from private field");
199
197
  return getter ? getter.call(obj) : member.get(obj);
200
198
  };
201
- var __privateAdd$2 = (obj, member, value) => {
199
+ var __privateAdd$3 = (obj, member, value) => {
202
200
  if (member.has(obj))
203
201
  throw TypeError("Cannot add the same private member more than once");
204
202
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
205
203
  };
206
- var __privateSet$1 = (obj, member, value, setter) => {
207
- __accessCheck$2(obj, member, "write to private field");
204
+ var __privateSet$2 = (obj, member, value, setter) => {
205
+ __accessCheck$3(obj, member, "write to private field");
208
206
  setter ? setter.call(obj, value) : member.set(obj, value);
209
207
  return value;
210
208
  };
211
209
  var _ref;
212
210
  class SceneObjectRef {
213
211
  constructor(ref) {
214
- __privateAdd$2(this, _ref, void 0);
215
- __privateSet$1(this, _ref, ref);
212
+ __privateAdd$3(this, _ref, void 0);
213
+ __privateSet$2(this, _ref, ref);
216
214
  }
217
215
  resolve() {
218
- return __privateGet$2(this, _ref);
216
+ return __privateGet$3(this, _ref);
219
217
  }
220
218
  }
221
219
  _ref = new WeakMap();
222
220
 
223
- var __defProp$J = Object.defineProperty;
224
- var __getOwnPropSymbols$J = Object.getOwnPropertySymbols;
225
- var __hasOwnProp$J = Object.prototype.hasOwnProperty;
226
- var __propIsEnum$J = Object.prototype.propertyIsEnumerable;
227
- var __defNormalProp$J = (obj, key, value) => key in obj ? __defProp$J(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
228
- var __spreadValues$J = (a, b) => {
221
+ var __defProp$H = Object.defineProperty;
222
+ var __getOwnPropSymbols$H = Object.getOwnPropertySymbols;
223
+ var __hasOwnProp$H = Object.prototype.hasOwnProperty;
224
+ var __propIsEnum$H = Object.prototype.propertyIsEnumerable;
225
+ var __defNormalProp$H = (obj, key, value) => key in obj ? __defProp$H(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
226
+ var __spreadValues$H = (a, b) => {
229
227
  for (var prop in b || (b = {}))
230
- if (__hasOwnProp$J.call(b, prop))
231
- __defNormalProp$J(a, prop, b[prop]);
232
- if (__getOwnPropSymbols$J)
233
- for (var prop of __getOwnPropSymbols$J(b)) {
234
- if (__propIsEnum$J.call(b, prop))
235
- __defNormalProp$J(a, prop, b[prop]);
228
+ if (__hasOwnProp$H.call(b, prop))
229
+ __defNormalProp$H(a, prop, b[prop]);
230
+ if (__getOwnPropSymbols$H)
231
+ for (var prop of __getOwnPropSymbols$H(b)) {
232
+ if (__propIsEnum$H.call(b, prop))
233
+ __defNormalProp$H(a, prop, b[prop]);
236
234
  }
237
235
  return a;
238
236
  };
@@ -292,7 +290,7 @@ class SceneObjectBase {
292
290
  }
293
291
  setState(update) {
294
292
  const prevState = this._state;
295
- const newState = __spreadValues$J(__spreadValues$J({}, this._state), update);
293
+ const newState = __spreadValues$H(__spreadValues$H({}, this._state), update);
296
294
  this._state = Object.freeze(newState);
297
295
  this._setParent(update);
298
296
  this._handleActivationOfChangedStateProps(prevState, newState);
@@ -488,19 +486,19 @@ function forEachChild(state, callback) {
488
486
  }
489
487
  }
490
488
 
491
- var __defProp$I = Object.defineProperty;
492
- var __getOwnPropSymbols$I = Object.getOwnPropertySymbols;
493
- var __hasOwnProp$I = Object.prototype.hasOwnProperty;
494
- var __propIsEnum$I = Object.prototype.propertyIsEnumerable;
495
- var __defNormalProp$I = (obj, key, value) => key in obj ? __defProp$I(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
496
- var __spreadValues$I = (a, b) => {
489
+ var __defProp$G = Object.defineProperty;
490
+ var __getOwnPropSymbols$G = Object.getOwnPropertySymbols;
491
+ var __hasOwnProp$G = Object.prototype.hasOwnProperty;
492
+ var __propIsEnum$G = Object.prototype.propertyIsEnumerable;
493
+ var __defNormalProp$G = (obj, key, value) => key in obj ? __defProp$G(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
494
+ var __spreadValues$G = (a, b) => {
497
495
  for (var prop in b || (b = {}))
498
- if (__hasOwnProp$I.call(b, prop))
499
- __defNormalProp$I(a, prop, b[prop]);
500
- if (__getOwnPropSymbols$I)
501
- for (var prop of __getOwnPropSymbols$I(b)) {
502
- if (__propIsEnum$I.call(b, prop))
503
- __defNormalProp$I(a, prop, b[prop]);
496
+ if (__hasOwnProp$G.call(b, prop))
497
+ __defNormalProp$G(a, prop, b[prop]);
498
+ if (__getOwnPropSymbols$G)
499
+ for (var prop of __getOwnPropSymbols$G(b)) {
500
+ if (__propIsEnum$G.call(b, prop))
501
+ __defNormalProp$G(a, prop, b[prop]);
504
502
  }
505
503
  return a;
506
504
  };
@@ -509,7 +507,7 @@ function cloneSceneObject(sceneObject, withState) {
509
507
  return new sceneObject.constructor(clonedState);
510
508
  }
511
509
  function cloneSceneObjectState(sceneState, withState) {
512
- const clonedState = __spreadValues$I({}, sceneState);
510
+ const clonedState = __spreadValues$G({}, sceneState);
513
511
  for (const key in clonedState) {
514
512
  const propValue = clonedState[key];
515
513
  if (propValue instanceof SceneObjectBase) {
@@ -606,25 +604,25 @@ function lookupVariable(name, sceneObject) {
606
604
  return null;
607
605
  }
608
606
 
609
- var __defProp$H = Object.defineProperty;
610
- var __getOwnPropSymbols$H = Object.getOwnPropertySymbols;
611
- var __hasOwnProp$H = Object.prototype.hasOwnProperty;
612
- var __propIsEnum$H = Object.prototype.propertyIsEnumerable;
613
- var __defNormalProp$H = (obj, key, value) => key in obj ? __defProp$H(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
614
- var __spreadValues$H = (a, b) => {
607
+ var __defProp$F = Object.defineProperty;
608
+ var __getOwnPropSymbols$F = Object.getOwnPropertySymbols;
609
+ var __hasOwnProp$F = Object.prototype.hasOwnProperty;
610
+ var __propIsEnum$F = Object.prototype.propertyIsEnumerable;
611
+ var __defNormalProp$F = (obj, key, value) => key in obj ? __defProp$F(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
612
+ var __spreadValues$F = (a, b) => {
615
613
  for (var prop in b || (b = {}))
616
- if (__hasOwnProp$H.call(b, prop))
617
- __defNormalProp$H(a, prop, b[prop]);
618
- if (__getOwnPropSymbols$H)
619
- for (var prop of __getOwnPropSymbols$H(b)) {
620
- if (__propIsEnum$H.call(b, prop))
621
- __defNormalProp$H(a, prop, b[prop]);
614
+ if (__hasOwnProp$F.call(b, prop))
615
+ __defNormalProp$F(a, prop, b[prop]);
616
+ if (__getOwnPropSymbols$F)
617
+ for (var prop of __getOwnPropSymbols$F(b)) {
618
+ if (__propIsEnum$F.call(b, prop))
619
+ __defNormalProp$F(a, prop, b[prop]);
622
620
  }
623
621
  return a;
624
622
  };
625
623
  class SceneDataNode extends SceneObjectBase {
626
624
  constructor(state) {
627
- super(__spreadValues$H({
625
+ super(__spreadValues$F({
628
626
  data: emptyPanelData
629
627
  }, state));
630
628
  }
@@ -705,25 +703,25 @@ function evaluateTimeRange(from, to, timeZone, fiscalYearStartMonth, delay) {
705
703
  };
706
704
  }
707
705
 
708
- var __defProp$G = Object.defineProperty;
709
- var __getOwnPropSymbols$G = Object.getOwnPropertySymbols;
710
- var __hasOwnProp$G = Object.prototype.hasOwnProperty;
711
- var __propIsEnum$G = Object.prototype.propertyIsEnumerable;
712
- var __defNormalProp$G = (obj, key, value) => key in obj ? __defProp$G(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
713
- var __spreadValues$G = (a, b) => {
706
+ var __defProp$E = Object.defineProperty;
707
+ var __getOwnPropSymbols$E = Object.getOwnPropertySymbols;
708
+ var __hasOwnProp$E = Object.prototype.hasOwnProperty;
709
+ var __propIsEnum$E = Object.prototype.propertyIsEnumerable;
710
+ var __defNormalProp$E = (obj, key, value) => key in obj ? __defProp$E(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
711
+ var __spreadValues$E = (a, b) => {
714
712
  for (var prop in b || (b = {}))
715
- if (__hasOwnProp$G.call(b, prop))
716
- __defNormalProp$G(a, prop, b[prop]);
717
- if (__getOwnPropSymbols$G)
718
- for (var prop of __getOwnPropSymbols$G(b)) {
719
- if (__propIsEnum$G.call(b, prop))
720
- __defNormalProp$G(a, prop, b[prop]);
713
+ if (__hasOwnProp$E.call(b, prop))
714
+ __defNormalProp$E(a, prop, b[prop]);
715
+ if (__getOwnPropSymbols$E)
716
+ for (var prop of __getOwnPropSymbols$E(b)) {
717
+ if (__propIsEnum$E.call(b, prop))
718
+ __defNormalProp$E(a, prop, b[prop]);
721
719
  }
722
720
  return a;
723
721
  };
724
722
  class SceneTimeRange extends SceneObjectBase {
725
723
  constructor(state = {}) {
726
- var _a, _b;
724
+ var _a, _b, _c;
727
725
  const from = (_a = state.from) != null ? _a : "now-6h";
728
726
  const to = (_b = state.to) != null ? _b : "now";
729
727
  const timeZone = state.timeZone;
@@ -734,7 +732,7 @@ class SceneTimeRange extends SceneObjectBase {
734
732
  state.fiscalYearStartMonth,
735
733
  state.UNSAFE_nowDelay
736
734
  );
737
- super(__spreadValues$G({ from, to, timeZone, value }, state));
735
+ super(__spreadValues$E({ from, to, timeZone, value }, state));
738
736
  this._urlSync = new SceneObjectUrlSyncConfig(this, { keys: ["from", "to", "timezone"] });
739
737
  this.onTimeRangeChange = (timeRange) => {
740
738
  const update = {};
@@ -779,6 +777,7 @@ class SceneTimeRange extends SceneObjectBase {
779
777
  });
780
778
  this.publishEvent(new runtime.RefreshEvent());
781
779
  };
780
+ (_c = runtime.getTemplateSrv()) == null ? void 0 : _c.updateTimeRange(value);
782
781
  this.addActivationHandler(this._onActivate.bind(this));
783
782
  }
784
783
  _onActivate() {
@@ -787,16 +786,19 @@ class SceneTimeRange extends SceneObjectBase {
787
786
  if (timeZoneSource !== this) {
788
787
  this._subs.add(
789
788
  timeZoneSource.subscribeToState((n, p) => {
789
+ var _a;
790
790
  if (n.timeZone !== void 0 && n.timeZone !== p.timeZone) {
791
+ const timeRange = evaluateTimeRange(
792
+ this.state.from,
793
+ this.state.to,
794
+ timeZoneSource.getTimeZone(),
795
+ this.state.fiscalYearStartMonth,
796
+ this.state.UNSAFE_nowDelay
797
+ );
791
798
  this.setState({
792
- value: evaluateTimeRange(
793
- this.state.from,
794
- this.state.to,
795
- timeZoneSource.getTimeZone(),
796
- this.state.fiscalYearStartMonth,
797
- this.state.UNSAFE_nowDelay
798
- )
799
+ value: timeRange
799
800
  });
801
+ (_a = runtime.getTemplateSrv()) == null ? void 0 : _a.updateTimeRange(timeRange);
800
802
  }
801
803
  })
802
804
  );
@@ -1365,25 +1367,25 @@ function collectAllVariables(sceneObject, record = {}) {
1365
1367
  return record;
1366
1368
  }
1367
1369
 
1368
- var __defProp$F = Object.defineProperty;
1369
- var __defProps$t = Object.defineProperties;
1370
- var __getOwnPropDescs$t = Object.getOwnPropertyDescriptors;
1371
- var __getOwnPropSymbols$F = Object.getOwnPropertySymbols;
1372
- var __hasOwnProp$F = Object.prototype.hasOwnProperty;
1373
- var __propIsEnum$F = Object.prototype.propertyIsEnumerable;
1374
- var __defNormalProp$F = (obj, key, value) => key in obj ? __defProp$F(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1375
- var __spreadValues$F = (a, b) => {
1370
+ var __defProp$D = Object.defineProperty;
1371
+ var __defProps$r = Object.defineProperties;
1372
+ var __getOwnPropDescs$r = Object.getOwnPropertyDescriptors;
1373
+ var __getOwnPropSymbols$D = Object.getOwnPropertySymbols;
1374
+ var __hasOwnProp$D = Object.prototype.hasOwnProperty;
1375
+ var __propIsEnum$D = Object.prototype.propertyIsEnumerable;
1376
+ var __defNormalProp$D = (obj, key, value) => key in obj ? __defProp$D(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1377
+ var __spreadValues$D = (a, b) => {
1376
1378
  for (var prop in b || (b = {}))
1377
- if (__hasOwnProp$F.call(b, prop))
1378
- __defNormalProp$F(a, prop, b[prop]);
1379
- if (__getOwnPropSymbols$F)
1380
- for (var prop of __getOwnPropSymbols$F(b)) {
1381
- if (__propIsEnum$F.call(b, prop))
1382
- __defNormalProp$F(a, prop, b[prop]);
1379
+ if (__hasOwnProp$D.call(b, prop))
1380
+ __defNormalProp$D(a, prop, b[prop]);
1381
+ if (__getOwnPropSymbols$D)
1382
+ for (var prop of __getOwnPropSymbols$D(b)) {
1383
+ if (__propIsEnum$D.call(b, prop))
1384
+ __defNormalProp$D(a, prop, b[prop]);
1383
1385
  }
1384
1386
  return a;
1385
1387
  };
1386
- var __spreadProps$t = (a, b) => __defProps$t(a, __getOwnPropDescs$t(b));
1388
+ var __spreadProps$r = (a, b) => __defProps$r(a, __getOwnPropDescs$r(b));
1387
1389
  function getTemplateProxyForField(field, frame, frames) {
1388
1390
  return new Proxy(
1389
1391
  {},
@@ -1399,7 +1401,7 @@ function getTemplateProxyForField(field, frame, frames) {
1399
1401
  if (!field.labels) {
1400
1402
  return "";
1401
1403
  }
1402
- return __spreadProps$t(__spreadValues$F({}, field.labels), {
1404
+ return __spreadProps$r(__spreadValues$D({}, field.labels), {
1403
1405
  __values: Object.values(field.labels).sort().join(", "),
1404
1406
  toString: () => {
1405
1407
  return data.formatLabels(field.labels, "", true);
@@ -1747,15 +1749,15 @@ function isDataLayer(obj) {
1747
1749
  return "isDataLayer" in obj;
1748
1750
  }
1749
1751
 
1750
- var __accessCheck$1 = (obj, member, msg) => {
1752
+ var __accessCheck$2 = (obj, member, msg) => {
1751
1753
  if (!member.has(obj))
1752
1754
  throw TypeError("Cannot " + msg);
1753
1755
  };
1754
- var __privateGet$1 = (obj, member, getter) => {
1755
- __accessCheck$1(obj, member, "read from private field");
1756
+ var __privateGet$2 = (obj, member, getter) => {
1757
+ __accessCheck$2(obj, member, "read from private field");
1756
1758
  return getter ? getter.call(obj) : member.get(obj);
1757
1759
  };
1758
- var __privateAdd$1 = (obj, member, value) => {
1760
+ var __privateAdd$2 = (obj, member, value) => {
1759
1761
  if (member.has(obj))
1760
1762
  throw TypeError("Cannot add the same private member more than once");
1761
1763
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
@@ -1768,25 +1770,25 @@ class SceneQueryController extends SceneObjectBase {
1768
1770
  constructor() {
1769
1771
  super({ isRunning: false });
1770
1772
  this.isQueryController = true;
1771
- __privateAdd$1(this, _running, /* @__PURE__ */ new Set());
1773
+ __privateAdd$2(this, _running, /* @__PURE__ */ new Set());
1772
1774
  this.addActivationHandler(() => {
1773
- return () => __privateGet$1(this, _running).clear();
1775
+ return () => __privateGet$2(this, _running).clear();
1774
1776
  });
1775
1777
  }
1776
1778
  queryStarted(entry) {
1777
- __privateGet$1(this, _running).add(entry);
1779
+ __privateGet$2(this, _running).add(entry);
1778
1780
  this.changeRunningQueryCount(1);
1779
1781
  if (!this.state.isRunning) {
1780
1782
  this.setState({ isRunning: true });
1781
1783
  }
1782
1784
  }
1783
1785
  queryCompleted(entry) {
1784
- if (!__privateGet$1(this, _running).has(entry)) {
1786
+ if (!__privateGet$2(this, _running).has(entry)) {
1785
1787
  return;
1786
1788
  }
1787
- __privateGet$1(this, _running).delete(entry);
1789
+ __privateGet$2(this, _running).delete(entry);
1788
1790
  this.changeRunningQueryCount(-1);
1789
- if (__privateGet$1(this, _running).size === 0) {
1791
+ if (__privateGet$2(this, _running).size === 0) {
1790
1792
  this.setState({ isRunning: false });
1791
1793
  }
1792
1794
  }
@@ -1796,7 +1798,7 @@ class SceneQueryController extends SceneObjectBase {
1796
1798
  }
1797
1799
  cancelAll() {
1798
1800
  var _a;
1799
- for (const entry of __privateGet$1(this, _running).values()) {
1801
+ for (const entry of __privateGet$2(this, _running).values()) {
1800
1802
  (_a = entry.cancel) == null ? void 0 : _a.call(entry);
1801
1803
  }
1802
1804
  }
@@ -2284,25 +2286,25 @@ function isExtraQueryProvider(obj) {
2284
2286
  return typeof obj === "object" && "getExtraQueries" in obj;
2285
2287
  }
2286
2288
 
2287
- var __defProp$E = Object.defineProperty;
2288
- var __defProps$s = Object.defineProperties;
2289
- var __getOwnPropDescs$s = Object.getOwnPropertyDescriptors;
2290
- var __getOwnPropSymbols$E = Object.getOwnPropertySymbols;
2291
- var __hasOwnProp$E = Object.prototype.hasOwnProperty;
2292
- var __propIsEnum$E = Object.prototype.propertyIsEnumerable;
2293
- var __defNormalProp$E = (obj, key, value) => key in obj ? __defProp$E(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2294
- var __spreadValues$E = (a, b) => {
2289
+ var __defProp$C = Object.defineProperty;
2290
+ var __defProps$q = Object.defineProperties;
2291
+ var __getOwnPropDescs$q = Object.getOwnPropertyDescriptors;
2292
+ var __getOwnPropSymbols$C = Object.getOwnPropertySymbols;
2293
+ var __hasOwnProp$C = Object.prototype.hasOwnProperty;
2294
+ var __propIsEnum$C = Object.prototype.propertyIsEnumerable;
2295
+ var __defNormalProp$C = (obj, key, value) => key in obj ? __defProp$C(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2296
+ var __spreadValues$C = (a, b) => {
2295
2297
  for (var prop in b || (b = {}))
2296
- if (__hasOwnProp$E.call(b, prop))
2297
- __defNormalProp$E(a, prop, b[prop]);
2298
- if (__getOwnPropSymbols$E)
2299
- for (var prop of __getOwnPropSymbols$E(b)) {
2300
- if (__propIsEnum$E.call(b, prop))
2301
- __defNormalProp$E(a, prop, b[prop]);
2298
+ if (__hasOwnProp$C.call(b, prop))
2299
+ __defNormalProp$C(a, prop, b[prop]);
2300
+ if (__getOwnPropSymbols$C)
2301
+ for (var prop of __getOwnPropSymbols$C(b)) {
2302
+ if (__propIsEnum$C.call(b, prop))
2303
+ __defNormalProp$C(a, prop, b[prop]);
2302
2304
  }
2303
2305
  return a;
2304
2306
  };
2305
- var __spreadProps$s = (a, b) => __defProps$s(a, __getOwnPropDescs$s(b));
2307
+ var __spreadProps$q = (a, b) => __defProps$q(a, __getOwnPropDescs$q(b));
2306
2308
  const passthroughProcessor = (_, secondary) => rxjs.of(secondary);
2307
2309
  const extraQueryProcessingOperator = (processors) => (data) => {
2308
2310
  return data.pipe(
@@ -2315,7 +2317,7 @@ const extraQueryProcessingOperator = (processors) => (data) => {
2315
2317
  }),
2316
2318
  rxjs.map(([primary, ...processedSecondaries]) => {
2317
2319
  var _a;
2318
- return __spreadProps$s(__spreadValues$E({}, primary), {
2320
+ return __spreadProps$q(__spreadValues$C({}, primary), {
2319
2321
  series: [...primary.series, ...processedSecondaries.flatMap((s) => s.series)],
2320
2322
  annotations: [...(_a = primary.annotations) != null ? _a : [], ...processedSecondaries.flatMap((s) => {
2321
2323
  var _a2;
@@ -2326,25 +2328,25 @@ const extraQueryProcessingOperator = (processors) => (data) => {
2326
2328
  );
2327
2329
  };
2328
2330
 
2329
- var __defProp$D = Object.defineProperty;
2330
- var __defProps$r = Object.defineProperties;
2331
- var __getOwnPropDescs$r = Object.getOwnPropertyDescriptors;
2332
- var __getOwnPropSymbols$D = Object.getOwnPropertySymbols;
2333
- var __hasOwnProp$D = Object.prototype.hasOwnProperty;
2334
- var __propIsEnum$D = Object.prototype.propertyIsEnumerable;
2335
- var __defNormalProp$D = (obj, key, value) => key in obj ? __defProp$D(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2336
- var __spreadValues$D = (a, b) => {
2331
+ var __defProp$B = Object.defineProperty;
2332
+ var __defProps$p = Object.defineProperties;
2333
+ var __getOwnPropDescs$p = Object.getOwnPropertyDescriptors;
2334
+ var __getOwnPropSymbols$B = Object.getOwnPropertySymbols;
2335
+ var __hasOwnProp$B = Object.prototype.hasOwnProperty;
2336
+ var __propIsEnum$B = Object.prototype.propertyIsEnumerable;
2337
+ var __defNormalProp$B = (obj, key, value) => key in obj ? __defProp$B(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2338
+ var __spreadValues$B = (a, b) => {
2337
2339
  for (var prop in b || (b = {}))
2338
- if (__hasOwnProp$D.call(b, prop))
2339
- __defNormalProp$D(a, prop, b[prop]);
2340
- if (__getOwnPropSymbols$D)
2341
- for (var prop of __getOwnPropSymbols$D(b)) {
2342
- if (__propIsEnum$D.call(b, prop))
2343
- __defNormalProp$D(a, prop, b[prop]);
2340
+ if (__hasOwnProp$B.call(b, prop))
2341
+ __defNormalProp$B(a, prop, b[prop]);
2342
+ if (__getOwnPropSymbols$B)
2343
+ for (var prop of __getOwnPropSymbols$B(b)) {
2344
+ if (__propIsEnum$B.call(b, prop))
2345
+ __defNormalProp$B(a, prop, b[prop]);
2344
2346
  }
2345
2347
  return a;
2346
2348
  };
2347
- var __spreadProps$r = (a, b) => __defProps$r(a, __getOwnPropDescs$r(b));
2349
+ var __spreadProps$p = (a, b) => __defProps$p(a, __getOwnPropDescs$p(b));
2348
2350
  function filterAnnotations(data, filters) {
2349
2351
  var _a;
2350
2352
  if (!Array.isArray(data) || data.length === 0) {
@@ -2395,11 +2397,11 @@ function filterAnnotations(data, filters) {
2395
2397
  continue;
2396
2398
  }
2397
2399
  }
2398
- fields.push(__spreadProps$r(__spreadValues$D({}, field), {
2400
+ fields.push(__spreadProps$p(__spreadValues$B({}, field), {
2399
2401
  values: buffer
2400
2402
  }));
2401
2403
  }
2402
- processed.push(__spreadProps$r(__spreadValues$D({}, frame), {
2404
+ processed.push(__spreadProps$p(__spreadValues$B({}, frame), {
2403
2405
  fields,
2404
2406
  length: frameLength
2405
2407
  }));
@@ -2825,33 +2827,33 @@ function getOptionSearcher(options, includeAll) {
2825
2827
  };
2826
2828
  }
2827
2829
 
2828
- var __defProp$C = Object.defineProperty;
2829
- var __defProps$q = Object.defineProperties;
2830
- var __getOwnPropDescs$q = Object.getOwnPropertyDescriptors;
2831
- var __getOwnPropSymbols$C = Object.getOwnPropertySymbols;
2832
- var __hasOwnProp$C = Object.prototype.hasOwnProperty;
2833
- var __propIsEnum$C = Object.prototype.propertyIsEnumerable;
2834
- var __defNormalProp$C = (obj, key, value) => key in obj ? __defProp$C(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2835
- var __spreadValues$C = (a, b) => {
2830
+ var __defProp$A = Object.defineProperty;
2831
+ var __defProps$o = Object.defineProperties;
2832
+ var __getOwnPropDescs$o = Object.getOwnPropertyDescriptors;
2833
+ var __getOwnPropSymbols$A = Object.getOwnPropertySymbols;
2834
+ var __hasOwnProp$A = Object.prototype.hasOwnProperty;
2835
+ var __propIsEnum$A = Object.prototype.propertyIsEnumerable;
2836
+ var __defNormalProp$A = (obj, key, value) => key in obj ? __defProp$A(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2837
+ var __spreadValues$A = (a, b) => {
2836
2838
  for (var prop in b || (b = {}))
2837
- if (__hasOwnProp$C.call(b, prop))
2838
- __defNormalProp$C(a, prop, b[prop]);
2839
- if (__getOwnPropSymbols$C)
2840
- for (var prop of __getOwnPropSymbols$C(b)) {
2841
- if (__propIsEnum$C.call(b, prop))
2842
- __defNormalProp$C(a, prop, b[prop]);
2839
+ if (__hasOwnProp$A.call(b, prop))
2840
+ __defNormalProp$A(a, prop, b[prop]);
2841
+ if (__getOwnPropSymbols$A)
2842
+ for (var prop of __getOwnPropSymbols$A(b)) {
2843
+ if (__propIsEnum$A.call(b, prop))
2844
+ __defNormalProp$A(a, prop, b[prop]);
2843
2845
  }
2844
2846
  return a;
2845
2847
  };
2846
- var __spreadProps$q = (a, b) => __defProps$q(a, __getOwnPropDescs$q(b));
2847
- var __objRest$4 = (source, exclude) => {
2848
+ var __spreadProps$o = (a, b) => __defProps$o(a, __getOwnPropDescs$o(b));
2849
+ var __objRest$3 = (source, exclude) => {
2848
2850
  var target = {};
2849
2851
  for (var prop in source)
2850
- if (__hasOwnProp$C.call(source, prop) && exclude.indexOf(prop) < 0)
2852
+ if (__hasOwnProp$A.call(source, prop) && exclude.indexOf(prop) < 0)
2851
2853
  target[prop] = source[prop];
2852
- if (source != null && __getOwnPropSymbols$C)
2853
- for (var prop of __getOwnPropSymbols$C(source)) {
2854
- if (exclude.indexOf(prop) < 0 && __propIsEnum$C.call(source, prop))
2854
+ if (source != null && __getOwnPropSymbols$A)
2855
+ for (var prop of __getOwnPropSymbols$A(source)) {
2856
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$A.call(source, prop))
2855
2857
  target[prop] = source[prop];
2856
2858
  }
2857
2859
  return target;
@@ -2979,11 +2981,11 @@ const OptionWithCheckbox = ({
2979
2981
  renderOptionLabel
2980
2982
  }) => {
2981
2983
  var _b;
2982
- const _a = innerProps, rest = __objRest$4(_a, ["onMouseMove", "onMouseOver"]);
2984
+ const _a = innerProps, rest = __objRest$3(_a, ["onMouseMove", "onMouseOver"]);
2983
2985
  const theme = ui.useTheme2();
2984
2986
  const selectStyles = ui.getSelectStyles(theme);
2985
2987
  const optionStyles = ui.useStyles2(getOptionStyles);
2986
- return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$q(__spreadValues$C({
2988
+ return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$o(__spreadValues$A({
2987
2989
  ref: innerRef,
2988
2990
  className: css.cx(selectStyles.option, isFocused && selectStyles.optionFocused)
2989
2991
  }, rest), {
@@ -3082,31 +3084,68 @@ function getEnrichedFiltersRequest(sourceRunner) {
3082
3084
  if (isFiltersRequestEnricher(root)) {
3083
3085
  return root.enrichFiltersRequest(sourceRunner);
3084
3086
  }
3085
- return null;
3087
+ return null;
3088
+ }
3089
+
3090
+ var __accessCheck$1 = (obj, member, msg) => {
3091
+ if (!member.has(obj))
3092
+ throw TypeError("Cannot " + msg);
3093
+ };
3094
+ var __privateGet$1 = (obj, member, getter) => {
3095
+ __accessCheck$1(obj, member, "read from private field");
3096
+ return getter ? getter.call(obj) : member.get(obj);
3097
+ };
3098
+ var __privateAdd$1 = (obj, member, value) => {
3099
+ if (member.has(obj))
3100
+ throw TypeError("Cannot add the same private member more than once");
3101
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
3102
+ };
3103
+ var __privateSet$1 = (obj, member, value, setter) => {
3104
+ __accessCheck$1(obj, member, "write to private field");
3105
+ setter ? setter.call(obj, value) : member.set(obj, value);
3106
+ return value;
3107
+ };
3108
+ var _value;
3109
+ class SafeSerializableSceneObject {
3110
+ constructor(value) {
3111
+ __privateAdd$1(this, _value, void 0);
3112
+ this.text = "__sceneObject";
3113
+ __privateSet$1(this, _value, value);
3114
+ }
3115
+ toString() {
3116
+ return void 0;
3117
+ }
3118
+ valueOf() {
3119
+ return __privateGet$1(this, _value);
3120
+ }
3121
+ get value() {
3122
+ return this;
3123
+ }
3086
3124
  }
3125
+ _value = new WeakMap();
3087
3126
 
3088
- var __defProp$B = Object.defineProperty;
3089
- var __defProps$p = Object.defineProperties;
3090
- var __getOwnPropDescs$p = Object.getOwnPropertyDescriptors;
3091
- var __getOwnPropSymbols$B = Object.getOwnPropertySymbols;
3092
- var __hasOwnProp$B = Object.prototype.hasOwnProperty;
3093
- var __propIsEnum$B = Object.prototype.propertyIsEnumerable;
3094
- var __defNormalProp$B = (obj, key, value) => key in obj ? __defProp$B(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3095
- var __spreadValues$B = (a, b) => {
3127
+ var __defProp$z = Object.defineProperty;
3128
+ var __defProps$n = Object.defineProperties;
3129
+ var __getOwnPropDescs$n = Object.getOwnPropertyDescriptors;
3130
+ var __getOwnPropSymbols$z = Object.getOwnPropertySymbols;
3131
+ var __hasOwnProp$z = Object.prototype.hasOwnProperty;
3132
+ var __propIsEnum$z = Object.prototype.propertyIsEnumerable;
3133
+ var __defNormalProp$z = (obj, key, value) => key in obj ? __defProp$z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3134
+ var __spreadValues$z = (a, b) => {
3096
3135
  for (var prop in b || (b = {}))
3097
- if (__hasOwnProp$B.call(b, prop))
3098
- __defNormalProp$B(a, prop, b[prop]);
3099
- if (__getOwnPropSymbols$B)
3100
- for (var prop of __getOwnPropSymbols$B(b)) {
3101
- if (__propIsEnum$B.call(b, prop))
3102
- __defNormalProp$B(a, prop, b[prop]);
3136
+ if (__hasOwnProp$z.call(b, prop))
3137
+ __defNormalProp$z(a, prop, b[prop]);
3138
+ if (__getOwnPropSymbols$z)
3139
+ for (var prop of __getOwnPropSymbols$z(b)) {
3140
+ if (__propIsEnum$z.call(b, prop))
3141
+ __defNormalProp$z(a, prop, b[prop]);
3103
3142
  }
3104
3143
  return a;
3105
3144
  };
3106
- var __spreadProps$p = (a, b) => __defProps$p(a, __getOwnPropDescs$p(b));
3145
+ var __spreadProps$n = (a, b) => __defProps$n(a, __getOwnPropDescs$n(b));
3107
3146
  class GroupByVariable extends MultiValueVariable {
3108
3147
  constructor(initialState) {
3109
- super(__spreadProps$p(__spreadValues$B({
3148
+ super(__spreadProps$n(__spreadValues$z({
3110
3149
  isMulti: true,
3111
3150
  name: "",
3112
3151
  value: [],
@@ -3129,9 +3168,7 @@ class GroupByVariable extends MultiValueVariable {
3129
3168
  return override.values;
3130
3169
  }
3131
3170
  if (this.state.defaultOptions) {
3132
- return this.state.defaultOptions.concat(
3133
- dataFromResponse((_c = override == null ? void 0 : override.values) != null ? _c : [])
3134
- );
3171
+ return this.state.defaultOptions.concat(dataFromResponse((_c = override == null ? void 0 : override.values) != null ? _c : []));
3135
3172
  }
3136
3173
  if (!ds.getTagKeys) {
3137
3174
  return [];
@@ -3139,7 +3176,11 @@ class GroupByVariable extends MultiValueVariable {
3139
3176
  const queries = getQueriesForVariables(this);
3140
3177
  const otherFilters = this.state.baseFilters || [];
3141
3178
  const timeRange = sceneGraph.getTimeRange(this).state.value;
3142
- const response = await ds.getTagKeys(__spreadValues$B({ filters: otherFilters, queries, timeRange }, getEnrichedFiltersRequest(this)));
3179
+ const response = await ds.getTagKeys(__spreadValues$z({
3180
+ filters: otherFilters,
3181
+ queries,
3182
+ timeRange
3183
+ }, getEnrichedFiltersRequest(this)));
3143
3184
  if (responseHasError(response)) {
3144
3185
  this.setState({ error: response.error.message });
3145
3186
  }
@@ -3189,7 +3230,7 @@ class GroupByVariable extends MultiValueVariable {
3189
3230
  this.setState({ loading: true, error: null });
3190
3231
  return rxjs.from(
3191
3232
  getDataSource(this.state.datasource, {
3192
- __sceneObject: { text: "__sceneObject", value: this }
3233
+ __sceneObject: new SafeSerializableSceneObject(this)
3193
3234
  })
3194
3235
  ).pipe(
3195
3236
  rxjs.mergeMap((ds) => {
@@ -3330,7 +3371,7 @@ function LoadingIndicator(props) {
3330
3371
  }
3331
3372
 
3332
3373
  function ControlsLabel(props) {
3333
- const styles = ui.useStyles2(getStyles$c);
3374
+ const styles = ui.useStyles2(getStyles$a);
3334
3375
  const theme = ui.useTheme2();
3335
3376
  const isVertical = props.layout === "vertical";
3336
3377
  const loadingIndicator = Boolean(props.isLoading) ? /* @__PURE__ */ React__default["default"].createElement("div", {
@@ -3393,7 +3434,7 @@ function ControlsLabel(props) {
3393
3434
  }
3394
3435
  return labelElement;
3395
3436
  }
3396
- const getStyles$c = (theme) => ({
3437
+ const getStyles$a = (theme) => ({
3397
3438
  horizontalLabel: css.css({
3398
3439
  background: theme.isDark ? theme.colors.background.primary : theme.colors.background.secondary,
3399
3440
  display: `flex`,
@@ -3473,7 +3514,7 @@ function keyLabelToOption(key, label) {
3473
3514
  const filterNoOp = () => true;
3474
3515
  function AdHocFilterRenderer({ filter, model }) {
3475
3516
  var _a, _b;
3476
- const styles = ui.useStyles2(getStyles$b);
3517
+ const styles = ui.useStyles2(getStyles$9);
3477
3518
  const [keys, setKeys] = React.useState([]);
3478
3519
  const [values, setValues] = React.useState([]);
3479
3520
  const [isKeysLoading, setIsKeysLoading] = React.useState(false);
@@ -3484,7 +3525,10 @@ function AdHocFilterRenderer({ filter, model }) {
3484
3525
  const [valueHasCustomValue, setValueHasCustomValue] = React.useState(false);
3485
3526
  const keyValue = keyLabelToOption(filter.key, filter.keyLabel);
3486
3527
  const valueValue = keyLabelToOption(filter.value, filter.valueLabel);
3487
- const optionSearcher = React.useMemo(() => getAdhocOptionSearcher(values), [values]);
3528
+ const optionSearcher = React.useMemo(
3529
+ () => getAdhocOptionSearcher(values),
3530
+ [values]
3531
+ );
3488
3532
  const onValueInputChange = (value, { action }) => {
3489
3533
  if (action === "input-change") {
3490
3534
  setValueInputValue(value);
@@ -3614,7 +3658,7 @@ function AdHocFilterRenderer({ filter, model }) {
3614
3658
  onClick: () => model._removeFilter(filter)
3615
3659
  }));
3616
3660
  }
3617
- const getStyles$b = (theme) => ({
3661
+ const getStyles$9 = (theme) => ({
3618
3662
  field: css.css({
3619
3663
  marginBottom: 0
3620
3664
  }),
@@ -3752,564 +3796,6 @@ function isFilter(filter) {
3752
3796
  return filter !== null && typeof filter.key === "string" && typeof filter.value === "string";
3753
3797
  }
3754
3798
 
3755
- var __defProp$A = Object.defineProperty;
3756
- var __defProps$o = Object.defineProperties;
3757
- var __getOwnPropDescs$o = Object.getOwnPropertyDescriptors;
3758
- var __getOwnPropSymbols$A = Object.getOwnPropertySymbols;
3759
- var __hasOwnProp$A = Object.prototype.hasOwnProperty;
3760
- var __propIsEnum$A = Object.prototype.propertyIsEnumerable;
3761
- var __defNormalProp$A = (obj, key, value) => key in obj ? __defProp$A(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3762
- var __spreadValues$A = (a, b) => {
3763
- for (var prop in b || (b = {}))
3764
- if (__hasOwnProp$A.call(b, prop))
3765
- __defNormalProp$A(a, prop, b[prop]);
3766
- if (__getOwnPropSymbols$A)
3767
- for (var prop of __getOwnPropSymbols$A(b)) {
3768
- if (__propIsEnum$A.call(b, prop))
3769
- __defNormalProp$A(a, prop, b[prop]);
3770
- }
3771
- return a;
3772
- };
3773
- var __spreadProps$o = (a, b) => __defProps$o(a, __getOwnPropDescs$o(b));
3774
- var __objRest$3 = (source, exclude) => {
3775
- var target = {};
3776
- for (var prop in source)
3777
- if (__hasOwnProp$A.call(source, prop) && exclude.indexOf(prop) < 0)
3778
- target[prop] = source[prop];
3779
- if (source != null && __getOwnPropSymbols$A)
3780
- for (var prop of __getOwnPropSymbols$A(source)) {
3781
- if (exclude.indexOf(prop) < 0 && __propIsEnum$A.call(source, prop))
3782
- target[prop] = source[prop];
3783
- }
3784
- return target;
3785
- };
3786
- const Item = React.forwardRef(
3787
- (_a, ref) => {
3788
- var _b = _a, { children, active } = _b, rest = __objRest$3(_b, ["children", "active"]);
3789
- const theme = ui.useTheme2();
3790
- const selectStyles = ui.getSelectStyles(theme);
3791
- const id = react.useId();
3792
- return /* @__PURE__ */ React__default["default"].createElement("div", __spreadValues$A({
3793
- ref,
3794
- role: "option",
3795
- id,
3796
- "aria-selected": active,
3797
- className: css.cx(selectStyles.option, active && selectStyles.optionFocused)
3798
- }, rest), /* @__PURE__ */ React__default["default"].createElement("div", {
3799
- className: selectStyles.optionBody,
3800
- "data-testid": `data-testid ad hoc filter option value ${children}`
3801
- }, /* @__PURE__ */ React__default["default"].createElement("span", null, children)));
3802
- }
3803
- );
3804
- const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model, wip, handleChangeViewMode }, parentRef) {
3805
- var _a;
3806
- const [open, setOpen] = React.useState(false);
3807
- const [options, setOptions] = React.useState([]);
3808
- const [optionsLoading, setOptionsLoading] = React.useState(false);
3809
- const [optionsError, setOptionsError] = React.useState(false);
3810
- const [inputValue, setInputValue] = React.useState("");
3811
- const [activeIndex, setActiveIndex] = React.useState(null);
3812
- const [inputType, setInputType] = React.useState(!wip ? "value" : "key");
3813
- const styles = ui.useStyles2(getStyles2);
3814
- const listRef = React.useRef([]);
3815
- const { _wip } = model.useState();
3816
- const handleResetWip = React.useCallback(() => {
3817
- if (wip) {
3818
- model._addWip();
3819
- setInputType("key");
3820
- setInputValue("");
3821
- }
3822
- }, [model, wip]);
3823
- const filterToUse = filter || _wip;
3824
- const operatorIdentifier = `${(_a = filterToUse == null ? void 0 : filterToUse.key) != null ? _a : ""}-operator`;
3825
- const { refs, floatingStyles, context } = react.useFloating({
3826
- whileElementsMounted: react.autoUpdate,
3827
- open,
3828
- onOpenChange: (nextOpen, _, reason) => {
3829
- setOpen(nextOpen);
3830
- if (["outside-press", "escape-key"].includes(reason || "")) {
3831
- handleResetWip();
3832
- handleChangeViewMode == null ? void 0 : handleChangeViewMode();
3833
- }
3834
- },
3835
- middleware: [
3836
- react.flip({ padding: 10 }),
3837
- react.size({
3838
- apply({ rects, availableHeight, elements }) {
3839
- Object.assign(elements.floating.style, {
3840
- width: `${rects.reference.width}px`,
3841
- maxHeight: `${availableHeight > 256 ? 256 : availableHeight}px`
3842
- });
3843
- },
3844
- padding: 10
3845
- })
3846
- ]
3847
- });
3848
- const role = react.useRole(context, { role: "listbox" });
3849
- const dismiss = react.useDismiss(context, {
3850
- outsidePress: (event) => {
3851
- return !event.currentTarget.classList.contains(
3852
- operatorIdentifier
3853
- );
3854
- }
3855
- });
3856
- const listNav = react.useListNavigation(context, {
3857
- listRef,
3858
- activeIndex,
3859
- onNavigate: setActiveIndex,
3860
- virtual: true,
3861
- loop: true
3862
- });
3863
- const { getReferenceProps, getFloatingProps, getItemProps } = react.useInteractions([role, dismiss, listNav]);
3864
- React.useImperativeHandle(parentRef, () => () => {
3865
- var _a2;
3866
- return (_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
3867
- }, [refs.domReference]);
3868
- function onChange(event) {
3869
- var _a2, _b;
3870
- if (inputType === "key") {
3871
- const lastChar = event.target.value.slice(-1);
3872
- if (["=", "!", "<", ">"].includes(lastChar)) {
3873
- const key = event.target.value.slice(0, -1);
3874
- const optionIndex = options.findIndex((option) => option.value === key);
3875
- if (optionIndex >= 0) {
3876
- model._updateFilter(filterToUse, inputType, options[optionIndex]);
3877
- setInputValue(lastChar);
3878
- }
3879
- reactDom.flushSync(() => {
3880
- setInputType("operator");
3881
- });
3882
- (_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
3883
- return;
3884
- }
3885
- }
3886
- if (inputType === "operator") {
3887
- const lastChar = event.target.value.slice(-1);
3888
- if (/\w/.test(lastChar)) {
3889
- const operator = event.target.value.slice(0, -1);
3890
- if (!/\w/.test(operator)) {
3891
- const optionIndex = options.findIndex((option) => option.value === operator);
3892
- if (optionIndex >= 0) {
3893
- model._updateFilter(filterToUse, inputType, options[optionIndex]);
3894
- setInputValue(lastChar);
3895
- }
3896
- reactDom.flushSync(() => {
3897
- setInputType("value");
3898
- });
3899
- (_b = refs.domReference.current) == null ? void 0 : _b.focus();
3900
- return;
3901
- }
3902
- }
3903
- }
3904
- const value = event.target.value;
3905
- setInputValue(value);
3906
- setActiveIndex(0);
3907
- }
3908
- const items = options.filter(
3909
- (item) => {
3910
- var _a2, _b;
3911
- return (_b = (_a2 = item.label) != null ? _a2 : item.value) == null ? void 0 : _b.toLocaleLowerCase().startsWith(inputValue.toLowerCase());
3912
- }
3913
- );
3914
- const flushInputType = React.useCallback((inputType2) => {
3915
- reactDom.flushSync(() => {
3916
- setInputType(inputType2);
3917
- });
3918
- }, []);
3919
- React.useEffect(() => {
3920
- if (wip && !_wip) {
3921
- model._addWip();
3922
- }
3923
- }, [_wip]);
3924
- React.useEffect(() => {
3925
- if (!wip && refs.domReference.current) {
3926
- setInputType("value");
3927
- setInputValue("");
3928
- refs.domReference.current.focus();
3929
- }
3930
- }, []);
3931
- const handleFetchOptions = React.useCallback(
3932
- async (inputType2) => {
3933
- setOptionsError(false);
3934
- setOptionsLoading(true);
3935
- setOptions([]);
3936
- let options2 = [];
3937
- try {
3938
- if (inputType2 === "key") {
3939
- options2 = await model._getKeys(null);
3940
- } else if (inputType2 === "operator") {
3941
- options2 = model._getOperators();
3942
- } else if (inputType2 === "value") {
3943
- options2 = await model._getValuesFor(filterToUse);
3944
- }
3945
- setOptions(options2);
3946
- } catch (e) {
3947
- setOptionsError(true);
3948
- }
3949
- setOptionsLoading(false);
3950
- },
3951
- [filterToUse, model]
3952
- );
3953
- const handleBackspaceInput = React.useCallback(
3954
- (event) => {
3955
- if (event.key === "Backspace" && !inputValue && inputType === "key") {
3956
- model._removeLastFilter();
3957
- handleFetchOptions(inputType);
3958
- }
3959
- },
3960
- [inputValue, inputType]
3961
- );
3962
- const handleTabInput = React.useCallback((event) => {
3963
- if (event.key === "Tab" && !event.shiftKey) {
3964
- handleChangeViewMode == null ? void 0 : handleChangeViewMode();
3965
- handleResetWip();
3966
- }
3967
- }, []);
3968
- const handleShiftTabInput = React.useCallback((event) => {
3969
- if (event.key === "Tab" && event.shiftKey) {
3970
- handleChangeViewMode == null ? void 0 : handleChangeViewMode();
3971
- handleResetWip();
3972
- }
3973
- }, []);
3974
- const handleEnterInput = React.useCallback(
3975
- (event) => {
3976
- var _a2;
3977
- if (event.key === "Enter" && activeIndex != null && items[activeIndex]) {
3978
- model._updateFilter(filterToUse, inputType, items[activeIndex]);
3979
- setInputValue("");
3980
- setActiveIndex(0);
3981
- if (inputType === "key") {
3982
- flushInputType("operator");
3983
- } else if (inputType === "operator") {
3984
- flushInputType("value");
3985
- } else if (inputType === "value") {
3986
- flushInputType("key");
3987
- handleChangeViewMode == null ? void 0 : handleChangeViewMode();
3988
- }
3989
- (_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
3990
- }
3991
- },
3992
- [activeIndex, filterToUse, inputType, items, model]
3993
- );
3994
- React.useEffect(() => {
3995
- if (open) {
3996
- handleFetchOptions(inputType);
3997
- }
3998
- }, [open, inputType]);
3999
- return /* @__PURE__ */ React__default["default"].createElement("div", {
4000
- className: styles.comboboxWrapper
4001
- }, filterToUse ? /* @__PURE__ */ React__default["default"].createElement("div", {
4002
- className: styles.pillWrapper
4003
- }, (filterToUse == null ? void 0 : filterToUse.key) ? /* @__PURE__ */ React__default["default"].createElement("div", {
4004
- className: css.cx(styles.basePill, styles.keyPill)
4005
- }, filterToUse.key) : null, (filterToUse == null ? void 0 : filterToUse.key) && (filterToUse == null ? void 0 : filterToUse.operator) && inputType !== "operator" ? /* @__PURE__ */ React__default["default"].createElement("div", {
4006
- className: css.cx(styles.basePill, styles.operatorPill, operatorIdentifier),
4007
- role: "button",
4008
- "aria-label": "Edit filter operator",
4009
- tabIndex: 0,
4010
- onClick: (event) => {
4011
- var _a2;
4012
- event.stopPropagation();
4013
- flushInputType("operator");
4014
- (_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
4015
- },
4016
- onKeyDown: (event) => {
4017
- var _a2;
4018
- handleShiftTabInput(event);
4019
- if (event.key === "Enter") {
4020
- flushInputType("operator");
4021
- (_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
4022
- }
4023
- }
4024
- }, filterToUse.operator) : null, (filterToUse == null ? void 0 : filterToUse.key) && (filterToUse == null ? void 0 : filterToUse.operator) && (filterToUse == null ? void 0 : filterToUse.value) && !["operator", "value"].includes(inputType) ? /* @__PURE__ */ React__default["default"].createElement("div", {
4025
- className: css.cx(styles.basePill, styles.valuePill)
4026
- }, filterToUse.value) : null) : null, /* @__PURE__ */ React__default["default"].createElement("input", __spreadProps$o(__spreadValues$A({}, getReferenceProps({
4027
- ref: refs.setReference,
4028
- onChange,
4029
- value: inputValue,
4030
- placeholder: !wip ? inputType === "operator" ? `${filterToUse[inputType]} ${filterToUse.value || ""}` : filterToUse[inputType] : "Filter by label values",
4031
- "aria-autocomplete": "list",
4032
- onKeyDown(event) {
4033
- if (inputType === "operator") {
4034
- handleShiftTabInput(event);
4035
- }
4036
- handleBackspaceInput(event);
4037
- handleTabInput(event);
4038
- handleEnterInput(event);
4039
- }
4040
- })), {
4041
- className: styles.inputStyle,
4042
- onClick: (event) => {
4043
- event.stopPropagation();
4044
- setOpen(true);
4045
- },
4046
- onFocus: () => {
4047
- setActiveIndex(0);
4048
- setOpen(true);
4049
- }
4050
- })), /* @__PURE__ */ React__default["default"].createElement(react.FloatingPortal, null, open && /* @__PURE__ */ React__default["default"].createElement(react.FloatingFocusManager, {
4051
- context,
4052
- initialFocus: -1,
4053
- visuallyHiddenDismiss: true
4054
- }, /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$o(__spreadValues$A({}, getFloatingProps({
4055
- ref: refs.setFloating,
4056
- style: __spreadProps$o(__spreadValues$A({}, floatingStyles), {
4057
- overflowY: "auto"
4058
- })
4059
- })), {
4060
- className: styles.dropdownWrapper
4061
- }), optionsLoading ? /* @__PURE__ */ React__default["default"].createElement(LoadingOptionsPlaceholder, null) : optionsError ? /* @__PURE__ */ React__default["default"].createElement(OptionsErrorPlaceholder, {
4062
- handleFetchOptions: () => handleFetchOptions(inputType)
4063
- }) : !items.length ? /* @__PURE__ */ React__default["default"].createElement(NoOptionsPlaceholder, null) : items.map((item, index) => {
4064
- var _a2;
4065
- return /* @__PURE__ */ React__default["default"].createElement(Item, __spreadProps$o(__spreadValues$A({}, getItemProps({
4066
- key: item.value,
4067
- ref(node) {
4068
- listRef.current[index] = node;
4069
- },
4070
- onClick() {
4071
- var _a3;
4072
- model._updateFilter(filterToUse, inputType, item);
4073
- setInputValue("");
4074
- if (inputType === "key") {
4075
- flushInputType("operator");
4076
- } else if (inputType === "operator") {
4077
- flushInputType("value");
4078
- } else if (inputType === "value") {
4079
- flushInputType("key");
4080
- handleChangeViewMode == null ? void 0 : handleChangeViewMode();
4081
- }
4082
- (_a3 = refs.domReference.current) == null ? void 0 : _a3.focus();
4083
- }
4084
- })), {
4085
- active: activeIndex === index
4086
- }), (_a2 = item.label) != null ? _a2 : item.value);
4087
- })))));
4088
- });
4089
- const LoadingOptionsPlaceholder = () => {
4090
- return /* @__PURE__ */ React__default["default"].createElement(Item, {
4091
- active: false
4092
- }, "Loading options...");
4093
- };
4094
- const NoOptionsPlaceholder = () => {
4095
- return /* @__PURE__ */ React__default["default"].createElement(Item, {
4096
- active: false
4097
- }, "No options found");
4098
- };
4099
- const OptionsErrorPlaceholder = ({ handleFetchOptions }) => {
4100
- return /* @__PURE__ */ React__default["default"].createElement(Item, {
4101
- active: false,
4102
- onClick: handleFetchOptions
4103
- }, "Error. Click to try again!");
4104
- };
4105
- const getStyles2 = (theme) => ({
4106
- comboboxWrapper: css.css({
4107
- display: "flex",
4108
- flexWrap: "nowrap"
4109
- }),
4110
- pillWrapper: css.css({
4111
- display: "flex",
4112
- alignItems: "center",
4113
- whiteSpace: "nowrap"
4114
- }),
4115
- basePill: css.css(__spreadProps$o(__spreadValues$A({
4116
- display: "flex",
4117
- alignItems: "center",
4118
- background: theme.colors.action.disabledBackground,
4119
- border: `1px solid ${theme.colors.border.weak}`,
4120
- padding: theme.spacing(0.125, 1, 0.125, 1),
4121
- color: theme.colors.text.primary,
4122
- overflow: "hidden",
4123
- whiteSpace: "nowrap",
4124
- minHeight: "22px"
4125
- }, theme.typography.bodySmall), {
4126
- cursor: "pointer"
4127
- })),
4128
- keyPill: css.css({
4129
- fontWeight: theme.typography.fontWeightBold,
4130
- cursor: "default"
4131
- }),
4132
- operatorPill: css.css({
4133
- "&:hover": {
4134
- background: theme.colors.action.hover
4135
- }
4136
- }),
4137
- valuePill: css.css({
4138
- background: theme.colors.action.selected
4139
- }),
4140
- dropdownWrapper: css.css({
4141
- backgroundColor: theme.colors.background.primary,
4142
- color: theme.colors.text.primary,
4143
- boxShadow: theme.shadows.z2
4144
- }),
4145
- inputStyle: css.css({
4146
- paddingBlock: 0,
4147
- "&:focus": {
4148
- outline: "none"
4149
- }
4150
- })
4151
- });
4152
-
4153
- var __defProp$z = Object.defineProperty;
4154
- var __defProps$n = Object.defineProperties;
4155
- var __getOwnPropDescs$n = Object.getOwnPropertyDescriptors;
4156
- var __getOwnPropSymbols$z = Object.getOwnPropertySymbols;
4157
- var __hasOwnProp$z = Object.prototype.hasOwnProperty;
4158
- var __propIsEnum$z = Object.prototype.propertyIsEnumerable;
4159
- var __defNormalProp$z = (obj, key, value) => key in obj ? __defProp$z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4160
- var __spreadValues$z = (a, b) => {
4161
- for (var prop in b || (b = {}))
4162
- if (__hasOwnProp$z.call(b, prop))
4163
- __defNormalProp$z(a, prop, b[prop]);
4164
- if (__getOwnPropSymbols$z)
4165
- for (var prop of __getOwnPropSymbols$z(b)) {
4166
- if (__propIsEnum$z.call(b, prop))
4167
- __defNormalProp$z(a, prop, b[prop]);
4168
- }
4169
- return a;
4170
- };
4171
- var __spreadProps$n = (a, b) => __defProps$n(a, __getOwnPropDescs$n(b));
4172
- function AdHocFiltersComboboxEditSwitch({
4173
- filter,
4174
- model
4175
- }) {
4176
- const styles = ui.useStyles2(getStyles$a);
4177
- const [viewMode, setViewMode] = React.useState(true);
4178
- const pillWrapperRef = React.useRef(null);
4179
- const handleChangeViewMode = React.useCallback((event) => {
4180
- var _a;
4181
- event == null ? void 0 : event.stopPropagation();
4182
- let viewMode2 = false;
4183
- reactDom.flushSync(() => {
4184
- setViewMode((mode) => {
4185
- viewMode2 = mode;
4186
- return !mode;
4187
- });
4188
- });
4189
- if (!viewMode2) {
4190
- (_a = pillWrapperRef.current) == null ? void 0 : _a.focus();
4191
- }
4192
- }, []);
4193
- if (viewMode) {
4194
- return /* @__PURE__ */ React__default["default"].createElement("div", {
4195
- className: styles.combinedFilterPill,
4196
- onClick: handleChangeViewMode,
4197
- onKeyDown: (e) => {
4198
- if (e.key === "Enter") {
4199
- handleChangeViewMode();
4200
- }
4201
- },
4202
- role: "button",
4203
- "aria-label": "Edit filter",
4204
- tabIndex: 0,
4205
- ref: pillWrapperRef
4206
- }, /* @__PURE__ */ React__default["default"].createElement("span", null, filter.key, " ", filter.operator, " ", filter.value), /* @__PURE__ */ React__default["default"].createElement(ui.IconButton, {
4207
- onClick: (e) => {
4208
- e.stopPropagation();
4209
- model._removeFilter(filter);
4210
- },
4211
- onKeyDownCapture: (e) => {
4212
- if (e.key === "Enter") {
4213
- e.preventDefault();
4214
- e.stopPropagation();
4215
- model._removeFilter(filter);
4216
- }
4217
- },
4218
- name: "times",
4219
- size: "md",
4220
- className: styles.removeButton,
4221
- tooltip: "Remove filter"
4222
- }));
4223
- }
4224
- return /* @__PURE__ */ React__default["default"].createElement(AdHocCombobox, {
4225
- filter,
4226
- model,
4227
- handleChangeViewMode
4228
- });
4229
- }
4230
- const getStyles$a = (theme) => ({
4231
- combinedFilterPill: css.css(__spreadProps$n(__spreadValues$z({
4232
- display: "flex",
4233
- alignItems: "center",
4234
- background: theme.colors.action.selected,
4235
- borderRadius: theme.shape.radius.default,
4236
- border: `1px solid ${theme.colors.border.weak}`,
4237
- padding: theme.spacing(0.125, 0, 0.125, 1),
4238
- color: theme.colors.text.primary,
4239
- overflow: "hidden",
4240
- whiteSpace: "nowrap",
4241
- minHeight: "22px"
4242
- }, theme.typography.bodySmall), {
4243
- fontWeight: theme.typography.fontWeightBold,
4244
- cursor: "pointer",
4245
- "&:hover": {
4246
- background: theme.colors.action.hover
4247
- }
4248
- })),
4249
- removeButton: css.css({
4250
- marginInline: theme.spacing(0.5),
4251
- cursor: "pointer",
4252
- "&:hover": {
4253
- color: theme.colors.text.primary
4254
- }
4255
- })
4256
- });
4257
-
4258
- const AdHocFiltersComboboxRenderer = React.memo(function AdHocFiltersComboboxRenderer2({
4259
- model
4260
- }) {
4261
- const { filters } = model.useState();
4262
- const styles = ui.useStyles2(getStyles$9);
4263
- const focusOnInputRef = React.useRef();
4264
- return /* @__PURE__ */ React__default["default"].createElement("div", {
4265
- className: styles.comboboxWrapper,
4266
- onClick: () => {
4267
- var _a;
4268
- (_a = focusOnInputRef.current) == null ? void 0 : _a.call(focusOnInputRef);
4269
- }
4270
- }, /* @__PURE__ */ React__default["default"].createElement(ui.Icon, {
4271
- name: "filter",
4272
- className: styles.filterIcon,
4273
- size: "lg"
4274
- }), filters.map((filter, index) => /* @__PURE__ */ React__default["default"].createElement(AdHocFiltersComboboxEditSwitch, {
4275
- key: index,
4276
- filter,
4277
- model
4278
- })), /* @__PURE__ */ React__default["default"].createElement(AdHocCombobox, {
4279
- model,
4280
- wip: true,
4281
- ref: focusOnInputRef
4282
- }));
4283
- });
4284
- const getStyles$9 = (theme) => ({
4285
- comboboxWrapper: css.css({
4286
- display: "flex",
4287
- flexWrap: "wrap",
4288
- alignItems: "center",
4289
- columnGap: theme.spacing(1),
4290
- rowGap: theme.spacing(0.5),
4291
- minHeight: theme.spacing(4),
4292
- backgroundColor: theme.components.input.background,
4293
- border: `1px solid ${theme.colors.border.strong}`,
4294
- borderRadius: theme.shape.radius.default,
4295
- paddingInline: theme.spacing(1),
4296
- paddingBlock: theme.spacing(0.5),
4297
- flexGrow: 1,
4298
- "&:focus-within": {
4299
- outline: "2px dotted transparent",
4300
- outlineOffset: "2px",
4301
- boxShadow: `0 0 0 2px ${theme.colors.background.canvas}, 0 0 0px 4px ${theme.colors.primary.main}`,
4302
- transitionTimingFunction: `cubic-bezier(0.19, 1, 0.22, 1)`,
4303
- transitionDuration: "0.2s",
4304
- transitionProperty: "outline, outline-offset, box-shadow"
4305
- }
4306
- }),
4307
- filterIcon: css.css({
4308
- color: theme.colors.text.secondary,
4309
- alignSelf: "center"
4310
- })
4311
- });
4312
-
4313
3799
  var __defProp$y = Object.defineProperty;
4314
3800
  var __defProps$m = Object.defineProperties;
4315
3801
  var __getOwnPropDescs$m = Object.getOwnPropertyDescriptors;
@@ -4340,7 +3826,7 @@ class AdHocFiltersVariable extends SceneObjectBase {
4340
3826
  applyMode: "auto",
4341
3827
  filterExpression: (_b = state.filterExpression) != null ? _b : renderExpression(state.expressionBuilder, state.filters)
4342
3828
  }, state));
4343
- this._scopedVars = { __sceneObject: { value: this } };
3829
+ this._scopedVars = { __sceneObject: new SafeSerializableSceneObject(this) };
4344
3830
  this._dataSourceSrv = runtime.getDataSourceSrv();
4345
3831
  this._urlSync = new AdHocFiltersVariableUrlSyncHandler(this);
4346
3832
  if (this.state.applyMode === "auto") {
@@ -4395,12 +3881,6 @@ class AdHocFiltersVariable extends SceneObjectBase {
4395
3881
  }
4396
3882
  this.setState({ filters: this.state.filters.filter((f) => f !== filter) });
4397
3883
  }
4398
- _removeLastFilter() {
4399
- const filterToRemove = this.state.filters.at(-1);
4400
- if (filterToRemove) {
4401
- this._removeFilter(filterToRemove);
4402
- }
4403
- }
4404
3884
  async _getKeys(currentKey) {
4405
3885
  var _a, _b, _c;
4406
3886
  const override = await ((_b = (_a = this.state).getTagKeysProvider) == null ? void 0 : _b.call(_a, this, currentKey));
@@ -4482,11 +3962,6 @@ function renderExpression(builder, filters) {
4482
3962
  function AdHocFiltersVariableRenderer({ model }) {
4483
3963
  const { filters, readOnly, addFilterButtonText } = model.useState();
4484
3964
  const styles = ui.useStyles2(getStyles$8);
4485
- if (model.state.layout === "combobox") {
4486
- return /* @__PURE__ */ React__default["default"].createElement(AdHocFiltersComboboxRenderer, {
4487
- model
4488
- });
4489
- }
4490
3965
  return /* @__PURE__ */ React__default["default"].createElement("div", {
4491
3966
  className: styles.wrapper
4492
3967
  }, filters.map((filter, index) => /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, {
@@ -4507,6 +3982,10 @@ const getStyles$8 = (theme) => ({
4507
3982
  alignItems: "flex-end",
4508
3983
  columnGap: theme.spacing(2),
4509
3984
  rowGap: theme.spacing(1)
3985
+ }),
3986
+ filterIcon: css.css({
3987
+ color: theme.colors.text.secondary,
3988
+ paddingRight: theme.spacing(0.5)
4510
3989
  })
4511
3990
  });
4512
3991
  function toSelectableValue(input) {
@@ -4595,7 +4074,7 @@ class SceneQueryRunner extends SceneObjectBase {
4595
4074
  this._dataLayersMerger = new DataLayersMerger();
4596
4075
  this._variableValueRecorder = new VariableValueRecorder();
4597
4076
  this._results = new rxjs.ReplaySubject(1);
4598
- this._scopedVars = { __sceneObject: { value: this, text: "__sceneObject" } };
4077
+ this._scopedVars = { __sceneObject: new SafeSerializableSceneObject(this) };
4599
4078
  this._variableDependency = new VariableDependencyConfig(this, {
4600
4079
  statePaths: ["queries", "datasource"],
4601
4080
  onVariableUpdateCompleted: this.onVariableUpdatesCompleted.bind(this),
@@ -6546,7 +6025,7 @@ function executeAnnotationQuery(datasource, timeRange, query, layer) {
6546
6025
  __interval: { text: interval.interval, value: interval.interval },
6547
6026
  __interval_ms: { text: interval.intervalMs.toString(), value: interval.intervalMs },
6548
6027
  __annotation: { text: annotation.name, value: annotation },
6549
- __sceneObject: { text: "__sceneObject", value: layer }
6028
+ __sceneObject: new SafeSerializableSceneObject(layer)
6550
6029
  };
6551
6030
  const queryRequest = __spreadValues$q(__spreadProps$f(__spreadValues$q({
6552
6031
  startTime: Date.now(),
@@ -6690,7 +6169,9 @@ class AnnotationsDataLayer extends SceneDataLayerBase {
6690
6169
  }, initialState),
6691
6170
  ["query"]
6692
6171
  );
6693
- this._scopedVars = { __sceneObject: { value: this, text: "__sceneObject" } };
6172
+ this._scopedVars = {
6173
+ __sceneObject: new SafeSerializableSceneObject(this)
6174
+ };
6694
6175
  }
6695
6176
  onEnable() {
6696
6177
  const timeRange = sceneGraph.getTimeRange(this);
@@ -8013,7 +7494,7 @@ class QueryVariable extends MultiValueVariable {
8013
7494
  this.setState({ loading: true, error: null });
8014
7495
  return rxjs.from(
8015
7496
  getDataSource(this.state.datasource, {
8016
- __sceneObject: { text: "__sceneObject", value: this }
7497
+ __sceneObject: new SafeSerializableSceneObject(this)
8017
7498
  })
8018
7499
  ).pipe(
8019
7500
  rxjs.mergeMap((ds) => {
@@ -8054,7 +7535,7 @@ class QueryVariable extends MultiValueVariable {
8054
7535
  }
8055
7536
  getRequest(target, searchFilter) {
8056
7537
  const scopedVars = {
8057
- __sceneObject: { text: "__sceneObject", value: this }
7538
+ __sceneObject: new SafeSerializableSceneObject(this)
8058
7539
  };
8059
7540
  if (searchFilter) {
8060
7541
  scopedVars.__searchFilter = { value: searchFilter, text: searchFilter };
@@ -12172,6 +11653,7 @@ exports.PanelBuilders = PanelBuilders;
12172
11653
  exports.PanelOptionsBuilders = PanelOptionsBuilders;
12173
11654
  exports.QueryVariable = QueryVariable;
12174
11655
  exports.RuntimeDataSource = RuntimeDataSource;
11656
+ exports.SafeSerializableSceneObject = SafeSerializableSceneObject;
12175
11657
  exports.SceneApp = SceneApp;
12176
11658
  exports.SceneAppPage = SceneAppPage;
12177
11659
  exports.SceneByFrameRepeater = SceneByFrameRepeater;