@axdspub/axiom-charts 1.0.9 → 1.1.0-alpha.2

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.
@@ -1,4 +1,4 @@
1
- var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Selection, d3, d3Scale, d3Axis, d3Shape, reactDom, axiomUiUtilities, axiomMaps) {
1
+ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, jsxRuntime, React, d3Selection, d3, d3Scale, d3Axis, d3Shape, reactDom, reactQuery, axiomUiUtilities, axiomMaps) {
2
2
  'use strict';
3
3
 
4
4
  function _interopNamespaceDefault(e) {
@@ -280,7 +280,7 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
280
280
  var root = freeGlobal || freeSelf || Function('return this')();
281
281
 
282
282
  /** Built-in value references. */
283
- var Symbol$1 = root.Symbol;
283
+ var Symbol = root.Symbol;
284
284
 
285
285
  /** Used for built-in method references. */
286
286
  var objectProto$g = Object.prototype;
@@ -296,7 +296,7 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
296
296
  var nativeObjectToString$1 = objectProto$g.toString;
297
297
 
298
298
  /** Built-in value references. */
299
- var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined;
299
+ var symToStringTag$1 = Symbol ? Symbol.toStringTag : undefined;
300
300
 
301
301
  /**
302
302
  * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
@@ -351,7 +351,7 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
351
351
  undefinedTag = '[object Undefined]';
352
352
 
353
353
  /** Built-in value references. */
354
- var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined;
354
+ var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
355
355
 
356
356
  /**
357
357
  * The base implementation of `getTag` without fallbacks for buggy environments.
@@ -468,7 +468,7 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
468
468
  var isArray = Array.isArray;
469
469
 
470
470
  /** Used to convert symbols to primitives and strings. */
471
- var symbolProto$2 = Symbol$1 ? Symbol$1.prototype : undefined,
471
+ var symbolProto$2 = Symbol ? Symbol.prototype : undefined,
472
472
  symbolToString = symbolProto$2 ? symbolProto$2.toString : undefined;
473
473
 
474
474
  /**
@@ -1886,7 +1886,7 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
1886
1886
  ListCache.prototype.set = listCacheSet;
1887
1887
 
1888
1888
  /* Built-in method references that are verified to be native. */
1889
- var Map$1 = getNative(root, 'Map');
1889
+ var Map = getNative(root, 'Map');
1890
1890
 
1891
1891
  /**
1892
1892
  * Removes all key-value entries from the map.
@@ -1899,7 +1899,7 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
1899
1899
  this.size = 0;
1900
1900
  this.__data__ = {
1901
1901
  'hash': new Hash,
1902
- 'map': new (Map$1 || ListCache),
1902
+ 'map': new (Map || ListCache),
1903
1903
  'string': new Hash
1904
1904
  };
1905
1905
  }
@@ -2260,7 +2260,7 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
2260
2260
  }
2261
2261
 
2262
2262
  /** Built-in value references. */
2263
- var spreadableSymbol = Symbol$1 ? Symbol$1.isConcatSpreadable : undefined;
2263
+ var spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
2264
2264
 
2265
2265
  /**
2266
2266
  * Checks if `value` is a flattenable `arguments` object or array.
@@ -2382,7 +2382,7 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
2382
2382
  * _.isPlainObject(Object.create(null));
2383
2383
  * // => true
2384
2384
  */
2385
- function isPlainObject$1(value) {
2385
+ function isPlainObject(value) {
2386
2386
  if (!isObjectLike(value) || baseGetTag(value) != objectTag$3) {
2387
2387
  return false;
2388
2388
  }
@@ -2497,7 +2497,7 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
2497
2497
  var data = this.__data__;
2498
2498
  if (data instanceof ListCache) {
2499
2499
  var pairs = data.__data__;
2500
- if (!Map$1 || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
2500
+ if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
2501
2501
  pairs.push([key, value]);
2502
2502
  this.size = ++data.size;
2503
2503
  return this;
@@ -2705,7 +2705,7 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
2705
2705
 
2706
2706
  /** Used to detect maps, sets, and weakmaps. */
2707
2707
  var dataViewCtorString = toSource(DataView),
2708
- mapCtorString = toSource(Map$1),
2708
+ mapCtorString = toSource(Map),
2709
2709
  promiseCtorString = toSource(Promise$1),
2710
2710
  setCtorString = toSource(Set$1),
2711
2711
  weakMapCtorString = toSource(WeakMap);
@@ -2721,7 +2721,7 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
2721
2721
 
2722
2722
  // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
2723
2723
  if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag$3) ||
2724
- (Map$1 && getTag(new Map$1) != mapTag$4) ||
2724
+ (Map && getTag(new Map) != mapTag$4) ||
2725
2725
  (Promise$1 && getTag(Promise$1.resolve()) != promiseTag) ||
2726
2726
  (Set$1 && getTag(new Set$1) != setTag$4) ||
2727
2727
  (WeakMap && getTag(new WeakMap) != weakMapTag$1)) {
@@ -2814,7 +2814,7 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
2814
2814
  }
2815
2815
 
2816
2816
  /** Used to convert symbols to primitives and strings. */
2817
- var symbolProto$1 = Symbol$1 ? Symbol$1.prototype : undefined,
2817
+ var symbolProto$1 = Symbol ? Symbol.prototype : undefined,
2818
2818
  symbolValueOf$1 = symbolProto$1 ? symbolProto$1.valueOf : undefined;
2819
2819
 
2820
2820
  /**
@@ -3327,7 +3327,7 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
3327
3327
  dataViewTag = '[object DataView]';
3328
3328
 
3329
3329
  /** Used to convert symbols to primitives and strings. */
3330
- var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined,
3330
+ var symbolProto = Symbol ? Symbol.prototype : undefined,
3331
3331
  symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
3332
3332
 
3333
3333
  /**
@@ -4401,7 +4401,7 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
4401
4401
  * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
4402
4402
  */
4403
4403
  function customOmitClone(value) {
4404
- return isPlainObject$1(value) ? undefined : value;
4404
+ return isPlainObject(value) ? undefined : value;
4405
4405
  }
4406
4406
 
4407
4407
  /** Used to compose bitmasks for cloning. */
@@ -4743,420 +4743,6 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
4743
4743
  class RadialChartRoot extends ChartRoot {
4744
4744
  }
4745
4745
 
4746
- var jsxRuntime = {exports: {}};
4747
-
4748
- var reactJsxRuntime_production = {};
4749
-
4750
- /**
4751
- * @license React
4752
- * react-jsx-runtime.production.js
4753
- *
4754
- * Copyright (c) Meta Platforms, Inc. and affiliates.
4755
- *
4756
- * This source code is licensed under the MIT license found in the
4757
- * LICENSE file in the root directory of this source tree.
4758
- */
4759
-
4760
- var hasRequiredReactJsxRuntime_production;
4761
-
4762
- function requireReactJsxRuntime_production () {
4763
- if (hasRequiredReactJsxRuntime_production) return reactJsxRuntime_production;
4764
- hasRequiredReactJsxRuntime_production = 1;
4765
- var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
4766
- REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
4767
- function jsxProd(type, config, maybeKey) {
4768
- var key = null;
4769
- void 0 !== maybeKey && (key = "" + maybeKey);
4770
- void 0 !== config.key && (key = "" + config.key);
4771
- if ("key" in config) {
4772
- maybeKey = {};
4773
- for (var propName in config)
4774
- "key" !== propName && (maybeKey[propName] = config[propName]);
4775
- } else maybeKey = config;
4776
- config = maybeKey.ref;
4777
- return {
4778
- $$typeof: REACT_ELEMENT_TYPE,
4779
- type: type,
4780
- key: key,
4781
- ref: void 0 !== config ? config : null,
4782
- props: maybeKey
4783
- };
4784
- }
4785
- reactJsxRuntime_production.Fragment = REACT_FRAGMENT_TYPE;
4786
- reactJsxRuntime_production.jsx = jsxProd;
4787
- reactJsxRuntime_production.jsxs = jsxProd;
4788
- return reactJsxRuntime_production;
4789
- }
4790
-
4791
- var reactJsxRuntime_development = {};
4792
-
4793
- /**
4794
- * @license React
4795
- * react-jsx-runtime.development.js
4796
- *
4797
- * Copyright (c) Meta Platforms, Inc. and affiliates.
4798
- *
4799
- * This source code is licensed under the MIT license found in the
4800
- * LICENSE file in the root directory of this source tree.
4801
- */
4802
-
4803
- var hasRequiredReactJsxRuntime_development;
4804
-
4805
- function requireReactJsxRuntime_development () {
4806
- if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
4807
- hasRequiredReactJsxRuntime_development = 1;
4808
- "production" !== process.env.NODE_ENV &&
4809
- (function () {
4810
- function getComponentNameFromType(type) {
4811
- if (null == type) return null;
4812
- if ("function" === typeof type)
4813
- return type.$$typeof === REACT_CLIENT_REFERENCE
4814
- ? null
4815
- : type.displayName || type.name || null;
4816
- if ("string" === typeof type) return type;
4817
- switch (type) {
4818
- case REACT_FRAGMENT_TYPE:
4819
- return "Fragment";
4820
- case REACT_PROFILER_TYPE:
4821
- return "Profiler";
4822
- case REACT_STRICT_MODE_TYPE:
4823
- return "StrictMode";
4824
- case REACT_SUSPENSE_TYPE:
4825
- return "Suspense";
4826
- case REACT_SUSPENSE_LIST_TYPE:
4827
- return "SuspenseList";
4828
- case REACT_ACTIVITY_TYPE:
4829
- return "Activity";
4830
- }
4831
- if ("object" === typeof type)
4832
- switch (
4833
- ("number" === typeof type.tag &&
4834
- console.error(
4835
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
4836
- ),
4837
- type.$$typeof)
4838
- ) {
4839
- case REACT_PORTAL_TYPE:
4840
- return "Portal";
4841
- case REACT_CONTEXT_TYPE:
4842
- return type.displayName || "Context";
4843
- case REACT_CONSUMER_TYPE:
4844
- return (type._context.displayName || "Context") + ".Consumer";
4845
- case REACT_FORWARD_REF_TYPE:
4846
- var innerType = type.render;
4847
- type = type.displayName;
4848
- type ||
4849
- ((type = innerType.displayName || innerType.name || ""),
4850
- (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"));
4851
- return type;
4852
- case REACT_MEMO_TYPE:
4853
- return (
4854
- (innerType = type.displayName || null),
4855
- null !== innerType
4856
- ? innerType
4857
- : getComponentNameFromType(type.type) || "Memo"
4858
- );
4859
- case REACT_LAZY_TYPE:
4860
- innerType = type._payload;
4861
- type = type._init;
4862
- try {
4863
- return getComponentNameFromType(type(innerType));
4864
- } catch (x) {}
4865
- }
4866
- return null;
4867
- }
4868
- function testStringCoercion(value) {
4869
- return "" + value;
4870
- }
4871
- function checkKeyStringCoercion(value) {
4872
- try {
4873
- testStringCoercion(value);
4874
- var JSCompiler_inline_result = !1;
4875
- } catch (e) {
4876
- JSCompiler_inline_result = true;
4877
- }
4878
- if (JSCompiler_inline_result) {
4879
- JSCompiler_inline_result = console;
4880
- var JSCompiler_temp_const = JSCompiler_inline_result.error;
4881
- var JSCompiler_inline_result$jscomp$0 =
4882
- ("function" === typeof Symbol &&
4883
- Symbol.toStringTag &&
4884
- value[Symbol.toStringTag]) ||
4885
- value.constructor.name ||
4886
- "Object";
4887
- JSCompiler_temp_const.call(
4888
- JSCompiler_inline_result,
4889
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
4890
- JSCompiler_inline_result$jscomp$0
4891
- );
4892
- return testStringCoercion(value);
4893
- }
4894
- }
4895
- function getTaskName(type) {
4896
- if (type === REACT_FRAGMENT_TYPE) return "<>";
4897
- if (
4898
- "object" === typeof type &&
4899
- null !== type &&
4900
- type.$$typeof === REACT_LAZY_TYPE
4901
- )
4902
- return "<...>";
4903
- try {
4904
- var name = getComponentNameFromType(type);
4905
- return name ? "<" + name + ">" : "<...>";
4906
- } catch (x) {
4907
- return "<...>";
4908
- }
4909
- }
4910
- function getOwner() {
4911
- var dispatcher = ReactSharedInternals.A;
4912
- return null === dispatcher ? null : dispatcher.getOwner();
4913
- }
4914
- function UnknownOwner() {
4915
- return Error("react-stack-top-frame");
4916
- }
4917
- function hasValidKey(config) {
4918
- if (hasOwnProperty.call(config, "key")) {
4919
- var getter = Object.getOwnPropertyDescriptor(config, "key").get;
4920
- if (getter && getter.isReactWarning) return false;
4921
- }
4922
- return void 0 !== config.key;
4923
- }
4924
- function defineKeyPropWarningGetter(props, displayName) {
4925
- function warnAboutAccessingKey() {
4926
- specialPropKeyWarningShown ||
4927
- ((specialPropKeyWarningShown = true),
4928
- console.error(
4929
- "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
4930
- displayName
4931
- ));
4932
- }
4933
- warnAboutAccessingKey.isReactWarning = true;
4934
- Object.defineProperty(props, "key", {
4935
- get: warnAboutAccessingKey,
4936
- configurable: true
4937
- });
4938
- }
4939
- function elementRefGetterWithDeprecationWarning() {
4940
- var componentName = getComponentNameFromType(this.type);
4941
- didWarnAboutElementRef[componentName] ||
4942
- ((didWarnAboutElementRef[componentName] = true),
4943
- console.error(
4944
- "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
4945
- ));
4946
- componentName = this.props.ref;
4947
- return void 0 !== componentName ? componentName : null;
4948
- }
4949
- function ReactElement(type, key, props, owner, debugStack, debugTask) {
4950
- var refProp = props.ref;
4951
- type = {
4952
- $$typeof: REACT_ELEMENT_TYPE,
4953
- type: type,
4954
- key: key,
4955
- props: props,
4956
- _owner: owner
4957
- };
4958
- null !== (void 0 !== refProp ? refProp : null)
4959
- ? Object.defineProperty(type, "ref", {
4960
- enumerable: false,
4961
- get: elementRefGetterWithDeprecationWarning
4962
- })
4963
- : Object.defineProperty(type, "ref", { enumerable: false, value: null });
4964
- type._store = {};
4965
- Object.defineProperty(type._store, "validated", {
4966
- configurable: false,
4967
- enumerable: false,
4968
- writable: true,
4969
- value: 0
4970
- });
4971
- Object.defineProperty(type, "_debugInfo", {
4972
- configurable: false,
4973
- enumerable: false,
4974
- writable: true,
4975
- value: null
4976
- });
4977
- Object.defineProperty(type, "_debugStack", {
4978
- configurable: false,
4979
- enumerable: false,
4980
- writable: true,
4981
- value: debugStack
4982
- });
4983
- Object.defineProperty(type, "_debugTask", {
4984
- configurable: false,
4985
- enumerable: false,
4986
- writable: true,
4987
- value: debugTask
4988
- });
4989
- Object.freeze && (Object.freeze(type.props), Object.freeze(type));
4990
- return type;
4991
- }
4992
- function jsxDEVImpl(
4993
- type,
4994
- config,
4995
- maybeKey,
4996
- isStaticChildren,
4997
- debugStack,
4998
- debugTask
4999
- ) {
5000
- var children = config.children;
5001
- if (void 0 !== children)
5002
- if (isStaticChildren)
5003
- if (isArrayImpl(children)) {
5004
- for (
5005
- isStaticChildren = 0;
5006
- isStaticChildren < children.length;
5007
- isStaticChildren++
5008
- )
5009
- validateChildKeys(children[isStaticChildren]);
5010
- Object.freeze && Object.freeze(children);
5011
- } else
5012
- console.error(
5013
- "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
5014
- );
5015
- else validateChildKeys(children);
5016
- if (hasOwnProperty.call(config, "key")) {
5017
- children = getComponentNameFromType(type);
5018
- var keys = Object.keys(config).filter(function (k) {
5019
- return "key" !== k;
5020
- });
5021
- isStaticChildren =
5022
- 0 < keys.length
5023
- ? "{key: someKey, " + keys.join(": ..., ") + ": ...}"
5024
- : "{key: someKey}";
5025
- didWarnAboutKeySpread[children + isStaticChildren] ||
5026
- ((keys =
5027
- 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}"),
5028
- console.error(
5029
- 'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',
5030
- isStaticChildren,
5031
- children,
5032
- keys,
5033
- children
5034
- ),
5035
- (didWarnAboutKeySpread[children + isStaticChildren] = true));
5036
- }
5037
- children = null;
5038
- void 0 !== maybeKey &&
5039
- (checkKeyStringCoercion(maybeKey), (children = "" + maybeKey));
5040
- hasValidKey(config) &&
5041
- (checkKeyStringCoercion(config.key), (children = "" + config.key));
5042
- if ("key" in config) {
5043
- maybeKey = {};
5044
- for (var propName in config)
5045
- "key" !== propName && (maybeKey[propName] = config[propName]);
5046
- } else maybeKey = config;
5047
- children &&
5048
- defineKeyPropWarningGetter(
5049
- maybeKey,
5050
- "function" === typeof type
5051
- ? type.displayName || type.name || "Unknown"
5052
- : type
5053
- );
5054
- return ReactElement(
5055
- type,
5056
- children,
5057
- maybeKey,
5058
- getOwner(),
5059
- debugStack,
5060
- debugTask
5061
- );
5062
- }
5063
- function validateChildKeys(node) {
5064
- isValidElement(node)
5065
- ? node._store && (node._store.validated = 1)
5066
- : "object" === typeof node &&
5067
- null !== node &&
5068
- node.$$typeof === REACT_LAZY_TYPE &&
5069
- ("fulfilled" === node._payload.status
5070
- ? isValidElement(node._payload.value) &&
5071
- node._payload.value._store &&
5072
- (node._payload.value._store.validated = 1)
5073
- : node._store && (node._store.validated = 1));
5074
- }
5075
- function isValidElement(object) {
5076
- return (
5077
- "object" === typeof object &&
5078
- null !== object &&
5079
- object.$$typeof === REACT_ELEMENT_TYPE
5080
- );
5081
- }
5082
- var React$1 = React,
5083
- REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
5084
- REACT_PORTAL_TYPE = Symbol.for("react.portal"),
5085
- REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
5086
- REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
5087
- REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
5088
- REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
5089
- REACT_CONTEXT_TYPE = Symbol.for("react.context"),
5090
- REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
5091
- REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
5092
- REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
5093
- REACT_MEMO_TYPE = Symbol.for("react.memo"),
5094
- REACT_LAZY_TYPE = Symbol.for("react.lazy"),
5095
- REACT_ACTIVITY_TYPE = Symbol.for("react.activity"),
5096
- REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"),
5097
- ReactSharedInternals =
5098
- React$1.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
5099
- hasOwnProperty = Object.prototype.hasOwnProperty,
5100
- isArrayImpl = Array.isArray,
5101
- createTask = console.createTask
5102
- ? console.createTask
5103
- : function () {
5104
- return null;
5105
- };
5106
- React$1 = {
5107
- react_stack_bottom_frame: function (callStackForError) {
5108
- return callStackForError();
5109
- }
5110
- };
5111
- var specialPropKeyWarningShown;
5112
- var didWarnAboutElementRef = {};
5113
- var unknownOwnerDebugStack = React$1.react_stack_bottom_frame.bind(
5114
- React$1,
5115
- UnknownOwner
5116
- )();
5117
- var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
5118
- var didWarnAboutKeySpread = {};
5119
- reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
5120
- reactJsxRuntime_development.jsx = function (type, config, maybeKey) {
5121
- var trackActualOwner =
5122
- 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
5123
- return jsxDEVImpl(
5124
- type,
5125
- config,
5126
- maybeKey,
5127
- false,
5128
- trackActualOwner
5129
- ? Error("react-stack-top-frame")
5130
- : unknownOwnerDebugStack,
5131
- trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
5132
- );
5133
- };
5134
- reactJsxRuntime_development.jsxs = function (type, config, maybeKey) {
5135
- var trackActualOwner =
5136
- 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
5137
- return jsxDEVImpl(
5138
- type,
5139
- config,
5140
- maybeKey,
5141
- true,
5142
- trackActualOwner
5143
- ? Error("react-stack-top-frame")
5144
- : unknownOwnerDebugStack,
5145
- trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
5146
- );
5147
- };
5148
- })();
5149
- return reactJsxRuntime_development;
5150
- }
5151
-
5152
- if (process.env.NODE_ENV === 'production') {
5153
- jsxRuntime.exports = requireReactJsxRuntime_production();
5154
- } else {
5155
- jsxRuntime.exports = requireReactJsxRuntime_development();
5156
- }
5157
-
5158
- var jsxRuntimeExports = jsxRuntime.exports;
5159
-
5160
4746
  class AxiomPlotRoot extends PlotRoot {
5161
4747
  }
5162
4748
 
@@ -6969,9 +6555,9 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
6969
6555
  style = { width: w, height: `${props.settings.height}px` };
6970
6556
  }
6971
6557
  const DefaultLoader = () => {
6972
- return (jsxRuntimeExports.jsx("div", { className: 'absolute bg-slate-100 rounded-md', style: style }));
6558
+ return (jsxRuntime.jsx("div", { className: 'absolute bg-slate-100 rounded-md', style: style }));
6973
6559
  };
6974
- return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [error !== undefined ? jsxRuntimeExports.jsx("p", { children: error }) : '', jsxRuntimeExports.jsx("div", { className: 'hidden', children: loading ? jsxRuntimeExports.jsx(DefaultLoader, {}) : jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {}) }), jsxRuntimeExports.jsx("div", { className: "chart relative", style: style, ref: chartRef })] }));
6560
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [error !== undefined ? jsxRuntime.jsx("p", { children: error }) : '', jsxRuntime.jsx("div", { className: 'hidden', children: loading ? jsxRuntime.jsx(DefaultLoader, {}) : jsxRuntime.jsx(jsxRuntime.Fragment, {}) }), jsxRuntime.jsx("div", { className: "chart relative", style: style, ref: chartRef })] }));
6975
6561
  };
6976
6562
 
6977
6563
  function useWindowScroll() {
@@ -7059,2883 +6645,13 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
7059
6645
  }, [scrollX, scrollY]);
7060
6646
  const isScrubbing = Object.keys(plotScrubs).length > 0;
7061
6647
  const hide = !isScrubbing || scrolling;
7062
- return reactDom.createPortal(jsxRuntimeExports.jsx("div", { className: 'fixed z-30 pointer-events-none min-h-[1px]', style: { left: position.x, top: position.y, visibility: hide ? 'hidden' : 'visible' }, children: jsxRuntimeExports.jsx("div", { ref: ref, children: children }) }), document.body);
6648
+ return reactDom.createPortal(jsxRuntime.jsx("div", { className: 'fixed z-30 pointer-events-none min-h-[1px]', style: { left: position.x, top: position.y, visibility: hide ? 'hidden' : 'visible' }, children: jsxRuntime.jsx("div", { ref: ref, children: children }) }), document.body);
7063
6649
  };
7064
6650
 
7065
6651
  const Legend = ({ plotLegends, style }) => {
7066
- return (jsxRuntimeExports.jsx("div", { className: 'flex gap-4 flex-wrap hover:cursor-pointer', style: style, children: Object.entries(plotLegends).map(([plotId, legendItems]) => (jsxRuntimeExports.jsx("div", { className: 'flex gap-4 flex-wrap', children: legendItems.map(item => (jsxRuntimeExports.jsxs("div", { className: 'flex gap-2 items-center', children: [jsxRuntimeExports.jsx("div", { className: 'w-4 h-4 rounded-full', style: item.style }), jsxRuntimeExports.jsx("div", { children: item.label })] }, item.id))) }, plotId))) }));
7067
- };
7068
-
7069
- // src/subscribable.ts
7070
- var Subscribable = class {
7071
- constructor() {
7072
- this.listeners = /* @__PURE__ */ new Set();
7073
- this.subscribe = this.subscribe.bind(this);
7074
- }
7075
- subscribe(listener) {
7076
- this.listeners.add(listener);
7077
- this.onSubscribe();
7078
- return () => {
7079
- this.listeners.delete(listener);
7080
- this.onUnsubscribe();
7081
- };
7082
- }
7083
- hasListeners() {
7084
- return this.listeners.size > 0;
7085
- }
7086
- onSubscribe() {
7087
- }
7088
- onUnsubscribe() {
7089
- }
7090
- };
7091
-
7092
- // src/timeoutManager.ts
7093
- var defaultTimeoutProvider = {
7094
- // We need the wrapper function syntax below instead of direct references to
7095
- // global setTimeout etc.
7096
- //
7097
- // BAD: `setTimeout: setTimeout`
7098
- // GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`
7099
- //
7100
- // If we use direct references here, then anything that wants to spy on or
7101
- // replace the global setTimeout (like tests) won't work since we'll already
7102
- // have a hard reference to the original implementation at the time when this
7103
- // file was imported.
7104
- setTimeout: (callback, delay) => setTimeout(callback, delay),
7105
- clearTimeout: (timeoutId) => clearTimeout(timeoutId),
7106
- setInterval: (callback, delay) => setInterval(callback, delay),
7107
- clearInterval: (intervalId) => clearInterval(intervalId)
7108
- };
7109
- var TimeoutManager = class {
7110
- // We cannot have TimeoutManager<T> as we must instantiate it with a concrete
7111
- // type at app boot; and if we leave that type, then any new timer provider
7112
- // would need to support ReturnType<typeof setTimeout>, which is infeasible.
7113
- //
7114
- // We settle for type safety for the TimeoutProvider type, and accept that
7115
- // this class is unsafe internally to allow for extension.
7116
- #provider = defaultTimeoutProvider;
7117
- #providerCalled = false;
7118
- setTimeoutProvider(provider) {
7119
- if (process.env.NODE_ENV !== "production") {
7120
- if (this.#providerCalled && provider !== this.#provider) {
7121
- console.error(
7122
- `[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.`,
7123
- { previous: this.#provider, provider }
7124
- );
7125
- }
7126
- }
7127
- this.#provider = provider;
7128
- if (process.env.NODE_ENV !== "production") {
7129
- this.#providerCalled = false;
7130
- }
7131
- }
7132
- setTimeout(callback, delay) {
7133
- if (process.env.NODE_ENV !== "production") {
7134
- this.#providerCalled = true;
7135
- }
7136
- return this.#provider.setTimeout(callback, delay);
7137
- }
7138
- clearTimeout(timeoutId) {
7139
- this.#provider.clearTimeout(timeoutId);
7140
- }
7141
- setInterval(callback, delay) {
7142
- if (process.env.NODE_ENV !== "production") {
7143
- this.#providerCalled = true;
7144
- }
7145
- return this.#provider.setInterval(callback, delay);
7146
- }
7147
- clearInterval(intervalId) {
7148
- this.#provider.clearInterval(intervalId);
7149
- }
7150
- };
7151
- var timeoutManager = new TimeoutManager();
7152
- function systemSetTimeoutZero(callback) {
7153
- setTimeout(callback, 0);
7154
- }
7155
-
7156
- // src/utils.ts
7157
- var isServer = typeof window === "undefined" || "Deno" in globalThis;
7158
- function noop() {
7159
- }
7160
- function functionalUpdate(updater, input) {
7161
- return typeof updater === "function" ? updater(input) : updater;
7162
- }
7163
- function isValidTimeout(value) {
7164
- return typeof value === "number" && value >= 0 && value !== Infinity;
7165
- }
7166
- function timeUntilStale(updatedAt, staleTime) {
7167
- return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);
7168
- }
7169
- function resolveStaleTime(staleTime, query) {
7170
- return typeof staleTime === "function" ? staleTime(query) : staleTime;
7171
- }
7172
- function resolveEnabled(enabled, query) {
7173
- return typeof enabled === "function" ? enabled(query) : enabled;
7174
- }
7175
- function matchQuery(filters, query) {
7176
- const {
7177
- type = "all",
7178
- exact,
7179
- fetchStatus,
7180
- predicate,
7181
- queryKey,
7182
- stale
7183
- } = filters;
7184
- if (queryKey) {
7185
- if (exact) {
7186
- if (query.queryHash !== hashQueryKeyByOptions(queryKey, query.options)) {
7187
- return false;
7188
- }
7189
- } else if (!partialMatchKey(query.queryKey, queryKey)) {
7190
- return false;
7191
- }
7192
- }
7193
- if (type !== "all") {
7194
- const isActive = query.isActive();
7195
- if (type === "active" && !isActive) {
7196
- return false;
7197
- }
7198
- if (type === "inactive" && isActive) {
7199
- return false;
7200
- }
7201
- }
7202
- if (typeof stale === "boolean" && query.isStale() !== stale) {
7203
- return false;
7204
- }
7205
- if (fetchStatus && fetchStatus !== query.state.fetchStatus) {
7206
- return false;
7207
- }
7208
- if (predicate && !predicate(query)) {
7209
- return false;
7210
- }
7211
- return true;
7212
- }
7213
- function matchMutation(filters, mutation) {
7214
- const { exact, status, predicate, mutationKey } = filters;
7215
- if (mutationKey) {
7216
- if (!mutation.options.mutationKey) {
7217
- return false;
7218
- }
7219
- if (exact) {
7220
- if (hashKey(mutation.options.mutationKey) !== hashKey(mutationKey)) {
7221
- return false;
7222
- }
7223
- } else if (!partialMatchKey(mutation.options.mutationKey, mutationKey)) {
7224
- return false;
7225
- }
7226
- }
7227
- if (status && mutation.state.status !== status) {
7228
- return false;
7229
- }
7230
- if (predicate && !predicate(mutation)) {
7231
- return false;
7232
- }
7233
- return true;
7234
- }
7235
- function hashQueryKeyByOptions(queryKey, options) {
7236
- const hashFn = options?.queryKeyHashFn || hashKey;
7237
- return hashFn(queryKey);
7238
- }
7239
- function hashKey(queryKey) {
7240
- return JSON.stringify(
7241
- queryKey,
7242
- (_, val) => isPlainObject(val) ? Object.keys(val).sort().reduce((result, key) => {
7243
- result[key] = val[key];
7244
- return result;
7245
- }, {}) : val
7246
- );
7247
- }
7248
- function partialMatchKey(a, b) {
7249
- if (a === b) {
7250
- return true;
7251
- }
7252
- if (typeof a !== typeof b) {
7253
- return false;
7254
- }
7255
- if (a && b && typeof a === "object" && typeof b === "object") {
7256
- return Object.keys(b).every((key) => partialMatchKey(a[key], b[key]));
7257
- }
7258
- return false;
7259
- }
7260
- var hasOwn = Object.prototype.hasOwnProperty;
7261
- function replaceEqualDeep(a, b) {
7262
- if (a === b) {
7263
- return a;
7264
- }
7265
- const array = isPlainArray(a) && isPlainArray(b);
7266
- if (!array && !(isPlainObject(a) && isPlainObject(b))) return b;
7267
- const aItems = array ? a : Object.keys(a);
7268
- const aSize = aItems.length;
7269
- const bItems = array ? b : Object.keys(b);
7270
- const bSize = bItems.length;
7271
- const copy = array ? new Array(bSize) : {};
7272
- let equalItems = 0;
7273
- for (let i = 0; i < bSize; i++) {
7274
- const key = array ? i : bItems[i];
7275
- const aItem = a[key];
7276
- const bItem = b[key];
7277
- if (aItem === bItem) {
7278
- copy[key] = aItem;
7279
- if (array ? i < aSize : hasOwn.call(a, key)) equalItems++;
7280
- continue;
7281
- }
7282
- if (aItem === null || bItem === null || typeof aItem !== "object" || typeof bItem !== "object") {
7283
- copy[key] = bItem;
7284
- continue;
7285
- }
7286
- const v = replaceEqualDeep(aItem, bItem);
7287
- copy[key] = v;
7288
- if (v === aItem) equalItems++;
7289
- }
7290
- return aSize === bSize && equalItems === aSize ? a : copy;
7291
- }
7292
- function shallowEqualObjects(a, b) {
7293
- if (!b || Object.keys(a).length !== Object.keys(b).length) {
7294
- return false;
7295
- }
7296
- for (const key in a) {
7297
- if (a[key] !== b[key]) {
7298
- return false;
7299
- }
7300
- }
7301
- return true;
7302
- }
7303
- function isPlainArray(value) {
7304
- return Array.isArray(value) && value.length === Object.keys(value).length;
7305
- }
7306
- function isPlainObject(o) {
7307
- if (!hasObjectPrototype(o)) {
7308
- return false;
7309
- }
7310
- const ctor = o.constructor;
7311
- if (ctor === void 0) {
7312
- return true;
7313
- }
7314
- const prot = ctor.prototype;
7315
- if (!hasObjectPrototype(prot)) {
7316
- return false;
7317
- }
7318
- if (!prot.hasOwnProperty("isPrototypeOf")) {
7319
- return false;
7320
- }
7321
- if (Object.getPrototypeOf(o) !== Object.prototype) {
7322
- return false;
7323
- }
7324
- return true;
7325
- }
7326
- function hasObjectPrototype(o) {
7327
- return Object.prototype.toString.call(o) === "[object Object]";
7328
- }
7329
- function sleep(timeout) {
7330
- return new Promise((resolve) => {
7331
- timeoutManager.setTimeout(resolve, timeout);
7332
- });
7333
- }
7334
- function replaceData(prevData, data, options) {
7335
- if (typeof options.structuralSharing === "function") {
7336
- return options.structuralSharing(prevData, data);
7337
- } else if (options.structuralSharing !== false) {
7338
- if (process.env.NODE_ENV !== "production") {
7339
- try {
7340
- return replaceEqualDeep(prevData, data);
7341
- } catch (error) {
7342
- console.error(
7343
- `Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${options.queryHash}]: ${error}`
7344
- );
7345
- throw error;
7346
- }
7347
- }
7348
- return replaceEqualDeep(prevData, data);
7349
- }
7350
- return data;
7351
- }
7352
- function addToEnd(items, item, max = 0) {
7353
- const newItems = [...items, item];
7354
- return max && newItems.length > max ? newItems.slice(1) : newItems;
7355
- }
7356
- function addToStart(items, item, max = 0) {
7357
- const newItems = [item, ...items];
7358
- return max && newItems.length > max ? newItems.slice(0, -1) : newItems;
7359
- }
7360
- var skipToken = Symbol();
7361
- function ensureQueryFn(options, fetchOptions) {
7362
- if (process.env.NODE_ENV !== "production") {
7363
- if (options.queryFn === skipToken) {
7364
- console.error(
7365
- `Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${options.queryHash}'`
7366
- );
7367
- }
7368
- }
7369
- if (!options.queryFn && fetchOptions?.initialPromise) {
7370
- return () => fetchOptions.initialPromise;
7371
- }
7372
- if (!options.queryFn || options.queryFn === skipToken) {
7373
- return () => Promise.reject(new Error(`Missing queryFn: '${options.queryHash}'`));
7374
- }
7375
- return options.queryFn;
7376
- }
7377
- function shouldThrowError(throwOnError, params) {
7378
- if (typeof throwOnError === "function") {
7379
- return throwOnError(...params);
7380
- }
7381
- return !!throwOnError;
7382
- }
7383
-
7384
- // src/focusManager.ts
7385
- var FocusManager = class extends Subscribable {
7386
- #focused;
7387
- #cleanup;
7388
- #setup;
7389
- constructor() {
7390
- super();
7391
- this.#setup = (onFocus) => {
7392
- if (!isServer && window.addEventListener) {
7393
- const listener = () => onFocus();
7394
- window.addEventListener("visibilitychange", listener, false);
7395
- return () => {
7396
- window.removeEventListener("visibilitychange", listener);
7397
- };
7398
- }
7399
- return;
7400
- };
7401
- }
7402
- onSubscribe() {
7403
- if (!this.#cleanup) {
7404
- this.setEventListener(this.#setup);
7405
- }
7406
- }
7407
- onUnsubscribe() {
7408
- if (!this.hasListeners()) {
7409
- this.#cleanup?.();
7410
- this.#cleanup = void 0;
7411
- }
7412
- }
7413
- setEventListener(setup) {
7414
- this.#setup = setup;
7415
- this.#cleanup?.();
7416
- this.#cleanup = setup((focused) => {
7417
- if (typeof focused === "boolean") {
7418
- this.setFocused(focused);
7419
- } else {
7420
- this.onFocus();
7421
- }
7422
- });
7423
- }
7424
- setFocused(focused) {
7425
- const changed = this.#focused !== focused;
7426
- if (changed) {
7427
- this.#focused = focused;
7428
- this.onFocus();
7429
- }
7430
- }
7431
- onFocus() {
7432
- const isFocused = this.isFocused();
7433
- this.listeners.forEach((listener) => {
7434
- listener(isFocused);
7435
- });
7436
- }
7437
- isFocused() {
7438
- if (typeof this.#focused === "boolean") {
7439
- return this.#focused;
7440
- }
7441
- return globalThis.document?.visibilityState !== "hidden";
7442
- }
7443
- };
7444
- var focusManager = new FocusManager();
7445
-
7446
- // src/thenable.ts
7447
- function pendingThenable() {
7448
- let resolve;
7449
- let reject;
7450
- const thenable = new Promise((_resolve, _reject) => {
7451
- resolve = _resolve;
7452
- reject = _reject;
7453
- });
7454
- thenable.status = "pending";
7455
- thenable.catch(() => {
7456
- });
7457
- function finalize(data) {
7458
- Object.assign(thenable, data);
7459
- delete thenable.resolve;
7460
- delete thenable.reject;
7461
- }
7462
- thenable.resolve = (value) => {
7463
- finalize({
7464
- status: "fulfilled",
7465
- value
7466
- });
7467
- resolve(value);
7468
- };
7469
- thenable.reject = (reason) => {
7470
- finalize({
7471
- status: "rejected",
7472
- reason
7473
- });
7474
- reject(reason);
7475
- };
7476
- return thenable;
7477
- }
7478
-
7479
- // src/notifyManager.ts
7480
- var defaultScheduler = systemSetTimeoutZero;
7481
- function createNotifyManager() {
7482
- let queue = [];
7483
- let transactions = 0;
7484
- let notifyFn = (callback) => {
7485
- callback();
7486
- };
7487
- let batchNotifyFn = (callback) => {
7488
- callback();
7489
- };
7490
- let scheduleFn = defaultScheduler;
7491
- const schedule = (callback) => {
7492
- if (transactions) {
7493
- queue.push(callback);
7494
- } else {
7495
- scheduleFn(() => {
7496
- notifyFn(callback);
7497
- });
7498
- }
7499
- };
7500
- const flush = () => {
7501
- const originalQueue = queue;
7502
- queue = [];
7503
- if (originalQueue.length) {
7504
- scheduleFn(() => {
7505
- batchNotifyFn(() => {
7506
- originalQueue.forEach((callback) => {
7507
- notifyFn(callback);
7508
- });
7509
- });
7510
- });
7511
- }
7512
- };
7513
- return {
7514
- batch: (callback) => {
7515
- let result;
7516
- transactions++;
7517
- try {
7518
- result = callback();
7519
- } finally {
7520
- transactions--;
7521
- if (!transactions) {
7522
- flush();
7523
- }
7524
- }
7525
- return result;
7526
- },
7527
- /**
7528
- * All calls to the wrapped function will be batched.
7529
- */
7530
- batchCalls: (callback) => {
7531
- return (...args) => {
7532
- schedule(() => {
7533
- callback(...args);
7534
- });
7535
- };
7536
- },
7537
- schedule,
7538
- /**
7539
- * Use this method to set a custom notify function.
7540
- * This can be used to for example wrap notifications with `React.act` while running tests.
7541
- */
7542
- setNotifyFunction: (fn) => {
7543
- notifyFn = fn;
7544
- },
7545
- /**
7546
- * Use this method to set a custom function to batch notifications together into a single tick.
7547
- * By default React Query will use the batch function provided by ReactDOM or React Native.
7548
- */
7549
- setBatchNotifyFunction: (fn) => {
7550
- batchNotifyFn = fn;
7551
- },
7552
- setScheduler: (fn) => {
7553
- scheduleFn = fn;
7554
- }
7555
- };
7556
- }
7557
- var notifyManager = createNotifyManager();
7558
-
7559
- // src/onlineManager.ts
7560
- var OnlineManager = class extends Subscribable {
7561
- #online = true;
7562
- #cleanup;
7563
- #setup;
7564
- constructor() {
7565
- super();
7566
- this.#setup = (onOnline) => {
7567
- if (!isServer && window.addEventListener) {
7568
- const onlineListener = () => onOnline(true);
7569
- const offlineListener = () => onOnline(false);
7570
- window.addEventListener("online", onlineListener, false);
7571
- window.addEventListener("offline", offlineListener, false);
7572
- return () => {
7573
- window.removeEventListener("online", onlineListener);
7574
- window.removeEventListener("offline", offlineListener);
7575
- };
7576
- }
7577
- return;
7578
- };
7579
- }
7580
- onSubscribe() {
7581
- if (!this.#cleanup) {
7582
- this.setEventListener(this.#setup);
7583
- }
7584
- }
7585
- onUnsubscribe() {
7586
- if (!this.hasListeners()) {
7587
- this.#cleanup?.();
7588
- this.#cleanup = void 0;
7589
- }
7590
- }
7591
- setEventListener(setup) {
7592
- this.#setup = setup;
7593
- this.#cleanup?.();
7594
- this.#cleanup = setup(this.setOnline.bind(this));
7595
- }
7596
- setOnline(online) {
7597
- const changed = this.#online !== online;
7598
- if (changed) {
7599
- this.#online = online;
7600
- this.listeners.forEach((listener) => {
7601
- listener(online);
7602
- });
7603
- }
7604
- }
7605
- isOnline() {
7606
- return this.#online;
7607
- }
7608
- };
7609
- var onlineManager = new OnlineManager();
7610
-
7611
- // src/retryer.ts
7612
- function defaultRetryDelay(failureCount) {
7613
- return Math.min(1e3 * 2 ** failureCount, 3e4);
7614
- }
7615
- function canFetch(networkMode) {
7616
- return (networkMode ?? "online") === "online" ? onlineManager.isOnline() : true;
7617
- }
7618
- var CancelledError = class extends Error {
7619
- constructor(options) {
7620
- super("CancelledError");
7621
- this.revert = options?.revert;
7622
- this.silent = options?.silent;
7623
- }
7624
- };
7625
- function createRetryer(config) {
7626
- let isRetryCancelled = false;
7627
- let failureCount = 0;
7628
- let continueFn;
7629
- const thenable = pendingThenable();
7630
- const isResolved = () => thenable.status !== "pending";
7631
- const cancel = (cancelOptions) => {
7632
- if (!isResolved()) {
7633
- const error = new CancelledError(cancelOptions);
7634
- reject(error);
7635
- config.onCancel?.(error);
7636
- }
7637
- };
7638
- const cancelRetry = () => {
7639
- isRetryCancelled = true;
7640
- };
7641
- const continueRetry = () => {
7642
- isRetryCancelled = false;
7643
- };
7644
- const canContinue = () => focusManager.isFocused() && (config.networkMode === "always" || onlineManager.isOnline()) && config.canRun();
7645
- const canStart = () => canFetch(config.networkMode) && config.canRun();
7646
- const resolve = (value) => {
7647
- if (!isResolved()) {
7648
- continueFn?.();
7649
- thenable.resolve(value);
7650
- }
7651
- };
7652
- const reject = (value) => {
7653
- if (!isResolved()) {
7654
- continueFn?.();
7655
- thenable.reject(value);
7656
- }
7657
- };
7658
- const pause = () => {
7659
- return new Promise((continueResolve) => {
7660
- continueFn = (value) => {
7661
- if (isResolved() || canContinue()) {
7662
- continueResolve(value);
7663
- }
7664
- };
7665
- config.onPause?.();
7666
- }).then(() => {
7667
- continueFn = void 0;
7668
- if (!isResolved()) {
7669
- config.onContinue?.();
7670
- }
7671
- });
7672
- };
7673
- const run = () => {
7674
- if (isResolved()) {
7675
- return;
7676
- }
7677
- let promiseOrValue;
7678
- const initialPromise = failureCount === 0 ? config.initialPromise : void 0;
7679
- try {
7680
- promiseOrValue = initialPromise ?? config.fn();
7681
- } catch (error) {
7682
- promiseOrValue = Promise.reject(error);
7683
- }
7684
- Promise.resolve(promiseOrValue).then(resolve).catch((error) => {
7685
- if (isResolved()) {
7686
- return;
7687
- }
7688
- const retry = config.retry ?? (isServer ? 0 : 3);
7689
- const retryDelay = config.retryDelay ?? defaultRetryDelay;
7690
- const delay = typeof retryDelay === "function" ? retryDelay(failureCount, error) : retryDelay;
7691
- const shouldRetry = retry === true || typeof retry === "number" && failureCount < retry || typeof retry === "function" && retry(failureCount, error);
7692
- if (isRetryCancelled || !shouldRetry) {
7693
- reject(error);
7694
- return;
7695
- }
7696
- failureCount++;
7697
- config.onFail?.(failureCount, error);
7698
- sleep(delay).then(() => {
7699
- return canContinue() ? void 0 : pause();
7700
- }).then(() => {
7701
- if (isRetryCancelled) {
7702
- reject(error);
7703
- } else {
7704
- run();
7705
- }
7706
- });
7707
- });
7708
- };
7709
- return {
7710
- promise: thenable,
7711
- status: () => thenable.status,
7712
- cancel,
7713
- continue: () => {
7714
- continueFn?.();
7715
- return thenable;
7716
- },
7717
- cancelRetry,
7718
- continueRetry,
7719
- canStart,
7720
- start: () => {
7721
- if (canStart()) {
7722
- run();
7723
- } else {
7724
- pause().then(run);
7725
- }
7726
- return thenable;
7727
- }
7728
- };
7729
- }
7730
-
7731
- // src/removable.ts
7732
- var Removable = class {
7733
- #gcTimeout;
7734
- destroy() {
7735
- this.clearGcTimeout();
7736
- }
7737
- scheduleGc() {
7738
- this.clearGcTimeout();
7739
- if (isValidTimeout(this.gcTime)) {
7740
- this.#gcTimeout = timeoutManager.setTimeout(() => {
7741
- this.optionalRemove();
7742
- }, this.gcTime);
7743
- }
7744
- }
7745
- updateGcTime(newGcTime) {
7746
- this.gcTime = Math.max(
7747
- this.gcTime || 0,
7748
- newGcTime ?? (isServer ? Infinity : 5 * 60 * 1e3)
7749
- );
7750
- }
7751
- clearGcTimeout() {
7752
- if (this.#gcTimeout) {
7753
- timeoutManager.clearTimeout(this.#gcTimeout);
7754
- this.#gcTimeout = void 0;
7755
- }
7756
- }
6652
+ return (jsxRuntime.jsx("div", { className: 'flex gap-4 flex-wrap hover:cursor-pointer', style: style, children: Object.entries(plotLegends).map(([plotId, legendItems]) => (jsxRuntime.jsx("div", { className: 'flex gap-4 flex-wrap', children: legendItems.map(item => (jsxRuntime.jsxs("div", { className: 'flex gap-2 items-center', children: [jsxRuntime.jsx("div", { className: 'w-4 h-4 rounded-full', style: item.style }), jsxRuntime.jsx("div", { children: item.label })] }, item.id))) }, plotId))) }));
7757
6653
  };
7758
6654
 
7759
- // src/query.ts
7760
- var Query = class extends Removable {
7761
- #initialState;
7762
- #revertState;
7763
- #cache;
7764
- #client;
7765
- #retryer;
7766
- #defaultOptions;
7767
- #abortSignalConsumed;
7768
- constructor(config) {
7769
- super();
7770
- this.#abortSignalConsumed = false;
7771
- this.#defaultOptions = config.defaultOptions;
7772
- this.setOptions(config.options);
7773
- this.observers = [];
7774
- this.#client = config.client;
7775
- this.#cache = this.#client.getQueryCache();
7776
- this.queryKey = config.queryKey;
7777
- this.queryHash = config.queryHash;
7778
- this.#initialState = getDefaultState$1(this.options);
7779
- this.state = config.state ?? this.#initialState;
7780
- this.scheduleGc();
7781
- }
7782
- get meta() {
7783
- return this.options.meta;
7784
- }
7785
- get promise() {
7786
- return this.#retryer?.promise;
7787
- }
7788
- setOptions(options) {
7789
- this.options = { ...this.#defaultOptions, ...options };
7790
- this.updateGcTime(this.options.gcTime);
7791
- if (this.state && this.state.data === void 0) {
7792
- const defaultState = getDefaultState$1(this.options);
7793
- if (defaultState.data !== void 0) {
7794
- this.setState(
7795
- successState(defaultState.data, defaultState.dataUpdatedAt)
7796
- );
7797
- this.#initialState = defaultState;
7798
- }
7799
- }
7800
- }
7801
- optionalRemove() {
7802
- if (!this.observers.length && this.state.fetchStatus === "idle") {
7803
- this.#cache.remove(this);
7804
- }
7805
- }
7806
- setData(newData, options) {
7807
- const data = replaceData(this.state.data, newData, this.options);
7808
- this.#dispatch({
7809
- data,
7810
- type: "success",
7811
- dataUpdatedAt: options?.updatedAt,
7812
- manual: options?.manual
7813
- });
7814
- return data;
7815
- }
7816
- setState(state, setStateOptions) {
7817
- this.#dispatch({ type: "setState", state, setStateOptions });
7818
- }
7819
- cancel(options) {
7820
- const promise = this.#retryer?.promise;
7821
- this.#retryer?.cancel(options);
7822
- return promise ? promise.then(noop).catch(noop) : Promise.resolve();
7823
- }
7824
- destroy() {
7825
- super.destroy();
7826
- this.cancel({ silent: true });
7827
- }
7828
- reset() {
7829
- this.destroy();
7830
- this.setState(this.#initialState);
7831
- }
7832
- isActive() {
7833
- return this.observers.some(
7834
- (observer) => resolveEnabled(observer.options.enabled, this) !== false
7835
- );
7836
- }
7837
- isDisabled() {
7838
- if (this.getObserversCount() > 0) {
7839
- return !this.isActive();
7840
- }
7841
- return this.options.queryFn === skipToken || this.state.dataUpdateCount + this.state.errorUpdateCount === 0;
7842
- }
7843
- isStatic() {
7844
- if (this.getObserversCount() > 0) {
7845
- return this.observers.some(
7846
- (observer) => resolveStaleTime(observer.options.staleTime, this) === "static"
7847
- );
7848
- }
7849
- return false;
7850
- }
7851
- isStale() {
7852
- if (this.getObserversCount() > 0) {
7853
- return this.observers.some(
7854
- (observer) => observer.getCurrentResult().isStale
7855
- );
7856
- }
7857
- return this.state.data === void 0 || this.state.isInvalidated;
7858
- }
7859
- isStaleByTime(staleTime = 0) {
7860
- if (this.state.data === void 0) {
7861
- return true;
7862
- }
7863
- if (staleTime === "static") {
7864
- return false;
7865
- }
7866
- if (this.state.isInvalidated) {
7867
- return true;
7868
- }
7869
- return !timeUntilStale(this.state.dataUpdatedAt, staleTime);
7870
- }
7871
- onFocus() {
7872
- const observer = this.observers.find((x) => x.shouldFetchOnWindowFocus());
7873
- observer?.refetch({ cancelRefetch: false });
7874
- this.#retryer?.continue();
7875
- }
7876
- onOnline() {
7877
- const observer = this.observers.find((x) => x.shouldFetchOnReconnect());
7878
- observer?.refetch({ cancelRefetch: false });
7879
- this.#retryer?.continue();
7880
- }
7881
- addObserver(observer) {
7882
- if (!this.observers.includes(observer)) {
7883
- this.observers.push(observer);
7884
- this.clearGcTimeout();
7885
- this.#cache.notify({ type: "observerAdded", query: this, observer });
7886
- }
7887
- }
7888
- removeObserver(observer) {
7889
- if (this.observers.includes(observer)) {
7890
- this.observers = this.observers.filter((x) => x !== observer);
7891
- if (!this.observers.length) {
7892
- if (this.#retryer) {
7893
- if (this.#abortSignalConsumed) {
7894
- this.#retryer.cancel({ revert: true });
7895
- } else {
7896
- this.#retryer.cancelRetry();
7897
- }
7898
- }
7899
- this.scheduleGc();
7900
- }
7901
- this.#cache.notify({ type: "observerRemoved", query: this, observer });
7902
- }
7903
- }
7904
- getObserversCount() {
7905
- return this.observers.length;
7906
- }
7907
- invalidate() {
7908
- if (!this.state.isInvalidated) {
7909
- this.#dispatch({ type: "invalidate" });
7910
- }
7911
- }
7912
- async fetch(options, fetchOptions) {
7913
- if (this.state.fetchStatus !== "idle" && // If the promise in the retyer is already rejected, we have to definitely
7914
- // re-start the fetch; there is a chance that the query is still in a
7915
- // pending state when that happens
7916
- this.#retryer?.status() !== "rejected") {
7917
- if (this.state.data !== void 0 && fetchOptions?.cancelRefetch) {
7918
- this.cancel({ silent: true });
7919
- } else if (this.#retryer) {
7920
- this.#retryer.continueRetry();
7921
- return this.#retryer.promise;
7922
- }
7923
- }
7924
- if (options) {
7925
- this.setOptions(options);
7926
- }
7927
- if (!this.options.queryFn) {
7928
- const observer = this.observers.find((x) => x.options.queryFn);
7929
- if (observer) {
7930
- this.setOptions(observer.options);
7931
- }
7932
- }
7933
- if (process.env.NODE_ENV !== "production") {
7934
- if (!Array.isArray(this.options.queryKey)) {
7935
- console.error(
7936
- `As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']`
7937
- );
7938
- }
7939
- }
7940
- const abortController = new AbortController();
7941
- const addSignalProperty = (object) => {
7942
- Object.defineProperty(object, "signal", {
7943
- enumerable: true,
7944
- get: () => {
7945
- this.#abortSignalConsumed = true;
7946
- return abortController.signal;
7947
- }
7948
- });
7949
- };
7950
- const fetchFn = () => {
7951
- const queryFn = ensureQueryFn(this.options, fetchOptions);
7952
- const createQueryFnContext = () => {
7953
- const queryFnContext2 = {
7954
- client: this.#client,
7955
- queryKey: this.queryKey,
7956
- meta: this.meta
7957
- };
7958
- addSignalProperty(queryFnContext2);
7959
- return queryFnContext2;
7960
- };
7961
- const queryFnContext = createQueryFnContext();
7962
- this.#abortSignalConsumed = false;
7963
- if (this.options.persister) {
7964
- return this.options.persister(
7965
- queryFn,
7966
- queryFnContext,
7967
- this
7968
- );
7969
- }
7970
- return queryFn(queryFnContext);
7971
- };
7972
- const createFetchContext = () => {
7973
- const context2 = {
7974
- fetchOptions,
7975
- options: this.options,
7976
- queryKey: this.queryKey,
7977
- client: this.#client,
7978
- state: this.state,
7979
- fetchFn
7980
- };
7981
- addSignalProperty(context2);
7982
- return context2;
7983
- };
7984
- const context = createFetchContext();
7985
- this.options.behavior?.onFetch(context, this);
7986
- this.#revertState = this.state;
7987
- if (this.state.fetchStatus === "idle" || this.state.fetchMeta !== context.fetchOptions?.meta) {
7988
- this.#dispatch({ type: "fetch", meta: context.fetchOptions?.meta });
7989
- }
7990
- this.#retryer = createRetryer({
7991
- initialPromise: fetchOptions?.initialPromise,
7992
- fn: context.fetchFn,
7993
- onCancel: (error) => {
7994
- if (error instanceof CancelledError && error.revert) {
7995
- this.setState({
7996
- ...this.#revertState,
7997
- fetchStatus: "idle"
7998
- });
7999
- }
8000
- abortController.abort();
8001
- },
8002
- onFail: (failureCount, error) => {
8003
- this.#dispatch({ type: "failed", failureCount, error });
8004
- },
8005
- onPause: () => {
8006
- this.#dispatch({ type: "pause" });
8007
- },
8008
- onContinue: () => {
8009
- this.#dispatch({ type: "continue" });
8010
- },
8011
- retry: context.options.retry,
8012
- retryDelay: context.options.retryDelay,
8013
- networkMode: context.options.networkMode,
8014
- canRun: () => true
8015
- });
8016
- try {
8017
- const data = await this.#retryer.start();
8018
- if (data === void 0) {
8019
- if (process.env.NODE_ENV !== "production") {
8020
- console.error(
8021
- `Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`
8022
- );
8023
- }
8024
- throw new Error(`${this.queryHash} data is undefined`);
8025
- }
8026
- this.setData(data);
8027
- this.#cache.config.onSuccess?.(data, this);
8028
- this.#cache.config.onSettled?.(
8029
- data,
8030
- this.state.error,
8031
- this
8032
- );
8033
- return data;
8034
- } catch (error) {
8035
- if (error instanceof CancelledError) {
8036
- if (error.silent) {
8037
- return this.#retryer.promise;
8038
- } else if (error.revert) {
8039
- if (this.state.data === void 0) {
8040
- throw error;
8041
- }
8042
- return this.state.data;
8043
- }
8044
- }
8045
- this.#dispatch({
8046
- type: "error",
8047
- error
8048
- });
8049
- this.#cache.config.onError?.(
8050
- error,
8051
- this
8052
- );
8053
- this.#cache.config.onSettled?.(
8054
- this.state.data,
8055
- error,
8056
- this
8057
- );
8058
- throw error;
8059
- } finally {
8060
- this.scheduleGc();
8061
- }
8062
- }
8063
- #dispatch(action) {
8064
- const reducer = (state) => {
8065
- switch (action.type) {
8066
- case "failed":
8067
- return {
8068
- ...state,
8069
- fetchFailureCount: action.failureCount,
8070
- fetchFailureReason: action.error
8071
- };
8072
- case "pause":
8073
- return {
8074
- ...state,
8075
- fetchStatus: "paused"
8076
- };
8077
- case "continue":
8078
- return {
8079
- ...state,
8080
- fetchStatus: "fetching"
8081
- };
8082
- case "fetch":
8083
- return {
8084
- ...state,
8085
- ...fetchState(state.data, this.options),
8086
- fetchMeta: action.meta ?? null
8087
- };
8088
- case "success":
8089
- const newState = {
8090
- ...state,
8091
- ...successState(action.data, action.dataUpdatedAt),
8092
- dataUpdateCount: state.dataUpdateCount + 1,
8093
- ...!action.manual && {
8094
- fetchStatus: "idle",
8095
- fetchFailureCount: 0,
8096
- fetchFailureReason: null
8097
- }
8098
- };
8099
- this.#revertState = action.manual ? newState : void 0;
8100
- return newState;
8101
- case "error":
8102
- const error = action.error;
8103
- return {
8104
- ...state,
8105
- error,
8106
- errorUpdateCount: state.errorUpdateCount + 1,
8107
- errorUpdatedAt: Date.now(),
8108
- fetchFailureCount: state.fetchFailureCount + 1,
8109
- fetchFailureReason: error,
8110
- fetchStatus: "idle",
8111
- status: "error"
8112
- };
8113
- case "invalidate":
8114
- return {
8115
- ...state,
8116
- isInvalidated: true
8117
- };
8118
- case "setState":
8119
- return {
8120
- ...state,
8121
- ...action.state
8122
- };
8123
- }
8124
- };
8125
- this.state = reducer(this.state);
8126
- notifyManager.batch(() => {
8127
- this.observers.forEach((observer) => {
8128
- observer.onQueryUpdate();
8129
- });
8130
- this.#cache.notify({ query: this, type: "updated", action });
8131
- });
8132
- }
8133
- };
8134
- function fetchState(data, options) {
8135
- return {
8136
- fetchFailureCount: 0,
8137
- fetchFailureReason: null,
8138
- fetchStatus: canFetch(options.networkMode) ? "fetching" : "paused",
8139
- ...data === void 0 && {
8140
- error: null,
8141
- status: "pending"
8142
- }
8143
- };
8144
- }
8145
- function successState(data, dataUpdatedAt) {
8146
- return {
8147
- data,
8148
- dataUpdatedAt: dataUpdatedAt ?? Date.now(),
8149
- error: null,
8150
- isInvalidated: false,
8151
- status: "success"
8152
- };
8153
- }
8154
- function getDefaultState$1(options) {
8155
- const data = typeof options.initialData === "function" ? options.initialData() : options.initialData;
8156
- const hasData = data !== void 0;
8157
- const initialDataUpdatedAt = hasData ? typeof options.initialDataUpdatedAt === "function" ? options.initialDataUpdatedAt() : options.initialDataUpdatedAt : 0;
8158
- return {
8159
- data,
8160
- dataUpdateCount: 0,
8161
- dataUpdatedAt: hasData ? initialDataUpdatedAt ?? Date.now() : 0,
8162
- error: null,
8163
- errorUpdateCount: 0,
8164
- errorUpdatedAt: 0,
8165
- fetchFailureCount: 0,
8166
- fetchFailureReason: null,
8167
- fetchMeta: null,
8168
- isInvalidated: false,
8169
- status: hasData ? "success" : "pending",
8170
- fetchStatus: "idle"
8171
- };
8172
- }
8173
-
8174
- // src/queryObserver.ts
8175
- var QueryObserver = class extends Subscribable {
8176
- constructor(client, options) {
8177
- super();
8178
- this.options = options;
8179
- this.#client = client;
8180
- this.#selectError = null;
8181
- this.#currentThenable = pendingThenable();
8182
- this.bindMethods();
8183
- this.setOptions(options);
8184
- }
8185
- #client;
8186
- #currentQuery = void 0;
8187
- #currentQueryInitialState = void 0;
8188
- #currentResult = void 0;
8189
- #currentResultState;
8190
- #currentResultOptions;
8191
- #currentThenable;
8192
- #selectError;
8193
- #selectFn;
8194
- #selectResult;
8195
- // This property keeps track of the last query with defined data.
8196
- // It will be used to pass the previous data and query to the placeholder function between renders.
8197
- #lastQueryWithDefinedData;
8198
- #staleTimeoutId;
8199
- #refetchIntervalId;
8200
- #currentRefetchInterval;
8201
- #trackedProps = /* @__PURE__ */ new Set();
8202
- bindMethods() {
8203
- this.refetch = this.refetch.bind(this);
8204
- }
8205
- onSubscribe() {
8206
- if (this.listeners.size === 1) {
8207
- this.#currentQuery.addObserver(this);
8208
- if (shouldFetchOnMount(this.#currentQuery, this.options)) {
8209
- this.#executeFetch();
8210
- } else {
8211
- this.updateResult();
8212
- }
8213
- this.#updateTimers();
8214
- }
8215
- }
8216
- onUnsubscribe() {
8217
- if (!this.hasListeners()) {
8218
- this.destroy();
8219
- }
8220
- }
8221
- shouldFetchOnReconnect() {
8222
- return shouldFetchOn(
8223
- this.#currentQuery,
8224
- this.options,
8225
- this.options.refetchOnReconnect
8226
- );
8227
- }
8228
- shouldFetchOnWindowFocus() {
8229
- return shouldFetchOn(
8230
- this.#currentQuery,
8231
- this.options,
8232
- this.options.refetchOnWindowFocus
8233
- );
8234
- }
8235
- destroy() {
8236
- this.listeners = /* @__PURE__ */ new Set();
8237
- this.#clearStaleTimeout();
8238
- this.#clearRefetchInterval();
8239
- this.#currentQuery.removeObserver(this);
8240
- }
8241
- setOptions(options) {
8242
- const prevOptions = this.options;
8243
- const prevQuery = this.#currentQuery;
8244
- this.options = this.#client.defaultQueryOptions(options);
8245
- if (this.options.enabled !== void 0 && typeof this.options.enabled !== "boolean" && typeof this.options.enabled !== "function" && typeof resolveEnabled(this.options.enabled, this.#currentQuery) !== "boolean") {
8246
- throw new Error(
8247
- "Expected enabled to be a boolean or a callback that returns a boolean"
8248
- );
8249
- }
8250
- this.#updateQuery();
8251
- this.#currentQuery.setOptions(this.options);
8252
- if (prevOptions._defaulted && !shallowEqualObjects(this.options, prevOptions)) {
8253
- this.#client.getQueryCache().notify({
8254
- type: "observerOptionsUpdated",
8255
- query: this.#currentQuery,
8256
- observer: this
8257
- });
8258
- }
8259
- const mounted = this.hasListeners();
8260
- if (mounted && shouldFetchOptionally(
8261
- this.#currentQuery,
8262
- prevQuery,
8263
- this.options,
8264
- prevOptions
8265
- )) {
8266
- this.#executeFetch();
8267
- }
8268
- this.updateResult();
8269
- if (mounted && (this.#currentQuery !== prevQuery || resolveEnabled(this.options.enabled, this.#currentQuery) !== resolveEnabled(prevOptions.enabled, this.#currentQuery) || resolveStaleTime(this.options.staleTime, this.#currentQuery) !== resolveStaleTime(prevOptions.staleTime, this.#currentQuery))) {
8270
- this.#updateStaleTimeout();
8271
- }
8272
- const nextRefetchInterval = this.#computeRefetchInterval();
8273
- if (mounted && (this.#currentQuery !== prevQuery || resolveEnabled(this.options.enabled, this.#currentQuery) !== resolveEnabled(prevOptions.enabled, this.#currentQuery) || nextRefetchInterval !== this.#currentRefetchInterval)) {
8274
- this.#updateRefetchInterval(nextRefetchInterval);
8275
- }
8276
- }
8277
- getOptimisticResult(options) {
8278
- const query = this.#client.getQueryCache().build(this.#client, options);
8279
- const result = this.createResult(query, options);
8280
- if (shouldAssignObserverCurrentProperties(this, result)) {
8281
- this.#currentResult = result;
8282
- this.#currentResultOptions = this.options;
8283
- this.#currentResultState = this.#currentQuery.state;
8284
- }
8285
- return result;
8286
- }
8287
- getCurrentResult() {
8288
- return this.#currentResult;
8289
- }
8290
- trackResult(result, onPropTracked) {
8291
- return new Proxy(result, {
8292
- get: (target, key) => {
8293
- this.trackProp(key);
8294
- onPropTracked?.(key);
8295
- if (key === "promise") {
8296
- this.trackProp("data");
8297
- if (!this.options.experimental_prefetchInRender && this.#currentThenable.status === "pending") {
8298
- this.#currentThenable.reject(
8299
- new Error(
8300
- "experimental_prefetchInRender feature flag is not enabled"
8301
- )
8302
- );
8303
- }
8304
- }
8305
- return Reflect.get(target, key);
8306
- }
8307
- });
8308
- }
8309
- trackProp(key) {
8310
- this.#trackedProps.add(key);
8311
- }
8312
- getCurrentQuery() {
8313
- return this.#currentQuery;
8314
- }
8315
- refetch({ ...options } = {}) {
8316
- return this.fetch({
8317
- ...options
8318
- });
8319
- }
8320
- fetchOptimistic(options) {
8321
- const defaultedOptions = this.#client.defaultQueryOptions(options);
8322
- const query = this.#client.getQueryCache().build(this.#client, defaultedOptions);
8323
- return query.fetch().then(() => this.createResult(query, defaultedOptions));
8324
- }
8325
- fetch(fetchOptions) {
8326
- return this.#executeFetch({
8327
- ...fetchOptions,
8328
- cancelRefetch: fetchOptions.cancelRefetch ?? true
8329
- }).then(() => {
8330
- this.updateResult();
8331
- return this.#currentResult;
8332
- });
8333
- }
8334
- #executeFetch(fetchOptions) {
8335
- this.#updateQuery();
8336
- let promise = this.#currentQuery.fetch(
8337
- this.options,
8338
- fetchOptions
8339
- );
8340
- if (!fetchOptions?.throwOnError) {
8341
- promise = promise.catch(noop);
8342
- }
8343
- return promise;
8344
- }
8345
- #updateStaleTimeout() {
8346
- this.#clearStaleTimeout();
8347
- const staleTime = resolveStaleTime(
8348
- this.options.staleTime,
8349
- this.#currentQuery
8350
- );
8351
- if (isServer || this.#currentResult.isStale || !isValidTimeout(staleTime)) {
8352
- return;
8353
- }
8354
- const time = timeUntilStale(this.#currentResult.dataUpdatedAt, staleTime);
8355
- const timeout = time + 1;
8356
- this.#staleTimeoutId = timeoutManager.setTimeout(() => {
8357
- if (!this.#currentResult.isStale) {
8358
- this.updateResult();
8359
- }
8360
- }, timeout);
8361
- }
8362
- #computeRefetchInterval() {
8363
- return (typeof this.options.refetchInterval === "function" ? this.options.refetchInterval(this.#currentQuery) : this.options.refetchInterval) ?? false;
8364
- }
8365
- #updateRefetchInterval(nextInterval) {
8366
- this.#clearRefetchInterval();
8367
- this.#currentRefetchInterval = nextInterval;
8368
- if (isServer || resolveEnabled(this.options.enabled, this.#currentQuery) === false || !isValidTimeout(this.#currentRefetchInterval) || this.#currentRefetchInterval === 0) {
8369
- return;
8370
- }
8371
- this.#refetchIntervalId = timeoutManager.setInterval(() => {
8372
- if (this.options.refetchIntervalInBackground || focusManager.isFocused()) {
8373
- this.#executeFetch();
8374
- }
8375
- }, this.#currentRefetchInterval);
8376
- }
8377
- #updateTimers() {
8378
- this.#updateStaleTimeout();
8379
- this.#updateRefetchInterval(this.#computeRefetchInterval());
8380
- }
8381
- #clearStaleTimeout() {
8382
- if (this.#staleTimeoutId) {
8383
- timeoutManager.clearTimeout(this.#staleTimeoutId);
8384
- this.#staleTimeoutId = void 0;
8385
- }
8386
- }
8387
- #clearRefetchInterval() {
8388
- if (this.#refetchIntervalId) {
8389
- timeoutManager.clearInterval(this.#refetchIntervalId);
8390
- this.#refetchIntervalId = void 0;
8391
- }
8392
- }
8393
- createResult(query, options) {
8394
- const prevQuery = this.#currentQuery;
8395
- const prevOptions = this.options;
8396
- const prevResult = this.#currentResult;
8397
- const prevResultState = this.#currentResultState;
8398
- const prevResultOptions = this.#currentResultOptions;
8399
- const queryChange = query !== prevQuery;
8400
- const queryInitialState = queryChange ? query.state : this.#currentQueryInitialState;
8401
- const { state } = query;
8402
- let newState = { ...state };
8403
- let isPlaceholderData = false;
8404
- let data;
8405
- if (options._optimisticResults) {
8406
- const mounted = this.hasListeners();
8407
- const fetchOnMount = !mounted && shouldFetchOnMount(query, options);
8408
- const fetchOptionally = mounted && shouldFetchOptionally(query, prevQuery, options, prevOptions);
8409
- if (fetchOnMount || fetchOptionally) {
8410
- newState = {
8411
- ...newState,
8412
- ...fetchState(state.data, query.options)
8413
- };
8414
- }
8415
- if (options._optimisticResults === "isRestoring") {
8416
- newState.fetchStatus = "idle";
8417
- }
8418
- }
8419
- let { error, errorUpdatedAt, status } = newState;
8420
- data = newState.data;
8421
- let skipSelect = false;
8422
- if (options.placeholderData !== void 0 && data === void 0 && status === "pending") {
8423
- let placeholderData;
8424
- if (prevResult?.isPlaceholderData && options.placeholderData === prevResultOptions?.placeholderData) {
8425
- placeholderData = prevResult.data;
8426
- skipSelect = true;
8427
- } else {
8428
- placeholderData = typeof options.placeholderData === "function" ? options.placeholderData(
8429
- this.#lastQueryWithDefinedData?.state.data,
8430
- this.#lastQueryWithDefinedData
8431
- ) : options.placeholderData;
8432
- }
8433
- if (placeholderData !== void 0) {
8434
- status = "success";
8435
- data = replaceData(
8436
- prevResult?.data,
8437
- placeholderData,
8438
- options
8439
- );
8440
- isPlaceholderData = true;
8441
- }
8442
- }
8443
- if (options.select && data !== void 0 && !skipSelect) {
8444
- if (prevResult && data === prevResultState?.data && options.select === this.#selectFn) {
8445
- data = this.#selectResult;
8446
- } else {
8447
- try {
8448
- this.#selectFn = options.select;
8449
- data = options.select(data);
8450
- data = replaceData(prevResult?.data, data, options);
8451
- this.#selectResult = data;
8452
- this.#selectError = null;
8453
- } catch (selectError) {
8454
- this.#selectError = selectError;
8455
- }
8456
- }
8457
- }
8458
- if (this.#selectError) {
8459
- error = this.#selectError;
8460
- data = this.#selectResult;
8461
- errorUpdatedAt = Date.now();
8462
- status = "error";
8463
- }
8464
- const isFetching = newState.fetchStatus === "fetching";
8465
- const isPending = status === "pending";
8466
- const isError = status === "error";
8467
- const isLoading = isPending && isFetching;
8468
- const hasData = data !== void 0;
8469
- const result = {
8470
- status,
8471
- fetchStatus: newState.fetchStatus,
8472
- isPending,
8473
- isSuccess: status === "success",
8474
- isError,
8475
- isInitialLoading: isLoading,
8476
- isLoading,
8477
- data,
8478
- dataUpdatedAt: newState.dataUpdatedAt,
8479
- error,
8480
- errorUpdatedAt,
8481
- failureCount: newState.fetchFailureCount,
8482
- failureReason: newState.fetchFailureReason,
8483
- errorUpdateCount: newState.errorUpdateCount,
8484
- isFetched: newState.dataUpdateCount > 0 || newState.errorUpdateCount > 0,
8485
- isFetchedAfterMount: newState.dataUpdateCount > queryInitialState.dataUpdateCount || newState.errorUpdateCount > queryInitialState.errorUpdateCount,
8486
- isFetching,
8487
- isRefetching: isFetching && !isPending,
8488
- isLoadingError: isError && !hasData,
8489
- isPaused: newState.fetchStatus === "paused",
8490
- isPlaceholderData,
8491
- isRefetchError: isError && hasData,
8492
- isStale: isStale(query, options),
8493
- refetch: this.refetch,
8494
- promise: this.#currentThenable,
8495
- isEnabled: resolveEnabled(options.enabled, query) !== false
8496
- };
8497
- const nextResult = result;
8498
- if (this.options.experimental_prefetchInRender) {
8499
- const finalizeThenableIfPossible = (thenable) => {
8500
- if (nextResult.status === "error") {
8501
- thenable.reject(nextResult.error);
8502
- } else if (nextResult.data !== void 0) {
8503
- thenable.resolve(nextResult.data);
8504
- }
8505
- };
8506
- const recreateThenable = () => {
8507
- const pending = this.#currentThenable = nextResult.promise = pendingThenable();
8508
- finalizeThenableIfPossible(pending);
8509
- };
8510
- const prevThenable = this.#currentThenable;
8511
- switch (prevThenable.status) {
8512
- case "pending":
8513
- if (query.queryHash === prevQuery.queryHash) {
8514
- finalizeThenableIfPossible(prevThenable);
8515
- }
8516
- break;
8517
- case "fulfilled":
8518
- if (nextResult.status === "error" || nextResult.data !== prevThenable.value) {
8519
- recreateThenable();
8520
- }
8521
- break;
8522
- case "rejected":
8523
- if (nextResult.status !== "error" || nextResult.error !== prevThenable.reason) {
8524
- recreateThenable();
8525
- }
8526
- break;
8527
- }
8528
- }
8529
- return nextResult;
8530
- }
8531
- updateResult() {
8532
- const prevResult = this.#currentResult;
8533
- const nextResult = this.createResult(this.#currentQuery, this.options);
8534
- this.#currentResultState = this.#currentQuery.state;
8535
- this.#currentResultOptions = this.options;
8536
- if (this.#currentResultState.data !== void 0) {
8537
- this.#lastQueryWithDefinedData = this.#currentQuery;
8538
- }
8539
- if (shallowEqualObjects(nextResult, prevResult)) {
8540
- return;
8541
- }
8542
- this.#currentResult = nextResult;
8543
- const shouldNotifyListeners = () => {
8544
- if (!prevResult) {
8545
- return true;
8546
- }
8547
- const { notifyOnChangeProps } = this.options;
8548
- const notifyOnChangePropsValue = typeof notifyOnChangeProps === "function" ? notifyOnChangeProps() : notifyOnChangeProps;
8549
- if (notifyOnChangePropsValue === "all" || !notifyOnChangePropsValue && !this.#trackedProps.size) {
8550
- return true;
8551
- }
8552
- const includedProps = new Set(
8553
- notifyOnChangePropsValue ?? this.#trackedProps
8554
- );
8555
- if (this.options.throwOnError) {
8556
- includedProps.add("error");
8557
- }
8558
- return Object.keys(this.#currentResult).some((key) => {
8559
- const typedKey = key;
8560
- const changed = this.#currentResult[typedKey] !== prevResult[typedKey];
8561
- return changed && includedProps.has(typedKey);
8562
- });
8563
- };
8564
- this.#notify({ listeners: shouldNotifyListeners() });
8565
- }
8566
- #updateQuery() {
8567
- const query = this.#client.getQueryCache().build(this.#client, this.options);
8568
- if (query === this.#currentQuery) {
8569
- return;
8570
- }
8571
- const prevQuery = this.#currentQuery;
8572
- this.#currentQuery = query;
8573
- this.#currentQueryInitialState = query.state;
8574
- if (this.hasListeners()) {
8575
- prevQuery?.removeObserver(this);
8576
- query.addObserver(this);
8577
- }
8578
- }
8579
- onQueryUpdate() {
8580
- this.updateResult();
8581
- if (this.hasListeners()) {
8582
- this.#updateTimers();
8583
- }
8584
- }
8585
- #notify(notifyOptions) {
8586
- notifyManager.batch(() => {
8587
- if (notifyOptions.listeners) {
8588
- this.listeners.forEach((listener) => {
8589
- listener(this.#currentResult);
8590
- });
8591
- }
8592
- this.#client.getQueryCache().notify({
8593
- query: this.#currentQuery,
8594
- type: "observerResultsUpdated"
8595
- });
8596
- });
8597
- }
8598
- };
8599
- function shouldLoadOnMount(query, options) {
8600
- return resolveEnabled(options.enabled, query) !== false && query.state.data === void 0 && !(query.state.status === "error" && options.retryOnMount === false);
8601
- }
8602
- function shouldFetchOnMount(query, options) {
8603
- return shouldLoadOnMount(query, options) || query.state.data !== void 0 && shouldFetchOn(query, options, options.refetchOnMount);
8604
- }
8605
- function shouldFetchOn(query, options, field) {
8606
- if (resolveEnabled(options.enabled, query) !== false && resolveStaleTime(options.staleTime, query) !== "static") {
8607
- const value = typeof field === "function" ? field(query) : field;
8608
- return value === "always" || value !== false && isStale(query, options);
8609
- }
8610
- return false;
8611
- }
8612
- function shouldFetchOptionally(query, prevQuery, options, prevOptions) {
8613
- return (query !== prevQuery || resolveEnabled(prevOptions.enabled, query) === false) && (!options.suspense || query.state.status !== "error") && isStale(query, options);
8614
- }
8615
- function isStale(query, options) {
8616
- return resolveEnabled(options.enabled, query) !== false && query.isStaleByTime(resolveStaleTime(options.staleTime, query));
8617
- }
8618
- function shouldAssignObserverCurrentProperties(observer, optimisticResult) {
8619
- if (!shallowEqualObjects(observer.getCurrentResult(), optimisticResult)) {
8620
- return true;
8621
- }
8622
- return false;
8623
- }
8624
-
8625
- // src/infiniteQueryBehavior.ts
8626
- function infiniteQueryBehavior(pages) {
8627
- return {
8628
- onFetch: (context, query) => {
8629
- const options = context.options;
8630
- const direction = context.fetchOptions?.meta?.fetchMore?.direction;
8631
- const oldPages = context.state.data?.pages || [];
8632
- const oldPageParams = context.state.data?.pageParams || [];
8633
- let result = { pages: [], pageParams: [] };
8634
- let currentPage = 0;
8635
- const fetchFn = async () => {
8636
- let cancelled = false;
8637
- const addSignalProperty = (object) => {
8638
- Object.defineProperty(object, "signal", {
8639
- enumerable: true,
8640
- get: () => {
8641
- if (context.signal.aborted) {
8642
- cancelled = true;
8643
- } else {
8644
- context.signal.addEventListener("abort", () => {
8645
- cancelled = true;
8646
- });
8647
- }
8648
- return context.signal;
8649
- }
8650
- });
8651
- };
8652
- const queryFn = ensureQueryFn(context.options, context.fetchOptions);
8653
- const fetchPage = async (data, param, previous) => {
8654
- if (cancelled) {
8655
- return Promise.reject();
8656
- }
8657
- if (param == null && data.pages.length) {
8658
- return Promise.resolve(data);
8659
- }
8660
- const createQueryFnContext = () => {
8661
- const queryFnContext2 = {
8662
- client: context.client,
8663
- queryKey: context.queryKey,
8664
- pageParam: param,
8665
- direction: previous ? "backward" : "forward",
8666
- meta: context.options.meta
8667
- };
8668
- addSignalProperty(queryFnContext2);
8669
- return queryFnContext2;
8670
- };
8671
- const queryFnContext = createQueryFnContext();
8672
- const page = await queryFn(queryFnContext);
8673
- const { maxPages } = context.options;
8674
- const addTo = previous ? addToStart : addToEnd;
8675
- return {
8676
- pages: addTo(data.pages, page, maxPages),
8677
- pageParams: addTo(data.pageParams, param, maxPages)
8678
- };
8679
- };
8680
- if (direction && oldPages.length) {
8681
- const previous = direction === "backward";
8682
- const pageParamFn = previous ? getPreviousPageParam : getNextPageParam;
8683
- const oldData = {
8684
- pages: oldPages,
8685
- pageParams: oldPageParams
8686
- };
8687
- const param = pageParamFn(options, oldData);
8688
- result = await fetchPage(oldData, param, previous);
8689
- } else {
8690
- const remainingPages = pages ?? oldPages.length;
8691
- do {
8692
- const param = currentPage === 0 ? oldPageParams[0] ?? options.initialPageParam : getNextPageParam(options, result);
8693
- if (currentPage > 0 && param == null) {
8694
- break;
8695
- }
8696
- result = await fetchPage(result, param);
8697
- currentPage++;
8698
- } while (currentPage < remainingPages);
8699
- }
8700
- return result;
8701
- };
8702
- if (context.options.persister) {
8703
- context.fetchFn = () => {
8704
- return context.options.persister?.(
8705
- fetchFn,
8706
- {
8707
- client: context.client,
8708
- queryKey: context.queryKey,
8709
- meta: context.options.meta,
8710
- signal: context.signal
8711
- },
8712
- query
8713
- );
8714
- };
8715
- } else {
8716
- context.fetchFn = fetchFn;
8717
- }
8718
- }
8719
- };
8720
- }
8721
- function getNextPageParam(options, { pages, pageParams }) {
8722
- const lastIndex = pages.length - 1;
8723
- return pages.length > 0 ? options.getNextPageParam(
8724
- pages[lastIndex],
8725
- pages,
8726
- pageParams[lastIndex],
8727
- pageParams
8728
- ) : void 0;
8729
- }
8730
- function getPreviousPageParam(options, { pages, pageParams }) {
8731
- return pages.length > 0 ? options.getPreviousPageParam?.(pages[0], pages, pageParams[0], pageParams) : void 0;
8732
- }
8733
-
8734
- // src/mutation.ts
8735
- var Mutation = class extends Removable {
8736
- #client;
8737
- #observers;
8738
- #mutationCache;
8739
- #retryer;
8740
- constructor(config) {
8741
- super();
8742
- this.#client = config.client;
8743
- this.mutationId = config.mutationId;
8744
- this.#mutationCache = config.mutationCache;
8745
- this.#observers = [];
8746
- this.state = config.state || getDefaultState();
8747
- this.setOptions(config.options);
8748
- this.scheduleGc();
8749
- }
8750
- setOptions(options) {
8751
- this.options = options;
8752
- this.updateGcTime(this.options.gcTime);
8753
- }
8754
- get meta() {
8755
- return this.options.meta;
8756
- }
8757
- addObserver(observer) {
8758
- if (!this.#observers.includes(observer)) {
8759
- this.#observers.push(observer);
8760
- this.clearGcTimeout();
8761
- this.#mutationCache.notify({
8762
- type: "observerAdded",
8763
- mutation: this,
8764
- observer
8765
- });
8766
- }
8767
- }
8768
- removeObserver(observer) {
8769
- this.#observers = this.#observers.filter((x) => x !== observer);
8770
- this.scheduleGc();
8771
- this.#mutationCache.notify({
8772
- type: "observerRemoved",
8773
- mutation: this,
8774
- observer
8775
- });
8776
- }
8777
- optionalRemove() {
8778
- if (!this.#observers.length) {
8779
- if (this.state.status === "pending") {
8780
- this.scheduleGc();
8781
- } else {
8782
- this.#mutationCache.remove(this);
8783
- }
8784
- }
8785
- }
8786
- continue() {
8787
- return this.#retryer?.continue() ?? // continuing a mutation assumes that variables are set, mutation must have been dehydrated before
8788
- this.execute(this.state.variables);
8789
- }
8790
- async execute(variables) {
8791
- const onContinue = () => {
8792
- this.#dispatch({ type: "continue" });
8793
- };
8794
- const mutationFnContext = {
8795
- client: this.#client,
8796
- meta: this.options.meta,
8797
- mutationKey: this.options.mutationKey
8798
- };
8799
- this.#retryer = createRetryer({
8800
- fn: () => {
8801
- if (!this.options.mutationFn) {
8802
- return Promise.reject(new Error("No mutationFn found"));
8803
- }
8804
- return this.options.mutationFn(variables, mutationFnContext);
8805
- },
8806
- onFail: (failureCount, error) => {
8807
- this.#dispatch({ type: "failed", failureCount, error });
8808
- },
8809
- onPause: () => {
8810
- this.#dispatch({ type: "pause" });
8811
- },
8812
- onContinue,
8813
- retry: this.options.retry ?? 0,
8814
- retryDelay: this.options.retryDelay,
8815
- networkMode: this.options.networkMode,
8816
- canRun: () => this.#mutationCache.canRun(this)
8817
- });
8818
- const restored = this.state.status === "pending";
8819
- const isPaused = !this.#retryer.canStart();
8820
- try {
8821
- if (restored) {
8822
- onContinue();
8823
- } else {
8824
- this.#dispatch({ type: "pending", variables, isPaused });
8825
- await this.#mutationCache.config.onMutate?.(
8826
- variables,
8827
- this,
8828
- mutationFnContext
8829
- );
8830
- const context = await this.options.onMutate?.(
8831
- variables,
8832
- mutationFnContext
8833
- );
8834
- if (context !== this.state.context) {
8835
- this.#dispatch({
8836
- type: "pending",
8837
- context,
8838
- variables,
8839
- isPaused
8840
- });
8841
- }
8842
- }
8843
- const data = await this.#retryer.start();
8844
- await this.#mutationCache.config.onSuccess?.(
8845
- data,
8846
- variables,
8847
- this.state.context,
8848
- this,
8849
- mutationFnContext
8850
- );
8851
- await this.options.onSuccess?.(
8852
- data,
8853
- variables,
8854
- this.state.context,
8855
- mutationFnContext
8856
- );
8857
- await this.#mutationCache.config.onSettled?.(
8858
- data,
8859
- null,
8860
- this.state.variables,
8861
- this.state.context,
8862
- this,
8863
- mutationFnContext
8864
- );
8865
- await this.options.onSettled?.(
8866
- data,
8867
- null,
8868
- variables,
8869
- this.state.context,
8870
- mutationFnContext
8871
- );
8872
- this.#dispatch({ type: "success", data });
8873
- return data;
8874
- } catch (error) {
8875
- try {
8876
- await this.#mutationCache.config.onError?.(
8877
- error,
8878
- variables,
8879
- this.state.context,
8880
- this,
8881
- mutationFnContext
8882
- );
8883
- await this.options.onError?.(
8884
- error,
8885
- variables,
8886
- this.state.context,
8887
- mutationFnContext
8888
- );
8889
- await this.#mutationCache.config.onSettled?.(
8890
- void 0,
8891
- error,
8892
- this.state.variables,
8893
- this.state.context,
8894
- this,
8895
- mutationFnContext
8896
- );
8897
- await this.options.onSettled?.(
8898
- void 0,
8899
- error,
8900
- variables,
8901
- this.state.context,
8902
- mutationFnContext
8903
- );
8904
- throw error;
8905
- } finally {
8906
- this.#dispatch({ type: "error", error });
8907
- }
8908
- } finally {
8909
- this.#mutationCache.runNext(this);
8910
- }
8911
- }
8912
- #dispatch(action) {
8913
- const reducer = (state) => {
8914
- switch (action.type) {
8915
- case "failed":
8916
- return {
8917
- ...state,
8918
- failureCount: action.failureCount,
8919
- failureReason: action.error
8920
- };
8921
- case "pause":
8922
- return {
8923
- ...state,
8924
- isPaused: true
8925
- };
8926
- case "continue":
8927
- return {
8928
- ...state,
8929
- isPaused: false
8930
- };
8931
- case "pending":
8932
- return {
8933
- ...state,
8934
- context: action.context,
8935
- data: void 0,
8936
- failureCount: 0,
8937
- failureReason: null,
8938
- error: null,
8939
- isPaused: action.isPaused,
8940
- status: "pending",
8941
- variables: action.variables,
8942
- submittedAt: Date.now()
8943
- };
8944
- case "success":
8945
- return {
8946
- ...state,
8947
- data: action.data,
8948
- failureCount: 0,
8949
- failureReason: null,
8950
- error: null,
8951
- status: "success",
8952
- isPaused: false
8953
- };
8954
- case "error":
8955
- return {
8956
- ...state,
8957
- data: void 0,
8958
- error: action.error,
8959
- failureCount: state.failureCount + 1,
8960
- failureReason: action.error,
8961
- isPaused: false,
8962
- status: "error"
8963
- };
8964
- }
8965
- };
8966
- this.state = reducer(this.state);
8967
- notifyManager.batch(() => {
8968
- this.#observers.forEach((observer) => {
8969
- observer.onMutationUpdate(action);
8970
- });
8971
- this.#mutationCache.notify({
8972
- mutation: this,
8973
- type: "updated",
8974
- action
8975
- });
8976
- });
8977
- }
8978
- };
8979
- function getDefaultState() {
8980
- return {
8981
- context: void 0,
8982
- data: void 0,
8983
- error: null,
8984
- failureCount: 0,
8985
- failureReason: null,
8986
- isPaused: false,
8987
- status: "idle",
8988
- variables: void 0,
8989
- submittedAt: 0
8990
- };
8991
- }
8992
-
8993
- // src/mutationCache.ts
8994
- var MutationCache = class extends Subscribable {
8995
- constructor(config = {}) {
8996
- super();
8997
- this.config = config;
8998
- this.#mutations = /* @__PURE__ */ new Set();
8999
- this.#scopes = /* @__PURE__ */ new Map();
9000
- this.#mutationId = 0;
9001
- }
9002
- #mutations;
9003
- #scopes;
9004
- #mutationId;
9005
- build(client, options, state) {
9006
- const mutation = new Mutation({
9007
- client,
9008
- mutationCache: this,
9009
- mutationId: ++this.#mutationId,
9010
- options: client.defaultMutationOptions(options),
9011
- state
9012
- });
9013
- this.add(mutation);
9014
- return mutation;
9015
- }
9016
- add(mutation) {
9017
- this.#mutations.add(mutation);
9018
- const scope = scopeFor(mutation);
9019
- if (typeof scope === "string") {
9020
- const scopedMutations = this.#scopes.get(scope);
9021
- if (scopedMutations) {
9022
- scopedMutations.push(mutation);
9023
- } else {
9024
- this.#scopes.set(scope, [mutation]);
9025
- }
9026
- }
9027
- this.notify({ type: "added", mutation });
9028
- }
9029
- remove(mutation) {
9030
- if (this.#mutations.delete(mutation)) {
9031
- const scope = scopeFor(mutation);
9032
- if (typeof scope === "string") {
9033
- const scopedMutations = this.#scopes.get(scope);
9034
- if (scopedMutations) {
9035
- if (scopedMutations.length > 1) {
9036
- const index = scopedMutations.indexOf(mutation);
9037
- if (index !== -1) {
9038
- scopedMutations.splice(index, 1);
9039
- }
9040
- } else if (scopedMutations[0] === mutation) {
9041
- this.#scopes.delete(scope);
9042
- }
9043
- }
9044
- }
9045
- }
9046
- this.notify({ type: "removed", mutation });
9047
- }
9048
- canRun(mutation) {
9049
- const scope = scopeFor(mutation);
9050
- if (typeof scope === "string") {
9051
- const mutationsWithSameScope = this.#scopes.get(scope);
9052
- const firstPendingMutation = mutationsWithSameScope?.find(
9053
- (m) => m.state.status === "pending"
9054
- );
9055
- return !firstPendingMutation || firstPendingMutation === mutation;
9056
- } else {
9057
- return true;
9058
- }
9059
- }
9060
- runNext(mutation) {
9061
- const scope = scopeFor(mutation);
9062
- if (typeof scope === "string") {
9063
- const foundMutation = this.#scopes.get(scope)?.find((m) => m !== mutation && m.state.isPaused);
9064
- return foundMutation?.continue() ?? Promise.resolve();
9065
- } else {
9066
- return Promise.resolve();
9067
- }
9068
- }
9069
- clear() {
9070
- notifyManager.batch(() => {
9071
- this.#mutations.forEach((mutation) => {
9072
- this.notify({ type: "removed", mutation });
9073
- });
9074
- this.#mutations.clear();
9075
- this.#scopes.clear();
9076
- });
9077
- }
9078
- getAll() {
9079
- return Array.from(this.#mutations);
9080
- }
9081
- find(filters) {
9082
- const defaultedFilters = { exact: true, ...filters };
9083
- return this.getAll().find(
9084
- (mutation) => matchMutation(defaultedFilters, mutation)
9085
- );
9086
- }
9087
- findAll(filters = {}) {
9088
- return this.getAll().filter((mutation) => matchMutation(filters, mutation));
9089
- }
9090
- notify(event) {
9091
- notifyManager.batch(() => {
9092
- this.listeners.forEach((listener) => {
9093
- listener(event);
9094
- });
9095
- });
9096
- }
9097
- resumePausedMutations() {
9098
- const pausedMutations = this.getAll().filter((x) => x.state.isPaused);
9099
- return notifyManager.batch(
9100
- () => Promise.all(
9101
- pausedMutations.map((mutation) => mutation.continue().catch(noop))
9102
- )
9103
- );
9104
- }
9105
- };
9106
- function scopeFor(mutation) {
9107
- return mutation.options.scope?.id;
9108
- }
9109
-
9110
- // src/queriesObserver.ts
9111
- function difference(array1, array2) {
9112
- const excludeSet = new Set(array2);
9113
- return array1.filter((x) => !excludeSet.has(x));
9114
- }
9115
- function replaceAt(array, index, value) {
9116
- const copy = array.slice(0);
9117
- copy[index] = value;
9118
- return copy;
9119
- }
9120
- var QueriesObserver = class extends Subscribable {
9121
- #client;
9122
- #result;
9123
- #queries;
9124
- #options;
9125
- #observers;
9126
- #combinedResult;
9127
- #lastCombine;
9128
- #lastResult;
9129
- #observerMatches = [];
9130
- constructor(client, queries, options) {
9131
- super();
9132
- this.#client = client;
9133
- this.#options = options;
9134
- this.#queries = [];
9135
- this.#observers = [];
9136
- this.#result = [];
9137
- this.setQueries(queries);
9138
- }
9139
- onSubscribe() {
9140
- if (this.listeners.size === 1) {
9141
- this.#observers.forEach((observer) => {
9142
- observer.subscribe((result) => {
9143
- this.#onUpdate(observer, result);
9144
- });
9145
- });
9146
- }
9147
- }
9148
- onUnsubscribe() {
9149
- if (!this.listeners.size) {
9150
- this.destroy();
9151
- }
9152
- }
9153
- destroy() {
9154
- this.listeners = /* @__PURE__ */ new Set();
9155
- this.#observers.forEach((observer) => {
9156
- observer.destroy();
9157
- });
9158
- }
9159
- setQueries(queries, options) {
9160
- this.#queries = queries;
9161
- this.#options = options;
9162
- if (process.env.NODE_ENV !== "production") {
9163
- const queryHashes = queries.map(
9164
- (query) => this.#client.defaultQueryOptions(query).queryHash
9165
- );
9166
- if (new Set(queryHashes).size !== queryHashes.length) {
9167
- console.warn(
9168
- "[QueriesObserver]: Duplicate Queries found. This might result in unexpected behavior."
9169
- );
9170
- }
9171
- }
9172
- notifyManager.batch(() => {
9173
- const prevObservers = this.#observers;
9174
- const newObserverMatches = this.#findMatchingObservers(this.#queries);
9175
- this.#observerMatches = newObserverMatches;
9176
- newObserverMatches.forEach(
9177
- (match) => match.observer.setOptions(match.defaultedQueryOptions)
9178
- );
9179
- const newObservers = newObserverMatches.map((match) => match.observer);
9180
- const newResult = newObservers.map(
9181
- (observer) => observer.getCurrentResult()
9182
- );
9183
- const hasLengthChange = prevObservers.length !== newObservers.length;
9184
- const hasIndexChange = newObservers.some(
9185
- (observer, index) => observer !== prevObservers[index]
9186
- );
9187
- const hasStructuralChange = hasLengthChange || hasIndexChange;
9188
- const hasResultChange = hasStructuralChange ? true : newResult.some((result, index) => {
9189
- const prev = this.#result[index];
9190
- return !prev || !shallowEqualObjects(result, prev);
9191
- });
9192
- if (!hasStructuralChange && !hasResultChange) return;
9193
- if (hasStructuralChange) {
9194
- this.#observers = newObservers;
9195
- }
9196
- this.#result = newResult;
9197
- if (!this.hasListeners()) return;
9198
- if (hasStructuralChange) {
9199
- difference(prevObservers, newObservers).forEach((observer) => {
9200
- observer.destroy();
9201
- });
9202
- difference(newObservers, prevObservers).forEach((observer) => {
9203
- observer.subscribe((result) => {
9204
- this.#onUpdate(observer, result);
9205
- });
9206
- });
9207
- }
9208
- this.#notify();
9209
- });
9210
- }
9211
- getCurrentResult() {
9212
- return this.#result;
9213
- }
9214
- getQueries() {
9215
- return this.#observers.map((observer) => observer.getCurrentQuery());
9216
- }
9217
- getObservers() {
9218
- return this.#observers;
9219
- }
9220
- getOptimisticResult(queries, combine) {
9221
- const matches = this.#findMatchingObservers(queries);
9222
- const result = matches.map(
9223
- (match) => match.observer.getOptimisticResult(match.defaultedQueryOptions)
9224
- );
9225
- return [
9226
- result,
9227
- (r) => {
9228
- return this.#combineResult(r ?? result, combine);
9229
- },
9230
- () => {
9231
- return this.#trackResult(result, matches);
9232
- }
9233
- ];
9234
- }
9235
- #trackResult(result, matches) {
9236
- return matches.map((match, index) => {
9237
- const observerResult = result[index];
9238
- return !match.defaultedQueryOptions.notifyOnChangeProps ? match.observer.trackResult(observerResult, (accessedProp) => {
9239
- matches.forEach((m) => {
9240
- m.observer.trackProp(accessedProp);
9241
- });
9242
- }) : observerResult;
9243
- });
9244
- }
9245
- #combineResult(input, combine) {
9246
- if (combine) {
9247
- if (!this.#combinedResult || this.#result !== this.#lastResult || combine !== this.#lastCombine) {
9248
- this.#lastCombine = combine;
9249
- this.#lastResult = this.#result;
9250
- this.#combinedResult = replaceEqualDeep(
9251
- this.#combinedResult,
9252
- combine(input)
9253
- );
9254
- }
9255
- return this.#combinedResult;
9256
- }
9257
- return input;
9258
- }
9259
- #findMatchingObservers(queries) {
9260
- const prevObserversMap = /* @__PURE__ */ new Map();
9261
- this.#observers.forEach((observer) => {
9262
- const key = observer.options.queryHash;
9263
- if (!key) return;
9264
- const previousObservers = prevObserversMap.get(key);
9265
- if (previousObservers) {
9266
- previousObservers.push(observer);
9267
- } else {
9268
- prevObserversMap.set(key, [observer]);
9269
- }
9270
- });
9271
- const observers = [];
9272
- queries.forEach((options) => {
9273
- const defaultedOptions = this.#client.defaultQueryOptions(options);
9274
- const match = prevObserversMap.get(defaultedOptions.queryHash)?.shift();
9275
- const observer = match ?? new QueryObserver(this.#client, defaultedOptions);
9276
- observers.push({
9277
- defaultedQueryOptions: defaultedOptions,
9278
- observer
9279
- });
9280
- });
9281
- return observers;
9282
- }
9283
- #onUpdate(observer, result) {
9284
- const index = this.#observers.indexOf(observer);
9285
- if (index !== -1) {
9286
- this.#result = replaceAt(this.#result, index, result);
9287
- this.#notify();
9288
- }
9289
- }
9290
- #notify() {
9291
- if (this.hasListeners()) {
9292
- const previousResult = this.#combinedResult;
9293
- const newTracked = this.#trackResult(this.#result, this.#observerMatches);
9294
- const newResult = this.#combineResult(newTracked, this.#options?.combine);
9295
- if (previousResult !== newResult) {
9296
- notifyManager.batch(() => {
9297
- this.listeners.forEach((listener) => {
9298
- listener(this.#result);
9299
- });
9300
- });
9301
- }
9302
- }
9303
- }
9304
- };
9305
-
9306
- // src/queryCache.ts
9307
- var QueryCache = class extends Subscribable {
9308
- constructor(config = {}) {
9309
- super();
9310
- this.config = config;
9311
- this.#queries = /* @__PURE__ */ new Map();
9312
- }
9313
- #queries;
9314
- build(client, options, state) {
9315
- const queryKey = options.queryKey;
9316
- const queryHash = options.queryHash ?? hashQueryKeyByOptions(queryKey, options);
9317
- let query = this.get(queryHash);
9318
- if (!query) {
9319
- query = new Query({
9320
- client,
9321
- queryKey,
9322
- queryHash,
9323
- options: client.defaultQueryOptions(options),
9324
- state,
9325
- defaultOptions: client.getQueryDefaults(queryKey)
9326
- });
9327
- this.add(query);
9328
- }
9329
- return query;
9330
- }
9331
- add(query) {
9332
- if (!this.#queries.has(query.queryHash)) {
9333
- this.#queries.set(query.queryHash, query);
9334
- this.notify({
9335
- type: "added",
9336
- query
9337
- });
9338
- }
9339
- }
9340
- remove(query) {
9341
- const queryInMap = this.#queries.get(query.queryHash);
9342
- if (queryInMap) {
9343
- query.destroy();
9344
- if (queryInMap === query) {
9345
- this.#queries.delete(query.queryHash);
9346
- }
9347
- this.notify({ type: "removed", query });
9348
- }
9349
- }
9350
- clear() {
9351
- notifyManager.batch(() => {
9352
- this.getAll().forEach((query) => {
9353
- this.remove(query);
9354
- });
9355
- });
9356
- }
9357
- get(queryHash) {
9358
- return this.#queries.get(queryHash);
9359
- }
9360
- getAll() {
9361
- return [...this.#queries.values()];
9362
- }
9363
- find(filters) {
9364
- const defaultedFilters = { exact: true, ...filters };
9365
- return this.getAll().find(
9366
- (query) => matchQuery(defaultedFilters, query)
9367
- );
9368
- }
9369
- findAll(filters = {}) {
9370
- const queries = this.getAll();
9371
- return Object.keys(filters).length > 0 ? queries.filter((query) => matchQuery(filters, query)) : queries;
9372
- }
9373
- notify(event) {
9374
- notifyManager.batch(() => {
9375
- this.listeners.forEach((listener) => {
9376
- listener(event);
9377
- });
9378
- });
9379
- }
9380
- onFocus() {
9381
- notifyManager.batch(() => {
9382
- this.getAll().forEach((query) => {
9383
- query.onFocus();
9384
- });
9385
- });
9386
- }
9387
- onOnline() {
9388
- notifyManager.batch(() => {
9389
- this.getAll().forEach((query) => {
9390
- query.onOnline();
9391
- });
9392
- });
9393
- }
9394
- };
9395
-
9396
- // src/queryClient.ts
9397
- var QueryClient = class {
9398
- #queryCache;
9399
- #mutationCache;
9400
- #defaultOptions;
9401
- #queryDefaults;
9402
- #mutationDefaults;
9403
- #mountCount;
9404
- #unsubscribeFocus;
9405
- #unsubscribeOnline;
9406
- constructor(config = {}) {
9407
- this.#queryCache = config.queryCache || new QueryCache();
9408
- this.#mutationCache = config.mutationCache || new MutationCache();
9409
- this.#defaultOptions = config.defaultOptions || {};
9410
- this.#queryDefaults = /* @__PURE__ */ new Map();
9411
- this.#mutationDefaults = /* @__PURE__ */ new Map();
9412
- this.#mountCount = 0;
9413
- }
9414
- mount() {
9415
- this.#mountCount++;
9416
- if (this.#mountCount !== 1) return;
9417
- this.#unsubscribeFocus = focusManager.subscribe(async (focused) => {
9418
- if (focused) {
9419
- await this.resumePausedMutations();
9420
- this.#queryCache.onFocus();
9421
- }
9422
- });
9423
- this.#unsubscribeOnline = onlineManager.subscribe(async (online) => {
9424
- if (online) {
9425
- await this.resumePausedMutations();
9426
- this.#queryCache.onOnline();
9427
- }
9428
- });
9429
- }
9430
- unmount() {
9431
- this.#mountCount--;
9432
- if (this.#mountCount !== 0) return;
9433
- this.#unsubscribeFocus?.();
9434
- this.#unsubscribeFocus = void 0;
9435
- this.#unsubscribeOnline?.();
9436
- this.#unsubscribeOnline = void 0;
9437
- }
9438
- isFetching(filters) {
9439
- return this.#queryCache.findAll({ ...filters, fetchStatus: "fetching" }).length;
9440
- }
9441
- isMutating(filters) {
9442
- return this.#mutationCache.findAll({ ...filters, status: "pending" }).length;
9443
- }
9444
- /**
9445
- * Imperative (non-reactive) way to retrieve data for a QueryKey.
9446
- * Should only be used in callbacks or functions where reading the latest data is necessary, e.g. for optimistic updates.
9447
- *
9448
- * Hint: Do not use this function inside a component, because it won't receive updates.
9449
- * Use `useQuery` to create a `QueryObserver` that subscribes to changes.
9450
- */
9451
- getQueryData(queryKey) {
9452
- const options = this.defaultQueryOptions({ queryKey });
9453
- return this.#queryCache.get(options.queryHash)?.state.data;
9454
- }
9455
- ensureQueryData(options) {
9456
- const defaultedOptions = this.defaultQueryOptions(options);
9457
- const query = this.#queryCache.build(this, defaultedOptions);
9458
- const cachedData = query.state.data;
9459
- if (cachedData === void 0) {
9460
- return this.fetchQuery(options);
9461
- }
9462
- if (options.revalidateIfStale && query.isStaleByTime(resolveStaleTime(defaultedOptions.staleTime, query))) {
9463
- void this.prefetchQuery(defaultedOptions);
9464
- }
9465
- return Promise.resolve(cachedData);
9466
- }
9467
- getQueriesData(filters) {
9468
- return this.#queryCache.findAll(filters).map(({ queryKey, state }) => {
9469
- const data = state.data;
9470
- return [queryKey, data];
9471
- });
9472
- }
9473
- setQueryData(queryKey, updater, options) {
9474
- const defaultedOptions = this.defaultQueryOptions({ queryKey });
9475
- const query = this.#queryCache.get(
9476
- defaultedOptions.queryHash
9477
- );
9478
- const prevData = query?.state.data;
9479
- const data = functionalUpdate(updater, prevData);
9480
- if (data === void 0) {
9481
- return void 0;
9482
- }
9483
- return this.#queryCache.build(this, defaultedOptions).setData(data, { ...options, manual: true });
9484
- }
9485
- setQueriesData(filters, updater, options) {
9486
- return notifyManager.batch(
9487
- () => this.#queryCache.findAll(filters).map(({ queryKey }) => [
9488
- queryKey,
9489
- this.setQueryData(queryKey, updater, options)
9490
- ])
9491
- );
9492
- }
9493
- getQueryState(queryKey) {
9494
- const options = this.defaultQueryOptions({ queryKey });
9495
- return this.#queryCache.get(
9496
- options.queryHash
9497
- )?.state;
9498
- }
9499
- removeQueries(filters) {
9500
- const queryCache = this.#queryCache;
9501
- notifyManager.batch(() => {
9502
- queryCache.findAll(filters).forEach((query) => {
9503
- queryCache.remove(query);
9504
- });
9505
- });
9506
- }
9507
- resetQueries(filters, options) {
9508
- const queryCache = this.#queryCache;
9509
- return notifyManager.batch(() => {
9510
- queryCache.findAll(filters).forEach((query) => {
9511
- query.reset();
9512
- });
9513
- return this.refetchQueries(
9514
- {
9515
- type: "active",
9516
- ...filters
9517
- },
9518
- options
9519
- );
9520
- });
9521
- }
9522
- cancelQueries(filters, cancelOptions = {}) {
9523
- const defaultedCancelOptions = { revert: true, ...cancelOptions };
9524
- const promises = notifyManager.batch(
9525
- () => this.#queryCache.findAll(filters).map((query) => query.cancel(defaultedCancelOptions))
9526
- );
9527
- return Promise.all(promises).then(noop).catch(noop);
9528
- }
9529
- invalidateQueries(filters, options = {}) {
9530
- return notifyManager.batch(() => {
9531
- this.#queryCache.findAll(filters).forEach((query) => {
9532
- query.invalidate();
9533
- });
9534
- if (filters?.refetchType === "none") {
9535
- return Promise.resolve();
9536
- }
9537
- return this.refetchQueries(
9538
- {
9539
- ...filters,
9540
- type: filters?.refetchType ?? filters?.type ?? "active"
9541
- },
9542
- options
9543
- );
9544
- });
9545
- }
9546
- refetchQueries(filters, options = {}) {
9547
- const fetchOptions = {
9548
- ...options,
9549
- cancelRefetch: options.cancelRefetch ?? true
9550
- };
9551
- const promises = notifyManager.batch(
9552
- () => this.#queryCache.findAll(filters).filter((query) => !query.isDisabled() && !query.isStatic()).map((query) => {
9553
- let promise = query.fetch(void 0, fetchOptions);
9554
- if (!fetchOptions.throwOnError) {
9555
- promise = promise.catch(noop);
9556
- }
9557
- return query.state.fetchStatus === "paused" ? Promise.resolve() : promise;
9558
- })
9559
- );
9560
- return Promise.all(promises).then(noop);
9561
- }
9562
- fetchQuery(options) {
9563
- const defaultedOptions = this.defaultQueryOptions(options);
9564
- if (defaultedOptions.retry === void 0) {
9565
- defaultedOptions.retry = false;
9566
- }
9567
- const query = this.#queryCache.build(this, defaultedOptions);
9568
- return query.isStaleByTime(
9569
- resolveStaleTime(defaultedOptions.staleTime, query)
9570
- ) ? query.fetch(defaultedOptions) : Promise.resolve(query.state.data);
9571
- }
9572
- prefetchQuery(options) {
9573
- return this.fetchQuery(options).then(noop).catch(noop);
9574
- }
9575
- fetchInfiniteQuery(options) {
9576
- options.behavior = infiniteQueryBehavior(options.pages);
9577
- return this.fetchQuery(options);
9578
- }
9579
- prefetchInfiniteQuery(options) {
9580
- return this.fetchInfiniteQuery(options).then(noop).catch(noop);
9581
- }
9582
- ensureInfiniteQueryData(options) {
9583
- options.behavior = infiniteQueryBehavior(options.pages);
9584
- return this.ensureQueryData(options);
9585
- }
9586
- resumePausedMutations() {
9587
- if (onlineManager.isOnline()) {
9588
- return this.#mutationCache.resumePausedMutations();
9589
- }
9590
- return Promise.resolve();
9591
- }
9592
- getQueryCache() {
9593
- return this.#queryCache;
9594
- }
9595
- getMutationCache() {
9596
- return this.#mutationCache;
9597
- }
9598
- getDefaultOptions() {
9599
- return this.#defaultOptions;
9600
- }
9601
- setDefaultOptions(options) {
9602
- this.#defaultOptions = options;
9603
- }
9604
- setQueryDefaults(queryKey, options) {
9605
- this.#queryDefaults.set(hashKey(queryKey), {
9606
- queryKey,
9607
- defaultOptions: options
9608
- });
9609
- }
9610
- getQueryDefaults(queryKey) {
9611
- const defaults = [...this.#queryDefaults.values()];
9612
- const result = {};
9613
- defaults.forEach((queryDefault) => {
9614
- if (partialMatchKey(queryKey, queryDefault.queryKey)) {
9615
- Object.assign(result, queryDefault.defaultOptions);
9616
- }
9617
- });
9618
- return result;
9619
- }
9620
- setMutationDefaults(mutationKey, options) {
9621
- this.#mutationDefaults.set(hashKey(mutationKey), {
9622
- mutationKey,
9623
- defaultOptions: options
9624
- });
9625
- }
9626
- getMutationDefaults(mutationKey) {
9627
- const defaults = [...this.#mutationDefaults.values()];
9628
- const result = {};
9629
- defaults.forEach((queryDefault) => {
9630
- if (partialMatchKey(mutationKey, queryDefault.mutationKey)) {
9631
- Object.assign(result, queryDefault.defaultOptions);
9632
- }
9633
- });
9634
- return result;
9635
- }
9636
- defaultQueryOptions(options) {
9637
- if (options._defaulted) {
9638
- return options;
9639
- }
9640
- const defaultedOptions = {
9641
- ...this.#defaultOptions.queries,
9642
- ...this.getQueryDefaults(options.queryKey),
9643
- ...options,
9644
- _defaulted: true
9645
- };
9646
- if (!defaultedOptions.queryHash) {
9647
- defaultedOptions.queryHash = hashQueryKeyByOptions(
9648
- defaultedOptions.queryKey,
9649
- defaultedOptions
9650
- );
9651
- }
9652
- if (defaultedOptions.refetchOnReconnect === void 0) {
9653
- defaultedOptions.refetchOnReconnect = defaultedOptions.networkMode !== "always";
9654
- }
9655
- if (defaultedOptions.throwOnError === void 0) {
9656
- defaultedOptions.throwOnError = !!defaultedOptions.suspense;
9657
- }
9658
- if (!defaultedOptions.networkMode && defaultedOptions.persister) {
9659
- defaultedOptions.networkMode = "offlineFirst";
9660
- }
9661
- if (defaultedOptions.queryFn === skipToken) {
9662
- defaultedOptions.enabled = false;
9663
- }
9664
- return defaultedOptions;
9665
- }
9666
- defaultMutationOptions(options) {
9667
- if (options?._defaulted) {
9668
- return options;
9669
- }
9670
- return {
9671
- ...this.#defaultOptions.mutations,
9672
- ...options?.mutationKey && this.getMutationDefaults(options.mutationKey),
9673
- ...options,
9674
- _defaulted: true
9675
- };
9676
- }
9677
- clear() {
9678
- this.#queryCache.clear();
9679
- this.#mutationCache.clear();
9680
- }
9681
- };
9682
-
9683
- var QueryClientContext = React__namespace.createContext(
9684
- void 0
9685
- );
9686
- var useQueryClient = (queryClient) => {
9687
- const client = React__namespace.useContext(QueryClientContext);
9688
- if (!client) {
9689
- throw new Error("No QueryClient set, use QueryClientProvider to set one");
9690
- }
9691
- return client;
9692
- };
9693
- var QueryClientProvider = ({
9694
- client,
9695
- children
9696
- }) => {
9697
- React__namespace.useEffect(() => {
9698
- client.mount();
9699
- return () => {
9700
- client.unmount();
9701
- };
9702
- }, [client]);
9703
- return /* @__PURE__ */ jsxRuntimeExports.jsx(QueryClientContext.Provider, { value: client, children });
9704
- };
9705
-
9706
- var IsRestoringContext = React__namespace.createContext(false);
9707
- var useIsRestoring = () => React__namespace.useContext(IsRestoringContext);
9708
- IsRestoringContext.Provider;
9709
-
9710
- function createValue() {
9711
- let isReset = false;
9712
- return {
9713
- clearReset: () => {
9714
- isReset = false;
9715
- },
9716
- reset: () => {
9717
- isReset = true;
9718
- },
9719
- isReset: () => {
9720
- return isReset;
9721
- }
9722
- };
9723
- }
9724
- var QueryErrorResetBoundaryContext = React__namespace.createContext(createValue());
9725
- var useQueryErrorResetBoundary = () => React__namespace.useContext(QueryErrorResetBoundaryContext);
9726
-
9727
- var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary) => {
9728
- if (options.suspense || options.throwOnError || options.experimental_prefetchInRender) {
9729
- if (!errorResetBoundary.isReset()) {
9730
- options.retryOnMount = false;
9731
- }
9732
- }
9733
- };
9734
- var useClearResetErrorBoundary = (errorResetBoundary) => {
9735
- React__namespace.useEffect(() => {
9736
- errorResetBoundary.clearReset();
9737
- }, [errorResetBoundary]);
9738
- };
9739
- var getHasError = ({
9740
- result,
9741
- errorResetBoundary,
9742
- throwOnError,
9743
- query,
9744
- suspense
9745
- }) => {
9746
- return result.isError && !errorResetBoundary.isReset() && !result.isFetching && query && (suspense && result.data === void 0 || shouldThrowError(throwOnError, [result.error, query]));
9747
- };
9748
-
9749
- // src/suspense.ts
9750
- var ensureSuspenseTimers = (defaultedOptions) => {
9751
- if (defaultedOptions.suspense) {
9752
- const MIN_SUSPENSE_TIME_MS = 1e3;
9753
- const clamp = (value) => value === "static" ? value : Math.max(value ?? MIN_SUSPENSE_TIME_MS, MIN_SUSPENSE_TIME_MS);
9754
- const originalStaleTime = defaultedOptions.staleTime;
9755
- defaultedOptions.staleTime = typeof originalStaleTime === "function" ? (...args) => clamp(originalStaleTime(...args)) : clamp(originalStaleTime);
9756
- if (typeof defaultedOptions.gcTime === "number") {
9757
- defaultedOptions.gcTime = Math.max(
9758
- defaultedOptions.gcTime,
9759
- MIN_SUSPENSE_TIME_MS
9760
- );
9761
- }
9762
- }
9763
- };
9764
- var willFetch = (result, isRestoring) => result.isLoading && result.isFetching && !isRestoring;
9765
- var shouldSuspend = (defaultedOptions, result) => defaultedOptions?.suspense && result.isPending;
9766
- var fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observer.fetchOptimistic(defaultedOptions).catch(() => {
9767
- errorResetBoundary.clearReset();
9768
- });
9769
-
9770
- function useQueries({
9771
- queries,
9772
- ...options
9773
- }, queryClient) {
9774
- const client = useQueryClient();
9775
- const isRestoring = useIsRestoring();
9776
- const errorResetBoundary = useQueryErrorResetBoundary();
9777
- const defaultedQueries = React__namespace.useMemo(
9778
- () => queries.map((opts) => {
9779
- const defaultedOptions = client.defaultQueryOptions(
9780
- opts
9781
- );
9782
- defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic";
9783
- return defaultedOptions;
9784
- }),
9785
- [queries, client, isRestoring]
9786
- );
9787
- defaultedQueries.forEach((query) => {
9788
- ensureSuspenseTimers(query);
9789
- ensurePreventErrorBoundaryRetry(query, errorResetBoundary);
9790
- });
9791
- useClearResetErrorBoundary(errorResetBoundary);
9792
- const [observer] = React__namespace.useState(
9793
- () => new QueriesObserver(
9794
- client,
9795
- defaultedQueries,
9796
- options
9797
- )
9798
- );
9799
- const [optimisticResult, getCombinedResult, trackResult] = observer.getOptimisticResult(
9800
- defaultedQueries,
9801
- options.combine
9802
- );
9803
- const shouldSubscribe = !isRestoring && options.subscribed !== false;
9804
- React__namespace.useSyncExternalStore(
9805
- React__namespace.useCallback(
9806
- (onStoreChange) => shouldSubscribe ? observer.subscribe(notifyManager.batchCalls(onStoreChange)) : noop,
9807
- [observer, shouldSubscribe]
9808
- ),
9809
- () => observer.getCurrentResult(),
9810
- () => observer.getCurrentResult()
9811
- );
9812
- React__namespace.useEffect(() => {
9813
- observer.setQueries(
9814
- defaultedQueries,
9815
- options
9816
- );
9817
- }, [defaultedQueries, options, observer]);
9818
- const shouldAtLeastOneSuspend = optimisticResult.some(
9819
- (result, index) => shouldSuspend(defaultedQueries[index], result)
9820
- );
9821
- const suspensePromises = shouldAtLeastOneSuspend ? optimisticResult.flatMap((result, index) => {
9822
- const opts = defaultedQueries[index];
9823
- if (opts) {
9824
- const queryObserver = new QueryObserver(client, opts);
9825
- if (shouldSuspend(opts, result)) {
9826
- return fetchOptimistic(opts, queryObserver, errorResetBoundary);
9827
- } else if (willFetch(result, isRestoring)) {
9828
- void fetchOptimistic(opts, queryObserver, errorResetBoundary);
9829
- }
9830
- }
9831
- return [];
9832
- }) : [];
9833
- if (suspensePromises.length > 0) {
9834
- throw Promise.all(suspensePromises);
9835
- }
9836
- const firstSingleResultWhichShouldThrow = optimisticResult.find(
9837
- (result, index) => {
9838
- const query = defaultedQueries[index];
9839
- return query && getHasError({
9840
- result,
9841
- errorResetBoundary,
9842
- throwOnError: query.throwOnError,
9843
- query: client.getQueryCache().get(query.queryHash),
9844
- suspense: query.suspense
9845
- });
9846
- }
9847
- );
9848
- if (firstSingleResultWhichShouldThrow?.error) {
9849
- throw firstSingleResultWhichShouldThrow.error;
9850
- }
9851
- return getCombinedResult(trackResult());
9852
- }
9853
-
9854
- function useBaseQuery(options, Observer, queryClient) {
9855
- if (process.env.NODE_ENV !== "production") {
9856
- if (typeof options !== "object" || Array.isArray(options)) {
9857
- throw new Error(
9858
- 'Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object'
9859
- );
9860
- }
9861
- }
9862
- const isRestoring = useIsRestoring();
9863
- const errorResetBoundary = useQueryErrorResetBoundary();
9864
- const client = useQueryClient();
9865
- const defaultedOptions = client.defaultQueryOptions(options);
9866
- client.getDefaultOptions().queries?._experimental_beforeQuery?.(
9867
- defaultedOptions
9868
- );
9869
- if (process.env.NODE_ENV !== "production") {
9870
- if (!defaultedOptions.queryFn) {
9871
- console.error(
9872
- `[${defaultedOptions.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`
9873
- );
9874
- }
9875
- }
9876
- defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic";
9877
- ensureSuspenseTimers(defaultedOptions);
9878
- ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary);
9879
- useClearResetErrorBoundary(errorResetBoundary);
9880
- const isNewCacheEntry = !client.getQueryCache().get(defaultedOptions.queryHash);
9881
- const [observer] = React__namespace.useState(
9882
- () => new Observer(
9883
- client,
9884
- defaultedOptions
9885
- )
9886
- );
9887
- const result = observer.getOptimisticResult(defaultedOptions);
9888
- const shouldSubscribe = !isRestoring && options.subscribed !== false;
9889
- React__namespace.useSyncExternalStore(
9890
- React__namespace.useCallback(
9891
- (onStoreChange) => {
9892
- const unsubscribe = shouldSubscribe ? observer.subscribe(notifyManager.batchCalls(onStoreChange)) : noop;
9893
- observer.updateResult();
9894
- return unsubscribe;
9895
- },
9896
- [observer, shouldSubscribe]
9897
- ),
9898
- () => observer.getCurrentResult(),
9899
- () => observer.getCurrentResult()
9900
- );
9901
- React__namespace.useEffect(() => {
9902
- observer.setOptions(defaultedOptions);
9903
- }, [defaultedOptions, observer]);
9904
- if (shouldSuspend(defaultedOptions, result)) {
9905
- throw fetchOptimistic(defaultedOptions, observer, errorResetBoundary);
9906
- }
9907
- if (getHasError({
9908
- result,
9909
- errorResetBoundary,
9910
- throwOnError: defaultedOptions.throwOnError,
9911
- query: client.getQueryCache().get(defaultedOptions.queryHash),
9912
- suspense: defaultedOptions.suspense
9913
- })) {
9914
- throw result.error;
9915
- }
9916
- client.getDefaultOptions().queries?._experimental_afterQuery?.(
9917
- defaultedOptions,
9918
- result
9919
- );
9920
- if (defaultedOptions.experimental_prefetchInRender && !isServer && willFetch(result, isRestoring)) {
9921
- const promise = isNewCacheEntry ? (
9922
- // Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
9923
- fetchOptimistic(defaultedOptions, observer, errorResetBoundary)
9924
- ) : (
9925
- // subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in
9926
- client.getQueryCache().get(defaultedOptions.queryHash)?.promise
9927
- );
9928
- promise?.catch(noop).finally(() => {
9929
- observer.updateResult();
9930
- });
9931
- }
9932
- return !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result;
9933
- }
9934
-
9935
- function useQuery(options, queryClient) {
9936
- return useBaseQuery(options, QueryObserver);
9937
- }
9938
-
9939
6655
  // mostly borrowed from legacy portal code: http://git.axiom/brian/d3-series-stats/-/blob/master/src/time-binners.js
9940
6656
  const hours = 60 * 60 * 1000;
9941
6657
  const doy3DigitTimeFormat = d3.timeFormat('%j');
@@ -10220,7 +6936,7 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
10220
6936
  return parseOikosContext(d);
10221
6937
  });
10222
6938
  const useDataContext = () => {
10223
- const queryResult = useQuery({
6939
+ const queryResult = reactQuery.useQuery({
10224
6940
  queryKey: ['dataContext'],
10225
6941
  queryFn: () => __awaiter(void 0, void 0, void 0, function* () {
10226
6942
  const d = yield getDataContext();
@@ -10804,7 +7520,7 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
10804
7520
 
10805
7521
  const StationMetadataLoader = ({ stationId, Component, sensorPlot, chartSettingsState }) => {
10806
7522
  var _a, _b, _c, _d;
10807
- const { data, isLoading, isError } = useQuery({
7523
+ const { data, isLoading, isError } = reactQuery.useQuery({
10808
7524
  queryKey: [stationId],
10809
7525
  queryFn: () => __awaiter(void 0, void 0, void 0, function* () {
10810
7526
  const d = yield (yield fetch(makeAPIStationMetadataRequest(stationId))).json();
@@ -10839,18 +7555,18 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
10839
7555
  const chartSettings = chartSettingsState !== undefined ? chartSettingsState[0] : undefined;
10840
7556
  const parameterGroupIds = Object.keys(Object.fromEntries(((_b = sensorPlot === null || sensorPlot === void 0 ? void 0 : sensorPlot.parameterGroupIds) !== null && _b !== void 0 ? _b : []).concat((_c = sensorPlot === null || sensorPlot === void 0 ? void 0 : sensorPlot.parameterGroupId) !== null && _c !== void 0 ? _c : []).map(d => [d, d])));
10841
7557
  if (contextError) {
10842
- return jsxRuntimeExports.jsx("p", { className: 'text-lg font-bold text-red-600', children: "Error loading units and parameters" });
7558
+ return jsxRuntime.jsx("p", { className: 'text-lg font-bold text-red-600', children: "Error loading units and parameters" });
10843
7559
  }
10844
7560
  return (isError
10845
- ? jsxRuntimeExports.jsxs("p", { className: 'text-lg font-bold text-red-600', children: ["Error loading station: ", stationId] })
7561
+ ? jsxRuntime.jsxs("p", { className: 'text-lg font-bold text-red-600', children: ["Error loading station: ", stationId] })
10846
7562
  : contextLoading || isLoading || data === undefined || context === undefined
10847
- ? jsxRuntimeExports.jsx(axiomUiUtilities.Loader, { className: 'pt-8' })
10848
- : jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: Component !== undefined && sensorPlot !== undefined
10849
- ? jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [(chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.excludeTitle) !== true
10850
- ? jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("h1", { className: 'mb-1 text-lg', children: data.label }), jsxRuntimeExports.jsx("h2", { className: 'mb-2 font-bold text-2xl', children: parameterGroupIds.length > 1
7563
+ ? jsxRuntime.jsx(axiomUiUtilities.Loader, { className: 'pt-8' })
7564
+ : jsxRuntime.jsx(jsxRuntime.Fragment, { children: Component !== undefined && sensorPlot !== undefined
7565
+ ? jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [(chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.excludeTitle) !== true
7566
+ ? jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("h1", { className: 'mb-1 text-lg', children: data.label }), jsxRuntime.jsx("h2", { className: 'mb-2 font-bold text-2xl', children: parameterGroupIds.length > 1
10851
7567
  ? 'Multiple'
10852
7568
  : (_d = data.figures.find(f => f.parameterGroupId === +parameterGroupIds[0])) === null || _d === void 0 ? void 0 : _d.label })] })
10853
- : '', jsxRuntimeExports.jsx(Component, { shortcode: 'axiom_sensor', requiredShortCodeAttributes: {
7569
+ : '', jsxRuntime.jsx(Component, { shortcode: 'axiom_sensor', requiredShortCodeAttributes: {
10854
7570
  stationId: data.id,
10855
7571
  parameterGroupId: sensorPlot.parameterGroupId,
10856
7572
  parameterGroupIds: sensorPlot.parameterGroupIds,
@@ -10891,7 +7607,7 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
10891
7607
  })
10892
7608
  ];
10893
7609
  }).flat() })] })
10894
- : jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [stationId, jsxRuntimeExports.jsx("pre", { className: 'max-h-[400px] overflow-auto text-xs text-red', children: JSON.stringify(data, null, 2) })] }) }));
7610
+ : jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [stationId, jsxRuntime.jsx("pre", { className: 'max-h-[400px] overflow-auto text-xs text-red', children: JSON.stringify(data, null, 2) })] }) }));
10895
7611
  };
10896
7612
 
10897
7613
  const BinManager = ({ bounds, binDefinitions, binSettings }) => {
@@ -10906,16 +7622,16 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
10906
7622
  }
10907
7623
  }, [bounds, binState.targetCount, binState.autoSelect]);
10908
7624
  const [previewTargetBinCount, setPreviewTargetBinCount] = React.useState(binState.targetCount);
10909
- return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(axiomUiUtilities.Checkbox, { size: 'xs', wrapperClassName: 'text-sm p-1', id: "autoTimeBin", testId: 'autoTimeBin', label: "Auto select time bin", value: binState.autoSelect, onChange: (v) => {
7625
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(axiomUiUtilities.Checkbox, { size: 'xs', wrapperClassName: 'text-sm p-1', id: "autoTimeBin", testId: 'autoTimeBin', label: "Auto select time bin", value: binState.autoSelect, onChange: (v) => {
10910
7626
  setBinState(Object.assign(Object.assign({}, binState), { autoSelect: v }));
10911
- } }), jsxRuntimeExports.jsxs("div", { className: 'w-[300px] pt-1', children: [jsxRuntimeExports.jsxs("span", { className: `text-sm float-left mr-2${binState.autoSelect ? '' : ' text-slate-300'}`, children: [jsxRuntimeExports.jsx("strong", { children: "Target bin count:" }), " ", previewTargetBinCount] }), jsxRuntimeExports.jsx(axiomUiUtilities.Slider, { id: 'targetCount', testId: 'targetCount', size: 'xs', value: binState.targetCount, disabled: !binState.autoSelect, className: `${binState.autoSelect ? '' : 'opacity-30'}`, min: 10, max: 3000, step: 10, onChange: (v) => {
7627
+ } }), jsxRuntime.jsxs("div", { className: 'w-[300px] pt-1', children: [jsxRuntime.jsxs("span", { className: `text-sm float-left mr-2${binState.autoSelect ? '' : ' text-slate-300'}`, children: [jsxRuntime.jsx("strong", { children: "Target bin count:" }), " ", previewTargetBinCount] }), jsxRuntime.jsx(axiomUiUtilities.Slider, { id: 'targetCount', testId: 'targetCount', size: 'xs', value: binState.targetCount, disabled: !binState.autoSelect, className: `${binState.autoSelect ? '' : 'opacity-30'}`, min: 10, max: 3000, step: 10, onChange: (v) => {
10912
7628
  setPreviewTargetBinCount(v);
10913
7629
  }, onChangeComplete: (v) => {
10914
7630
  setBinState(Object.assign(Object.assign({}, binState), { targetCount: v }));
10915
7631
  setPreviewTargetBinCount(v);
10916
- } })] }), jsxRuntimeExports.jsxs("div", { className: 'w-[150px]', children: [jsxRuntimeExports.jsx("strong", { className: 'float-left mr-2 text-sm', children: "Time bin" }), binState.autoSelect
10917
- ? jsxRuntimeExports.jsx("p", { className: 'text-sm', children: binState.bin })
10918
- : jsxRuntimeExports.jsx(axiomUiUtilities.SelectInput, { size: 'xs', className: 'pr-4', id: "timeBin", testId: "timeBin", disabled: binState.autoSelect, options: Object.keys(binDefinitions).map(t => {
7632
+ } })] }), jsxRuntime.jsxs("div", { className: 'w-[150px]', children: [jsxRuntime.jsx("strong", { className: 'float-left mr-2 text-sm', children: "Time bin" }), binState.autoSelect
7633
+ ? jsxRuntime.jsx("p", { className: 'text-sm', children: binState.bin })
7634
+ : jsxRuntime.jsx(axiomUiUtilities.SelectInput, { size: 'xs', className: 'pr-4', id: "timeBin", testId: "timeBin", disabled: binState.autoSelect, options: Object.keys(binDefinitions).map(t => {
10919
7635
  return {
10920
7636
  value: t,
10921
7637
  label: t
@@ -10935,12 +7651,12 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
10935
7651
  var _a;
10936
7652
  const settings = Object.assign(Object.assign({}, chartSettings), { margin: chartSettings.margin !== undefined ? chartSettings.margin : MARGIN, width: chartSettings.width !== undefined ? chartSettings.width : 'auto', height: chartSettings.height !== undefined ? chartSettings.height : 600, axes: Object.assign(Object.assign({}, chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.axes), { x: Object.assign(Object.assign({}, (_a = chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.axes) === null || _a === void 0 ? void 0 : _a.x), { domain: xDomain }) }) });
10937
7653
  const plots = results.sort((a, b) => b.order - a.order).map(d => d.plots).flat().filter(d => d !== undefined);
10938
- return (jsxRuntimeExports.jsx(AxiomChartComponent, { plots: plots, settings: settings }));
7654
+ return (jsxRuntime.jsx(AxiomChartComponent, { plots: plots, settings: settings }));
10939
7655
  };
10940
7656
  const PlotLoader = ({ plotLoaders, tempXBounds, chartSettingsState = [undefined, () => { }] }) => {
10941
7657
  const [chartSettings] = chartSettingsState;
10942
7658
  const [plots, setPlots] = React.useState({});
10943
- const plotQueries = useQueries({
7659
+ const plotQueries = reactQuery.useQueries({
10944
7660
  queries: plotLoaders.map((loader) => {
10945
7661
  return {
10946
7662
  enabled: loader.getIsEnabled(),
@@ -10964,12 +7680,12 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
10964
7680
  }
10965
7681
  : null;
10966
7682
  const height = (chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.height) !== undefined ? chartSettings.height : 600;
10967
- return (jsxRuntimeExports.jsxs("div", { style: { height }, children: [jsxRuntimeExports.jsx("div", { className: 'absolute top-10 left-0 right-0 text-center z-40', children: isError
10968
- ? jsxRuntimeExports.jsxs("span", { className: 'text-red mt-4 p-3 rounded-lg shadow-md bg-slate-200 inline-block center opacity-50', children: ["Error loading sensor data: ", error !== null ? error.message : ''] })
10969
- : jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: isLoading ? jsxRuntimeExports.jsx(axiomUiUtilities.Loader, { className: 'pt-10' }) : '' }) }), isLoading
10970
- ? jsxRuntimeExports.jsx(axiomUiUtilities.Loader, { className: 'pt-8 hidden' })
7683
+ return (jsxRuntime.jsxs("div", { style: { height }, children: [jsxRuntime.jsx("div", { className: 'absolute top-10 left-0 right-0 text-center z-40', children: isError
7684
+ ? jsxRuntime.jsxs("span", { className: 'text-red mt-4 p-3 rounded-lg shadow-md bg-slate-200 inline-block center opacity-50', children: ["Error loading sensor data: ", error !== null ? error.message : ''] })
7685
+ : jsxRuntime.jsx(jsxRuntime.Fragment, { children: isLoading ? jsxRuntime.jsx(axiomUiUtilities.Loader, { className: 'pt-10' }) : '' }) }), isLoading
7686
+ ? jsxRuntime.jsx(axiomUiUtilities.Loader, { className: 'pt-8 hidden' })
10971
7687
  : '', plots !== undefined
10972
- ? jsxRuntimeExports.jsx(NewPlotDisplay, { results: Object.values(plots), chartSettings: chartSettings, xDomain: [
7688
+ ? jsxRuntime.jsx(NewPlotDisplay, { results: Object.values(plots), chartSettings: chartSettings, xDomain: [
10973
7689
  typeof tempXBounds[0] === 'string' ? new Date(tempXBounds[0]) : tempXBounds[0],
10974
7690
  typeof tempXBounds[1] === 'string' ? new Date(tempXBounds[1]) : tempXBounds[1]
10975
7691
  ] })
@@ -11069,7 +7785,7 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
11069
7785
 
11070
7786
  const NumericControl = ({ valueState, minMax, step = 1, label, updateOnSlide = true }) => {
11071
7787
  const [value, setValue] = valueState;
11072
- return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("h5", { children: label }), jsxRuntimeExports.jsx(axiomUiUtilities.Input, { size: 'xs', id: "numericInput", testId: 'numericInput', value: String(value), onChange: (e) => {
7788
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("h5", { children: label }), jsxRuntime.jsx(axiomUiUtilities.Input, { size: 'xs', id: "numericInput", testId: 'numericInput', value: String(value), onChange: (e) => {
11073
7789
  if (e !== undefined) {
11074
7790
  const n = +e;
11075
7791
  if (!isNaN(n)) {
@@ -11077,7 +7793,7 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
11077
7793
  }
11078
7794
  }
11079
7795
  } }), minMax !== undefined
11080
- ? jsxRuntimeExports.jsx(axiomUiUtilities.Slider, { className: 'min-w-[200px]', id: 'numericSlider', testId: 'numericSlider', size: 'sm', min: minMax[0], max: minMax[1], step: step, value: value, onChange: (e) => {
7796
+ ? jsxRuntime.jsx(axiomUiUtilities.Slider, { className: 'min-w-[200px]', id: 'numericSlider', testId: 'numericSlider', size: 'sm', min: minMax[0], max: minMax[1], step: step, value: value, onChange: (e) => {
11081
7797
  if (updateOnSlide) {
11082
7798
  setValue(e);
11083
7799
  }
@@ -11088,11 +7804,11 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
11088
7804
  };
11089
7805
  const MarginControl = ({ marginState }) => {
11090
7806
  const [margin, setMargin] = marginState;
11091
- return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(NumericControl, { label: 'left', valueState: [margin.left, (s) => { setMargin(Object.assign(Object.assign({}, margin), { left: s })); }], minMax: [0, 100] }), jsxRuntimeExports.jsx(NumericControl, { label: 'right', valueState: [margin.right, (s) => { setMargin(Object.assign(Object.assign({}, margin), { right: s })); }], minMax: [0, 100] }), jsxRuntimeExports.jsx(NumericControl, { label: 'top', valueState: [margin.top, (s) => { setMargin(Object.assign(Object.assign({}, margin), { top: s })); }], minMax: [0, 100] }), jsxRuntimeExports.jsx(NumericControl, { label: 'bottom', valueState: [margin.bottom, (s) => { setMargin(Object.assign(Object.assign({}, margin), { bottom: s })); }], minMax: [0, 100] })] }));
7807
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(NumericControl, { label: 'left', valueState: [margin.left, (s) => { setMargin(Object.assign(Object.assign({}, margin), { left: s })); }], minMax: [0, 100] }), jsxRuntime.jsx(NumericControl, { label: 'right', valueState: [margin.right, (s) => { setMargin(Object.assign(Object.assign({}, margin), { right: s })); }], minMax: [0, 100] }), jsxRuntime.jsx(NumericControl, { label: 'top', valueState: [margin.top, (s) => { setMargin(Object.assign(Object.assign({}, margin), { top: s })); }], minMax: [0, 100] }), jsxRuntime.jsx(NumericControl, { label: 'bottom', valueState: [margin.bottom, (s) => { setMargin(Object.assign(Object.assign({}, margin), { bottom: s })); }], minMax: [0, 100] })] }));
11092
7808
  };
11093
7809
  const AxisSettings = ({ axisState, label }) => {
11094
7810
  const [axis, setAxisS] = axisState;
11095
- return (jsxRuntimeExports.jsxs("div", { children: [jsxRuntimeExports.jsx("h4", { children: label }), jsxRuntimeExports.jsx(NumericControl, { valueState: [
7811
+ return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("h4", { children: label }), jsxRuntime.jsx(NumericControl, { valueState: [
11096
7812
  axis.rotate !== undefined ? axis.rotate : 0,
11097
7813
  (s) => {
11098
7814
  setAxisS(Object.assign(Object.assign({}, axis), { rotate: s }));
@@ -11101,8 +7817,8 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
11101
7817
  };
11102
7818
  const CheckboxList = ({ options, state }) => {
11103
7819
  const [value, setValue] = state;
11104
- return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: options.map((option) => {
11105
- return (jsxRuntimeExports.jsx(axiomUiUtilities.Checkbox, { id: option.value, testId: option.value, label: option.label, value: value !== undefined ? value.includes(option.value) : false, onChange: (e) => {
7820
+ return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: options.map((option) => {
7821
+ return (jsxRuntime.jsx(axiomUiUtilities.Checkbox, { id: option.value, testId: option.value, label: option.label, value: value !== undefined ? value.includes(option.value) : false, onChange: (e) => {
11106
7822
  if (e) {
11107
7823
  setValue([...(value !== undefined ? value : []), option.value]);
11108
7824
  }
@@ -11114,9 +7830,9 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
11114
7830
  };
11115
7831
  const PlotGroupSettingsControl = ({ plotGroupSettingsState }) => {
11116
7832
  const [plotGroupSettings, setPlotGroupSettings] = plotGroupSettingsState;
11117
- return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(axiomUiUtilities.Checkbox, { id: 'include', testId: 'include', label: 'Include', value: (plotGroupSettings === null || plotGroupSettings === void 0 ? void 0 : plotGroupSettings.include) !== undefined ? plotGroupSettings.include : true, onChange: (e) => {
7833
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(axiomUiUtilities.Checkbox, { id: 'include', testId: 'include', label: 'Include', value: (plotGroupSettings === null || plotGroupSettings === void 0 ? void 0 : plotGroupSettings.include) !== undefined ? plotGroupSettings.include : true, onChange: (e) => {
11118
7834
  setPlotGroupSettings(Object.assign(Object.assign({}, plotGroupSettings), { include: e }));
11119
- } }), jsxRuntimeExports.jsx(axiomUiUtilities.SelectInput, { id: 'interpolator', testId: 'interpolator', size: 'xs', label: 'Interpolator', value: (plotGroupSettings === null || plotGroupSettings === void 0 ? void 0 : plotGroupSettings.interpolator) !== undefined ? plotGroupSettings.interpolator : undefined, options: [
7835
+ } }), jsxRuntime.jsx(axiomUiUtilities.SelectInput, { id: 'interpolator', testId: 'interpolator', size: 'xs', label: 'Interpolator', value: (plotGroupSettings === null || plotGroupSettings === void 0 ? void 0 : plotGroupSettings.interpolator) !== undefined ? plotGroupSettings.interpolator : undefined, options: [
11120
7836
  { label: 'Linear', value: 'linear' },
11121
7837
  { label: 'Step', value: 'step' },
11122
7838
  { label: 'Monotone', value: 'monotone' },
@@ -11125,7 +7841,7 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
11125
7841
  { label: 'Natural', value: 'natural' }
11126
7842
  ], onChange: (e) => {
11127
7843
  setPlotGroupSettings(Object.assign(Object.assign({}, plotGroupSettings), { interpolator: e === null || e === void 0 ? void 0 : e.value }));
11128
- } }), jsxRuntimeExports.jsx("h4", { children: "Exclude" }), jsxRuntimeExports.jsx(CheckboxList, { options: [
7844
+ } }), jsxRuntime.jsx("h4", { children: "Exclude" }), jsxRuntime.jsx(CheckboxList, { options: [
11129
7845
  { label: 'MinMax', value: 'minMax' },
11130
7846
  { label: 'Mean', value: 'mean' }
11131
7847
  ], state: [
@@ -11133,7 +7849,7 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
11133
7849
  (s) => {
11134
7850
  setPlotGroupSettings(Object.assign(Object.assign({}, plotGroupSettings), { exclude: s }));
11135
7851
  }
11136
- ] }), jsxRuntimeExports.jsx(axiomUiUtilities.SelectInput, { id: 'valueType', testId: 'valueType', size: 'xs', label: 'Value plot type', value: (plotGroupSettings === null || plotGroupSettings === void 0 ? void 0 : plotGroupSettings.valueType) !== undefined ? plotGroupSettings.valueType : undefined, options: [
7852
+ ] }), jsxRuntime.jsx(axiomUiUtilities.SelectInput, { id: 'valueType', testId: 'valueType', size: 'xs', label: 'Value plot type', value: (plotGroupSettings === null || plotGroupSettings === void 0 ? void 0 : plotGroupSettings.valueType) !== undefined ? plotGroupSettings.valueType : undefined, options: [
11137
7853
  {
11138
7854
  label: 'Line',
11139
7855
  value: exports.EPlotTypes.line
@@ -11144,7 +7860,7 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
11144
7860
  }
11145
7861
  ], onChange: (e) => {
11146
7862
  setPlotGroupSettings(Object.assign(Object.assign({}, plotGroupSettings), { valueType: e === null || e === void 0 ? void 0 : e.value }));
11147
- } }), jsxRuntimeExports.jsx(axiomUiUtilities.SelectInput, { id: 'areaType', testId: 'areaType', size: 'xs', label: 'Area plot type', value: (plotGroupSettings === null || plotGroupSettings === void 0 ? void 0 : plotGroupSettings.areaType) !== undefined ? plotGroupSettings.areaType : undefined, options: [
7863
+ } }), jsxRuntime.jsx(axiomUiUtilities.SelectInput, { id: 'areaType', testId: 'areaType', size: 'xs', label: 'Area plot type', value: (plotGroupSettings === null || plotGroupSettings === void 0 ? void 0 : plotGroupSettings.areaType) !== undefined ? plotGroupSettings.areaType : undefined, options: [
11148
7864
  {
11149
7865
  label: 'Area',
11150
7866
  value: exports.EPlotTypes.area
@@ -11155,25 +7871,25 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
11155
7871
  }
11156
7872
  ], onChange: (e) => {
11157
7873
  setPlotGroupSettings(Object.assign(Object.assign({}, plotGroupSettings), { areaType: e === null || e === void 0 ? void 0 : e.value }));
11158
- } }), jsxRuntimeExports.jsx(NumericControl, { label: 'Point radius', minMax: [0.25, 10], step: 0.25, updateOnSlide: false, valueState: [
7874
+ } }), jsxRuntime.jsx(NumericControl, { label: 'Point radius', minMax: [0.25, 10], step: 0.25, updateOnSlide: false, valueState: [
11159
7875
  (plotGroupSettings === null || plotGroupSettings === void 0 ? void 0 : plotGroupSettings.pointRadius) !== undefined ? plotGroupSettings.pointRadius : 1,
11160
7876
  (e) => {
11161
7877
  setPlotGroupSettings(Object.assign(Object.assign({}, plotGroupSettings), { pointRadius: e }));
11162
7878
  }
11163
- ] }), jsxRuntimeExports.jsx(NumericControl, { label: 'Line width', minMax: [0, 10], step: 0.5, updateOnSlide: false, valueState: [
7879
+ ] }), jsxRuntime.jsx(NumericControl, { label: 'Line width', minMax: [0, 10], step: 0.5, updateOnSlide: false, valueState: [
11164
7880
  (plotGroupSettings === null || plotGroupSettings === void 0 ? void 0 : plotGroupSettings.strokeWidth) !== undefined ? plotGroupSettings.strokeWidth : 1,
11165
7881
  (e) => {
11166
7882
  setPlotGroupSettings(Object.assign(Object.assign({}, plotGroupSettings), { strokeWidth: e }));
11167
7883
  }
11168
- ] }), jsxRuntimeExports.jsxs("div", { children: [jsxRuntimeExports.jsx("h4", { children: "Color" }), jsxRuntimeExports.jsxs("span", { className: 'inline-block relative w-[100px] h-[30px]', children: [jsxRuntimeExports.jsx("input", { value: plotGroupSettings === null || plotGroupSettings === void 0 ? void 0 : plotGroupSettings.overrideColor, type: 'color', onChange: (e) => {
7884
+ ] }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("h4", { children: "Color" }), jsxRuntime.jsxs("span", { className: 'inline-block relative w-[100px] h-[30px]', children: [jsxRuntime.jsx("input", { value: plotGroupSettings === null || plotGroupSettings === void 0 ? void 0 : plotGroupSettings.overrideColor, type: 'color', onChange: (e) => {
11169
7885
  setPlotGroupSettings(Object.assign(Object.assign({}, plotGroupSettings), { overrideColor: e.target.value }));
11170
7886
  }, className: 'w-full h-full cursor-pointer' }), (plotGroupSettings === null || plotGroupSettings === void 0 ? void 0 : plotGroupSettings.overrideColor) === undefined
11171
- ? jsxRuntimeExports.jsx(axiomUiUtilities.Button, { className: 'absolute top-0 right-0 left-0 bottom-0 pointer-events-none', type: 'default', size: 'xs', children: "Pick color" })
7887
+ ? jsxRuntime.jsx(axiomUiUtilities.Button, { className: 'absolute top-0 right-0 left-0 bottom-0 pointer-events-none', type: 'default', size: 'xs', children: "Pick color" })
11172
7888
  : ''] }), (plotGroupSettings === null || plotGroupSettings === void 0 ? void 0 : plotGroupSettings.overrideColor) !== undefined
11173
- ? jsxRuntimeExports.jsx(Cross2Icon, { onClick: () => {
7889
+ ? jsxRuntime.jsx(Cross2Icon, { onClick: () => {
11174
7890
  setPlotGroupSettings(Object.assign(Object.assign({}, plotGroupSettings), { overrideColor: undefined }));
11175
7891
  }, className: 'cursor-pointer w-4 h-4 inline-block ml-2 -mt-2' })
11176
- : ''] }), jsxRuntimeExports.jsxs("div", { children: [jsxRuntimeExports.jsx(axiomUiUtilities.Checkbox, { id: 'lineDash', testId: 'lineDash', label: 'Line dash', value: (plotGroupSettings === null || plotGroupSettings === void 0 ? void 0 : plotGroupSettings.lineDash) !== undefined, onChange: (e) => {
7892
+ : ''] }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(axiomUiUtilities.Checkbox, { id: 'lineDash', testId: 'lineDash', label: 'Line dash', value: (plotGroupSettings === null || plotGroupSettings === void 0 ? void 0 : plotGroupSettings.lineDash) !== undefined, onChange: (e) => {
11177
7893
  if (e) {
11178
7894
  setPlotGroupSettings(Object.assign(Object.assign({}, plotGroupSettings), { lineDash: [2, 2] }));
11179
7895
  }
@@ -11181,7 +7897,7 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
11181
7897
  setPlotGroupSettings(Object.assign(Object.assign({}, plotGroupSettings), { lineDash: undefined }));
11182
7898
  }
11183
7899
  } }), (plotGroupSettings === null || plotGroupSettings === void 0 ? void 0 : plotGroupSettings.lineDash) !== undefined
11184
- ? jsxRuntimeExports.jsx(NumericControl, { label: 'Line dash', minMax: [0, 30], step: 0.5, updateOnSlide: false, valueState: [
7900
+ ? jsxRuntime.jsx(NumericControl, { label: 'Line dash', minMax: [0, 30], step: 0.5, updateOnSlide: false, valueState: [
11185
7901
  plotGroupSettings.lineDash[0],
11186
7902
  (e) => {
11187
7903
  setPlotGroupSettings(Object.assign(Object.assign({}, plotGroupSettings), { lineDash: [e, e] }));
@@ -11225,22 +7941,22 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
11225
7941
  const ob = makeFlat(combined);
11226
7942
  return `[${String(shortcode)} ${Object.keys(ob).map((key) => `${String(key)}=${String(ob[key])}`).join(' ')}]`;
11227
7943
  };
11228
- return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsxs("div", { className: 'flex gap-4 overflow-auto', children: [jsxRuntimeExports.jsxs("div", { className: columnClassname, children: [jsxRuntimeExports.jsx("h4", { className: 'font-bold', children: "Margins" }), jsxRuntimeExports.jsx(MarginControl, { marginState: [
7944
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: 'flex gap-4 overflow-auto', children: [jsxRuntime.jsxs("div", { className: columnClassname, children: [jsxRuntime.jsx("h4", { className: 'font-bold', children: "Margins" }), jsxRuntime.jsx(MarginControl, { marginState: [
11229
7945
  (chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.margin) !== undefined ? chartSettings.margin : { left: 0, right: 0, top: 0, bottom: 0 },
11230
7946
  (s) => {
11231
7947
  setChartSettings(Object.assign(Object.assign({}, chartSettings), { margin: s }));
11232
7948
  }
11233
- ] })] }), jsxRuntimeExports.jsxs("div", { className: columnClassname, children: [jsxRuntimeExports.jsx("h4", { className: 'font-bold', children: "Height" }), jsxRuntimeExports.jsx(NumericControl, { valueState: [
7949
+ ] })] }), jsxRuntime.jsxs("div", { className: columnClassname, children: [jsxRuntime.jsx("h4", { className: 'font-bold', children: "Height" }), jsxRuntime.jsx(NumericControl, { valueState: [
11234
7950
  (chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.height) !== undefined ? chartSettings.height : 300,
11235
7951
  (s) => {
11236
7952
  setChartSettings(Object.assign(Object.assign({}, chartSettings), { height: s }));
11237
7953
  }
11238
- ], minMax: [100, 900] }), jsxRuntimeExports.jsx("h4", { className: 'font-bold', children: "Time slider" }), jsxRuntimeExports.jsx(axiomUiUtilities.Checkbox, { id: 'timeSlider', testId: 'timeSlider', label: 'Include time slider', value: (chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.excludeTimeSlider) !== undefined ? !chartSettings.excludeTimeSlider : true, onChange: (e) => {
7954
+ ], minMax: [100, 900] }), jsxRuntime.jsx("h4", { className: 'font-bold', children: "Time slider" }), jsxRuntime.jsx(axiomUiUtilities.Checkbox, { id: 'timeSlider', testId: 'timeSlider', label: 'Include time slider', value: (chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.excludeTimeSlider) !== undefined ? !chartSettings.excludeTimeSlider : true, onChange: (e) => {
11239
7955
  setChartSettings(Object.assign(Object.assign({}, chartSettings), { excludeTimeSlider: !e }));
11240
- } }), jsxRuntimeExports.jsx("h3", { className: 'font-bold', children: "Axes" }), jsxRuntimeExports.jsx(AxisSettings, { label: "Y Axis", axisState: [
7956
+ } }), jsxRuntime.jsx("h3", { className: 'font-bold', children: "Axes" }), jsxRuntime.jsx(AxisSettings, { label: "Y Axis", axisState: [
11241
7957
  ((_a = chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.axes) === null || _a === void 0 ? void 0 : _a.y) !== undefined ? chartSettings.axes.y : {},
11242
7958
  (s) => { setChartSettings(Object.assign(Object.assign({}, chartSettings), { axes: Object.assign(Object.assign({}, chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.axes), { y: s }) })); }
11243
- ] }), jsxRuntimeExports.jsx(AxisSettings, { label: "X Axis", axisState: [
7959
+ ] }), jsxRuntime.jsx(AxisSettings, { label: "X Axis", axisState: [
11244
7960
  ((_b = chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.axes) === null || _b === void 0 ? void 0 : _b.x) !== undefined ? chartSettings.axes.x : {},
11245
7961
  (s) => {
11246
7962
  setChartSettings(Object.assign(Object.assign({}, chartSettings), { axes: Object.assign(Object.assign({}, chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.axes), { x: s }) }));
@@ -11248,7 +7964,7 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
11248
7964
  ] })] }), (chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.plotGroupSettings) !== undefined
11249
7965
  ? Object.keys(chartSettings.plotGroupSettings).map((key) => {
11250
7966
  var _a, _b;
11251
- return (jsxRuntimeExports.jsxs("div", { className: columnClassname, children: [jsxRuntimeExports.jsx("h4", { className: 'font-bold', children: ((_a = chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.plotGroupSettings) === null || _a === void 0 ? void 0 : _a[key].label) !== undefined ? chartSettings.plotGroupSettings[key].label : key }), jsxRuntimeExports.jsx(PlotGroupSettingsControl, { plotGroupSettingsState: [
7967
+ return (jsxRuntime.jsxs("div", { className: columnClassname, children: [jsxRuntime.jsx("h4", { className: 'font-bold', children: ((_a = chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.plotGroupSettings) === null || _a === void 0 ? void 0 : _a[key].label) !== undefined ? chartSettings.plotGroupSettings[key].label : key }), jsxRuntime.jsx(PlotGroupSettingsControl, { plotGroupSettingsState: [
11252
7968
  (_b = chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.plotGroupSettings) === null || _b === void 0 ? void 0 : _b[key],
11253
7969
  (s) => {
11254
7970
  const newPlotGroupSettings = Object.assign({}, chartSettings.plotGroupSettings);
@@ -11258,9 +7974,9 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
11258
7974
  ] })] }, key));
11259
7975
  })
11260
7976
  : ''] }), chartSettings !== undefined && shortcode !== undefined && requiredShortCodeAttributes !== undefined
11261
- ? jsxRuntimeExports.jsxs("div", { className: 'mt-4', children: [jsxRuntimeExports.jsx("h3", { className: 'font-bold mb-2', children: "Wordpress shortcode" }), jsxRuntimeExports.jsxs("div", { className: "relative", children: [jsxRuntimeExports.jsx(CopyIcon, { className: 'absolute top-4 left-4 w-10 h-10 text-slate-600 cursor-pointer z-20', onClick: () => {
7977
+ ? jsxRuntime.jsxs("div", { className: 'mt-4', children: [jsxRuntime.jsx("h3", { className: 'font-bold mb-2', children: "Wordpress shortcode" }), jsxRuntime.jsxs("div", { className: "relative", children: [jsxRuntime.jsx(CopyIcon, { className: 'absolute top-4 left-4 w-10 h-10 text-slate-600 cursor-pointer z-20', onClick: () => {
11262
7978
  copy(makeShortCode(Object.assign({}, chartSettings)));
11263
- } }), jsxRuntimeExports.jsx(axiomUiUtilities.TextArea, { id: 'shortCode', testId: 'shortCode', className: 'min-h-[100px]', value: makeShortCode(Object.assign({}, chartSettings)), disabled: true })] })] })
7979
+ } }), jsxRuntime.jsx(axiomUiUtilities.TextArea, { id: 'shortCode', testId: 'shortCode', className: 'min-h-[100px]', value: makeShortCode(Object.assign({}, chartSettings)), disabled: true })] })] })
11264
7980
  : ''] }));
11265
7981
  };
11266
7982
 
@@ -11369,13 +8085,13 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
11369
8085
  }, [xBounds]);
11370
8086
  const [showSettings, setShowSettings] = React.useState(false);
11371
8087
  const settingsDisplay = (chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.includeControls) === true || (chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.includeSettings) === true
11372
- ? jsxRuntimeExports.jsxs("div", { className: 'flex flex-col gap-4 mt-4', children: [(chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.includeControls) === true
11373
- ? jsxRuntimeExports.jsxs("div", { className: 'flex gap-4', children: [((_z = (_y = axisDefinitions.x) === null || _y === void 0 ? void 0 : _y.binningMetadata) === null || _z === void 0 ? void 0 : _z.binState) !== undefined
11374
- ? jsxRuntimeExports.jsxs("div", { className: 'mt-2 px-8', children: [jsxRuntimeExports.jsx("h3", { className: 'font-bold mb-2', children: "Binning" }), jsxRuntimeExports.jsxs("div", { className: 'flex gap-8', children: [jsxRuntimeExports.jsx(BinManager, { binDefinitions: xBinDefinitions, bounds: xBinSelectorBounds, binSettings: axisDefinitions.x.binningMetadata.binState }), ((_1 = (_0 = axisDefinitions.y) === null || _0 === void 0 ? void 0 : _0.binningMetadata) === null || _1 === void 0 ? void 0 : _1.binState) !== undefined && yBinSelectorBounds !== undefined && Object.keys(yBinDefinitions).length > 0
11375
- ? jsxRuntimeExports.jsx(BinManager, { binDefinitions: yBinDefinitions, bounds: yBinSelectorBounds, binSettings: axisDefinitions.y.binningMetadata.binState })
8088
+ ? jsxRuntime.jsxs("div", { className: 'flex flex-col gap-4 mt-4', children: [(chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.includeControls) === true
8089
+ ? jsxRuntime.jsxs("div", { className: 'flex gap-4', children: [((_z = (_y = axisDefinitions.x) === null || _y === void 0 ? void 0 : _y.binningMetadata) === null || _z === void 0 ? void 0 : _z.binState) !== undefined
8090
+ ? jsxRuntime.jsxs("div", { className: 'mt-2 px-8', children: [jsxRuntime.jsx("h3", { className: 'font-bold mb-2', children: "Binning" }), jsxRuntime.jsxs("div", { className: 'flex gap-8', children: [jsxRuntime.jsx(BinManager, { binDefinitions: xBinDefinitions, bounds: xBinSelectorBounds, binSettings: axisDefinitions.x.binningMetadata.binState }), ((_1 = (_0 = axisDefinitions.y) === null || _0 === void 0 ? void 0 : _0.binningMetadata) === null || _1 === void 0 ? void 0 : _1.binState) !== undefined && yBinSelectorBounds !== undefined && Object.keys(yBinDefinitions).length > 0
8091
+ ? jsxRuntime.jsx(BinManager, { binDefinitions: yBinDefinitions, bounds: yBinSelectorBounds, binSettings: axisDefinitions.y.binningMetadata.binState })
11376
8092
  : ''] })] })
11377
8093
  : '', (xDomain === null || xDomain === void 0 ? void 0 : xDomain[0]) instanceof Date
11378
- ? jsxRuntimeExports.jsxs("div", { className: 'mt-2 px-8', children: [jsxRuntimeExports.jsx("h3", { className: 'font-bold mb-2', children: "Default time period" }), jsxRuntimeExports.jsx(axiomUiUtilities.SelectInput, { id: 'timePeriod', testId: 'timePeriod', size: 'xs', className: 'min-w-[200px]', options: [
8094
+ ? jsxRuntime.jsxs("div", { className: 'mt-2 px-8', children: [jsxRuntime.jsx("h3", { className: 'font-bold mb-2', children: "Default time period" }), jsxRuntime.jsx(axiomUiUtilities.SelectInput, { id: 'timePeriod', testId: 'timePeriod', size: 'xs', className: 'min-w-[200px]', options: [
11379
8095
  {
11380
8096
  value: 'all',
11381
8097
  label: 'All'
@@ -11428,7 +8144,7 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
11428
8144
  } })] })
11429
8145
  : ''] })
11430
8146
  : '', (chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.includeSettings) === true
11431
- ? jsxRuntimeExports.jsx("div", { className: 'mt-2 p-4', children: jsxRuntimeExports.jsx(ChartSettingsControl, { chartSettingsState: chartSettingsState, shortcode: shortcode, requiredShortCodeAttributes: requiredShortCodeAttributes }) })
8147
+ ? jsxRuntime.jsx("div", { className: 'mt-2 p-4', children: jsxRuntime.jsx(ChartSettingsControl, { chartSettingsState: chartSettingsState, shortcode: shortcode, requiredShortCodeAttributes: requiredShortCodeAttributes }) })
11432
8148
  : ''] })
11433
8149
  : '';
11434
8150
  const props = {
@@ -11439,7 +8155,7 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
11439
8155
  zBin,
11440
8156
  zBounds
11441
8157
  };
11442
- return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsxs("div", { className: 'mt-4 relative', children: [jsxRuntimeExports.jsx(PlotLoader, { chartSettingsState: chartSettingsState, plotLoaders: plotMethods
8158
+ return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("div", { className: 'mt-4 relative', children: [jsxRuntime.jsx(PlotLoader, { chartSettingsState: chartSettingsState, plotLoaders: plotMethods
11443
8159
  /* .filter(p => {
11444
8160
  if (p.exclude === true) {
11445
8161
  return false
@@ -11457,7 +8173,7 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
11457
8173
  fetchAndParse: p.createFetchAndParse(props),
11458
8174
  makePlots: p.makePlots
11459
8175
  })), tempXBounds: tempXBounds }), (chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.excludeTimeSlider) !== true
11460
- ? jsxRuntimeExports.jsxs("div", { style: { marginLeft: margin.left, marginRight: margin.right }, children: [jsxRuntimeExports.jsx(axiomUiUtilities.SliderRange, { id: "timeRange", testId: 'timeRange', min: +sliderMin, max: +sliderMax, step: xBin !== undefined
8176
+ ? jsxRuntime.jsxs("div", { style: { marginLeft: margin.left, marginRight: margin.right }, children: [jsxRuntime.jsx(axiomUiUtilities.SliderRange, { id: "timeRange", testId: 'timeRange', min: +sliderMin, max: +sliderMax, step: xBin !== undefined
11461
8177
  ? xBinDefinitions[xBin]
11462
8178
  : defaultXBin !== undefined && xBinDefinitions[defaultXBin] !== undefined
11463
8179
  ? xBinDefinitions[defaultXBin]
@@ -11473,13 +8189,13 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
11473
8189
  new Date(v[1])
11474
8190
  ]);
11475
8191
  } }), (chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.includeDebug) === true
11476
- ? jsxRuntimeExports.jsxs("div", { className: 'flex text-xs p-4 gap-4', children: [jsxRuntimeExports.jsx("p", { className: ' text-slate-400', children: [sliderMin, sliderMax].map(d => typeof d === 'object' ? (d).toISOString() : d).join(' to ') }), jsxRuntimeExports.jsx("p", { className: ' text-slate-600', children: sliderRange.map(d => new Date(d).toISOString()).join(' to ') }), jsxRuntimeExports.jsx("p", { className: 'text-slat-1000', children: xBounds.map(d => typeof d === 'object' ? (d).toISOString() : d).join(' to ') })] })
8192
+ ? jsxRuntime.jsxs("div", { className: 'flex text-xs p-4 gap-4', children: [jsxRuntime.jsx("p", { className: ' text-slate-400', children: [sliderMin, sliderMax].map(d => typeof d === 'object' ? (d).toISOString() : d).join(' to ') }), jsxRuntime.jsx("p", { className: ' text-slate-600', children: sliderRange.map(d => new Date(d).toISOString()).join(' to ') }), jsxRuntime.jsx("p", { className: 'text-slat-1000', children: xBounds.map(d => typeof d === 'object' ? (d).toISOString() : d).join(' to ') })] })
11477
8193
  : ''] })
11478
8194
  : '', (chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.includeControls) === false
11479
- ? jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {})
8195
+ ? jsxRuntime.jsx(jsxRuntime.Fragment, {})
11480
8196
  : (chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.settingsAsModal) === true && settingsDisplay !== ''
11481
- ? jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(GearIcon, { className: 'w-6 h-6 cursor-pointer absolute -mt-10 top-0 right-5', onClick: () => { setShowSettings(!showSettings); } }), showSettings
11482
- ? jsxRuntimeExports.jsxs("div", { className: 'fixed bottom-0 left-20 right-20 shadow-xl bg-white z-50 pt-10 border-2 rounded-lg', children: [jsxRuntimeExports.jsx(Cross2Icon, { className: 'w-6 h-6 cursor-pointer absolute top-2 right-2', onClick: () => { setShowSettings(!showSettings); } }), jsxRuntimeExports.jsx("div", { className: 'max-h-[500px] overflow-auto', children: settingsDisplay })] })
8197
+ ? jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(GearIcon, { className: 'w-6 h-6 cursor-pointer absolute -mt-10 top-0 right-5', onClick: () => { setShowSettings(!showSettings); } }), showSettings
8198
+ ? jsxRuntime.jsxs("div", { className: 'fixed bottom-0 left-20 right-20 shadow-xl bg-white z-50 pt-10 border-2 rounded-lg', children: [jsxRuntime.jsx(Cross2Icon, { className: 'w-6 h-6 cursor-pointer absolute top-2 right-2', onClick: () => { setShowSettings(!showSettings); } }), jsxRuntime.jsx("div", { className: 'max-h-[500px] overflow-auto', children: settingsDisplay })] })
11483
8199
  : ''] })
11484
8200
  : settingsDisplay] }) }));
11485
8201
  };
@@ -11498,8 +8214,8 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
11498
8214
  timeSeriesStats: Object.assign({ label: 'Time series stats', include: true }, (_e = (_d = props.defaultChartSettings) === null || _d === void 0 ? void 0 : _d.plotGroupSettings) === null || _e === void 0 ? void 0 : _e.timeSeriesStats)
11499
8215
  } });
11500
8216
  const chartSettingsState = React.useState(Object.assign({}, initialChartSettings));
11501
- const queryClient = new QueryClient();
11502
- return (jsxRuntimeExports.jsx(QueryClientProvider, { client: queryClient, children: jsxRuntimeExports.jsx(StationMetadataLoader, { stationId: stationId, sensorPlot: Object.assign(Object.assign({}, props), { parameterGroupId,
8217
+ const queryClient = new reactQuery.QueryClient();
8218
+ return (jsxRuntime.jsx(reactQuery.QueryClientProvider, { client: queryClient, children: jsxRuntime.jsx(StationMetadataLoader, { stationId: stationId, sensorPlot: Object.assign(Object.assign({}, props), { parameterGroupId,
11503
8219
  parameterGroupIds }), Component: PlotControls, chartSettingsState: chartSettingsState }) }));
11504
8220
  };
11505
8221
 
@@ -11730,7 +8446,7 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
11730
8446
  const datasetToUse = d !== null ? d : dataset;
11731
8447
  const variableToUse = v !== null ? v : variable;
11732
8448
  const [statistic] = React.useState('mean');
11733
- const { data, isLoading, isError } = useQuery({
8449
+ const { data, isLoading, isError } = reactQuery.useQuery({
11734
8450
  queryKey: [`focsle-datasets:${datasetToUse}:${variableToUse}`],
11735
8451
  queryFn: (o) => __awaiter(void 0, void 0, void 0, function* () {
11736
8452
  const details = yield getFocsleDataset(datasetToUse);
@@ -11770,17 +8486,17 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
11770
8486
  return ((xredsMetadata === null || xredsMetadata === void 0 ? void 0 : xredsMetadata.start_time) !== undefined && (xredsMetadata === null || xredsMetadata === void 0 ? void 0 : xredsMetadata.end_time) !== undefined) || ((data === null || data === void 0 ? void 0 : data.attributes.time_coverage_start) !== undefined && data.attributes.time_coverage_end !== undefined);
11771
8487
  };
11772
8488
  return (isError
11773
- ? jsxRuntimeExports.jsxs("p", { className: 'text-lg font-bold text-red-600', children: ["Error loading dataset: ", datasetToUse] })
8489
+ ? jsxRuntime.jsxs("p", { className: 'text-lg font-bold text-red-600', children: ["Error loading dataset: ", datasetToUse] })
11774
8490
  : isLoading || data === undefined
11775
- ? jsxRuntimeExports.jsx(axiomUiUtilities.Loader, {})
11776
- : jsxRuntimeExports.jsx("div", { children: Component !== undefined
11777
- ? jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [(chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.excludeTitle) !== true
11778
- ? jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("h1", { className: 'mb-1 text-lg', children: datasetToUse }), jsxRuntimeExports.jsxs("h2", { className: 'mb-2 font-bold text-2xl', children: [(_c = (_b = (_a = data.variables) === null || _a === void 0 ? void 0 : _a[variableToUse]) === null || _b === void 0 ? void 0 : _b.attributes) === null || _c === void 0 ? void 0 : _c.long_name, " ", ((_f = (_e = (_d = data.variables) === null || _d === void 0 ? void 0 : _d[variableToUse]) === null || _e === void 0 ? void 0 : _e.attributes) === null || _f === void 0 ? void 0 : _f.units) !== undefined ? ` (${(_h = (_g = data.variables) === null || _g === void 0 ? void 0 : _g[variableToUse]) === null || _h === void 0 ? void 0 : _h.attributes.units})` : '', " (", selectedZ, ")"] }), jsxRuntimeExports.jsxs("h3", { children: ["at ", geometry.type === 'Point'
8491
+ ? jsxRuntime.jsx(axiomUiUtilities.Loader, {})
8492
+ : jsxRuntime.jsx("div", { children: Component !== undefined
8493
+ ? jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [(chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.excludeTitle) !== true
8494
+ ? jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("h1", { className: 'mb-1 text-lg', children: datasetToUse }), jsxRuntime.jsxs("h2", { className: 'mb-2 font-bold text-2xl', children: [(_c = (_b = (_a = data.variables) === null || _a === void 0 ? void 0 : _a[variableToUse]) === null || _b === void 0 ? void 0 : _b.attributes) === null || _c === void 0 ? void 0 : _c.long_name, " ", ((_f = (_e = (_d = data.variables) === null || _d === void 0 ? void 0 : _d[variableToUse]) === null || _e === void 0 ? void 0 : _e.attributes) === null || _f === void 0 ? void 0 : _f.units) !== undefined ? ` (${(_h = (_g = data.variables) === null || _g === void 0 ? void 0 : _g[variableToUse]) === null || _h === void 0 ? void 0 : _h.attributes.units})` : '', " (", selectedZ, ")"] }), jsxRuntime.jsxs("h3", { children: ["at ", geometry.type === 'Point'
11779
8495
  ? geometry.coordinates.join(', ')
11780
8496
  : 'polygon selection', " (", activeBin !== null && activeBin !== void 0 ? activeBin : 'NA', ")"] })] })
11781
8497
  : '', !hasTimeDomain()
11782
- ? jsxRuntimeExports.jsxs("p", { className: 'text-center h-full p-10 bg-slate-100', children: ["Error: ", jsxRuntimeExports.jsx("pre", { className: 'text-rose-900 inline', children: "time_coverage_start" }), " and/or ", jsxRuntimeExports.jsx("pre", { className: 'text-rose-900 inline-flex', children: "time_coverage_end" }), " metadata missing"] })
11783
- : jsxRuntimeExports.jsx(Component, { shortcode: 'axiom_virtual_sensor', requiredShortCodeAttributes: {
8498
+ ? jsxRuntime.jsxs("p", { className: 'text-center h-full p-10 bg-slate-100', children: ["Error: ", jsxRuntime.jsx("pre", { className: 'text-rose-900 inline', children: "time_coverage_start" }), " and/or ", jsxRuntime.jsx("pre", { className: 'text-rose-900 inline-flex', children: "time_coverage_end" }), " metadata missing"] })
8499
+ : jsxRuntime.jsx(Component, { shortcode: 'axiom_virtual_sensor', requiredShortCodeAttributes: {
11784
8500
  dataset: datasetToUse,
11785
8501
  variable: variableToUse,
11786
8502
  geometry: typeof geometry === 'string' ? geometry : axiomMaps.encodeMapShape(geometry)
@@ -11902,7 +8618,7 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
11902
8618
  }
11903
8619
  }
11904
8620
  ] })] })
11905
- : jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsxs("h2", { children: ["Dataset: ", datasetToUse] }), jsxRuntimeExports.jsxs("h3", { children: ["Variable: ", (_l = (_k = (_j = data.variables) === null || _j === void 0 ? void 0 : _j[variableToUse]) === null || _k === void 0 ? void 0 : _k.attributes) === null || _l === void 0 ? void 0 : _l.long_name] }), jsxRuntimeExports.jsx("pre", { className: 'p-10 max-h-[300px] overflow-auto bg-slate-200', children: JSON.stringify(data, null, 2) })] }) }));
8621
+ : jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("h2", { children: ["Dataset: ", datasetToUse] }), jsxRuntime.jsxs("h3", { children: ["Variable: ", (_l = (_k = (_j = data.variables) === null || _j === void 0 ? void 0 : _j[variableToUse]) === null || _k === void 0 ? void 0 : _k.attributes) === null || _l === void 0 ? void 0 : _l.long_name] }), jsxRuntime.jsx("pre", { className: 'p-10 max-h-[300px] overflow-auto bg-slate-200', children: JSON.stringify(data, null, 2) })] }) }));
11906
8622
  };
11907
8623
 
11908
8624
  const FocslePlot = (props) => {
@@ -11912,14 +8628,14 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
11912
8628
  timeSeriesStats: Object.assign({ label: 'Time series stats', include: false }, (_d = (_c = props.defaultChartSettings) === null || _c === void 0 ? void 0 : _c.plotGroupSettings) === null || _d === void 0 ? void 0 : _d.timeSeriesStats)
11913
8629
  } });
11914
8630
  const chartSettingsState = React.useState(Object.assign(Object.assign({}, initialChartSettings), props.defaultChartSettings));
11915
- const queryClient = new QueryClient();
8631
+ const queryClient = new reactQuery.QueryClient();
11916
8632
  const decodedMapShape = typeof props.geometry === 'string'
11917
8633
  ? axiomMaps.decodeMapShape(props.geometry)
11918
8634
  : props.geometry;
11919
8635
  if (decodedMapShape === undefined) {
11920
- return (jsxRuntimeExports.jsxs("div", { children: ["Invalid geometry: ", JSON.stringify(props.geometry)] }));
8636
+ return (jsxRuntime.jsxs("div", { children: ["Invalid geometry: ", JSON.stringify(props.geometry)] }));
11921
8637
  }
11922
- return (jsxRuntimeExports.jsx(QueryClientProvider, { client: queryClient, children: jsxRuntimeExports.jsx(FoclsMetadataLoader, { Component: PlotControls, chartSettingsState: chartSettingsState, geometry: decodedMapShape, variable: props.variable, dataset: props.dataset, selectedZ: props.selectedZ, xredsMetadata: props.xredsMetadata }) }));
8638
+ return (jsxRuntime.jsx(reactQuery.QueryClientProvider, { client: queryClient, children: jsxRuntime.jsx(FoclsMetadataLoader, { Component: PlotControls, chartSettingsState: chartSettingsState, geometry: decodedMapShape, variable: props.variable, dataset: props.dataset, selectedZ: props.selectedZ, xredsMetadata: props.xredsMetadata }) }));
11923
8639
  };
11924
8640
 
11925
8641
  exports.AxiomSensorPlot = SensorPlotDisplay;
@@ -11933,5 +8649,5 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, React, d3Sel
11933
8649
 
11934
8650
  return exports;
11935
8651
 
11936
- })({}, AxiomUIDataServices, d3Array, React, d3Selection, d3, d3Scale, d3Axis, d3Shape, ReactDOM, AxiomUIUtilities, AxiomMaps);
8652
+ })({}, AxiomUIDataServices, d3Array, JSXRuntime, React, d3Selection, d3, d3Scale, d3Axis, d3Shape, ReactDOM, reactQuery, AxiomUIUtilities, AxiomMaps);
11937
8653
  //# sourceMappingURL=browser.js.map