dara-core 1.19.0__py3-none-any.whl → 1.20.0__py3-none-any.whl

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.
Files changed (52) hide show
  1. dara/core/__init__.py +1 -0
  2. dara/core/auth/basic.py +13 -7
  3. dara/core/auth/definitions.py +2 -2
  4. dara/core/auth/utils.py +1 -1
  5. dara/core/base_definitions.py +7 -42
  6. dara/core/data_utils.py +16 -17
  7. dara/core/definitions.py +8 -8
  8. dara/core/interactivity/__init__.py +6 -0
  9. dara/core/interactivity/actions.py +26 -22
  10. dara/core/interactivity/any_data_variable.py +7 -135
  11. dara/core/interactivity/any_variable.py +1 -1
  12. dara/core/interactivity/client_variable.py +71 -0
  13. dara/core/interactivity/data_variable.py +8 -266
  14. dara/core/interactivity/derived_data_variable.py +6 -290
  15. dara/core/interactivity/derived_variable.py +381 -201
  16. dara/core/interactivity/filtering.py +29 -2
  17. dara/core/interactivity/loop_variable.py +2 -2
  18. dara/core/interactivity/non_data_variable.py +5 -68
  19. dara/core/interactivity/plain_variable.py +87 -14
  20. dara/core/interactivity/server_variable.py +325 -0
  21. dara/core/interactivity/state_variable.py +69 -0
  22. dara/core/interactivity/switch_variable.py +15 -15
  23. dara/core/interactivity/tabular_variable.py +94 -0
  24. dara/core/interactivity/url_variable.py +10 -90
  25. dara/core/internal/cache_store/cache_store.py +5 -20
  26. dara/core/internal/dependency_resolution.py +27 -69
  27. dara/core/internal/devtools.py +10 -3
  28. dara/core/internal/execute_action.py +9 -3
  29. dara/core/internal/multi_resource_lock.py +70 -0
  30. dara/core/internal/normalization.py +0 -5
  31. dara/core/internal/pandas_utils.py +105 -3
  32. dara/core/internal/pool/definitions.py +1 -1
  33. dara/core/internal/pool/task_pool.py +9 -6
  34. dara/core/internal/pool/utils.py +19 -14
  35. dara/core/internal/registries.py +3 -2
  36. dara/core/internal/registry.py +1 -1
  37. dara/core/internal/registry_lookup.py +5 -3
  38. dara/core/internal/routing.py +52 -121
  39. dara/core/internal/store.py +2 -29
  40. dara/core/internal/tasks.py +372 -182
  41. dara/core/internal/utils.py +25 -3
  42. dara/core/internal/websocket.py +1 -1
  43. dara/core/js_tooling/js_utils.py +2 -0
  44. dara/core/logging.py +10 -6
  45. dara/core/persistence.py +26 -4
  46. dara/core/umd/dara.core.umd.js +1091 -1469
  47. dara/core/visual/dynamic_component.py +17 -13
  48. {dara_core-1.19.0.dist-info → dara_core-1.20.0.dist-info}/METADATA +11 -11
  49. {dara_core-1.19.0.dist-info → dara_core-1.20.0.dist-info}/RECORD +52 -47
  50. {dara_core-1.19.0.dist-info → dara_core-1.20.0.dist-info}/LICENSE +0 -0
  51. {dara_core-1.19.0.dist-info → dara_core-1.20.0.dist-info}/WHEEL +0 -0
  52. {dara_core-1.19.0.dist-info → dara_core-1.20.0.dist-info}/entry_points.txt +0 -0
@@ -1292,7 +1292,7 @@
1292
1292
  if (null == r2) return {};
1293
1293
  var t2 = {};
1294
1294
  for (var n2 in r2) if ({}.hasOwnProperty.call(r2, n2)) {
1295
- if (e2.includes(n2)) continue;
1295
+ if (-1 !== e2.indexOf(n2)) continue;
1296
1296
  t2[n2] = r2[n2];
1297
1297
  }
1298
1298
  return t2;
@@ -1830,7 +1830,7 @@
1830
1830
  invariant$1();
1831
1831
  };
1832
1832
  }
1833
- function noop$4() {
1833
+ function noop$5() {
1834
1834
  }
1835
1835
  var StaticRouter = /* @__PURE__ */ function(_React$Component) {
1836
1836
  _inheritsLoose$1(StaticRouter2, _React$Component);
@@ -1847,10 +1847,10 @@
1847
1847
  return _this.navigateTo(location2, "REPLACE");
1848
1848
  };
1849
1849
  _this.handleListen = function() {
1850
- return noop$4;
1850
+ return noop$5;
1851
1851
  };
1852
1852
  _this.handleBlock = function() {
1853
- return noop$4;
1853
+ return noop$5;
1854
1854
  };
1855
1855
  return _this;
1856
1856
  }
@@ -2761,7 +2761,7 @@
2761
2761
  };
2762
2762
  var LEAF = 1;
2763
2763
  var COLLISION = 2;
2764
- var INDEX = 3;
2764
+ var INDEX2 = 3;
2765
2765
  var ARRAY = 4;
2766
2766
  var empty = {
2767
2767
  __hamt_isEmpty: true
@@ -2790,7 +2790,7 @@
2790
2790
  };
2791
2791
  var IndexedNode = function IndexedNode2(edit, mask, children) {
2792
2792
  return {
2793
- type: INDEX,
2793
+ type: INDEX2,
2794
2794
  edit,
2795
2795
  mask,
2796
2796
  children,
@@ -2993,7 +2993,7 @@
2993
2993
  }
2994
2994
  return alt;
2995
2995
  }
2996
- case INDEX: {
2996
+ case INDEX2: {
2997
2997
  var frag = hashFragment(shift2, hash22);
2998
2998
  var bit = toBitmap(frag);
2999
2999
  if (node.mask & bit) {
@@ -3146,7 +3146,7 @@
3146
3146
  };
3147
3147
  case COLLISION:
3148
3148
  case ARRAY:
3149
- case INDEX:
3149
+ case INDEX2:
3150
3150
  var children = node.children;
3151
3151
  return lazyVisitChildren(children.length, children, 0, f, k);
3152
3152
  default:
@@ -12446,14 +12446,14 @@
12446
12446
  function _nonIterableRest$2() {
12447
12447
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
12448
12448
  }
12449
- var noop$3 = function noop2() {
12449
+ var noop$4 = function noop2() {
12450
12450
  };
12451
12451
  var _WINDOW = {};
12452
12452
  var _DOCUMENT = {};
12453
12453
  var _MUTATION_OBSERVER = null;
12454
12454
  var _PERFORMANCE = {
12455
- mark: noop$3,
12456
- measure: noop$3
12455
+ mark: noop$4,
12456
+ measure: noop$4
12457
12457
  };
12458
12458
  try {
12459
12459
  if (typeof window !== "undefined") _WINDOW = window;
@@ -15789,7 +15789,7 @@
15789
15789
  }
15790
15790
  });
15791
15791
  }
15792
- function noop$2() {
15792
+ function noop$3() {
15793
15793
  }
15794
15794
  function errorContext(cb) {
15795
15795
  {
@@ -15929,9 +15929,9 @@
15929
15929
  }
15930
15930
  var EMPTY_OBSERVER = {
15931
15931
  closed: true,
15932
- next: noop$2,
15932
+ next: noop$3,
15933
15933
  error: defaultErrorHandler,
15934
- complete: noop$2
15934
+ complete: noop$3
15935
15935
  };
15936
15936
  var observable = function() {
15937
15937
  return typeof Symbol === "function" && Symbol.observable || "@@observable";
@@ -19574,6 +19574,7 @@
19574
19574
  }
19575
19575
  return value instanceof ShadowRoot || value instanceof getWindow$1(value).ShadowRoot;
19576
19576
  }
19577
+ const invalidOverflowDisplayValues = /* @__PURE__ */ new Set(["inline", "contents"]);
19577
19578
  function isOverflowElement(element) {
19578
19579
  const {
19579
19580
  overflow,
@@ -19581,24 +19582,29 @@
19581
19582
  overflowY,
19582
19583
  display
19583
19584
  } = getComputedStyle$2(element);
19584
- return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
19585
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
19585
19586
  }
19587
+ const tableElements = /* @__PURE__ */ new Set(["table", "td", "th"]);
19586
19588
  function isTableElement$1(element) {
19587
- return ["table", "td", "th"].includes(getNodeName$1(element));
19589
+ return tableElements.has(getNodeName$1(element));
19588
19590
  }
19591
+ const topLayerSelectors = [":popover-open", ":modal"];
19589
19592
  function isTopLayer(element) {
19590
- return [":popover-open", ":modal"].some((selector2) => {
19593
+ return topLayerSelectors.some((selector2) => {
19591
19594
  try {
19592
19595
  return element.matches(selector2);
19593
- } catch (e2) {
19596
+ } catch (_e2) {
19594
19597
  return false;
19595
19598
  }
19596
19599
  });
19597
19600
  }
19601
+ const transformProperties = ["transform", "translate", "scale", "rotate", "perspective"];
19602
+ const willChangeValues = ["transform", "translate", "scale", "rotate", "perspective", "filter"];
19603
+ const containValues = ["paint", "layout", "strict", "content"];
19598
19604
  function isContainingBlock(elementOrCss) {
19599
19605
  const webkit = isWebKit();
19600
19606
  const css2 = isElement$1(elementOrCss) ? getComputedStyle$2(elementOrCss) : elementOrCss;
19601
- return css2.transform !== "none" || css2.perspective !== "none" || (css2.containerType ? css2.containerType !== "normal" : false) || !webkit && (css2.backdropFilter ? css2.backdropFilter !== "none" : false) || !webkit && (css2.filter ? css2.filter !== "none" : false) || ["transform", "perspective", "filter"].some((value) => (css2.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css2.contain || "").includes(value));
19607
+ return transformProperties.some((value) => css2[value] ? css2[value] !== "none" : false) || (css2.containerType ? css2.containerType !== "normal" : false) || !webkit && (css2.backdropFilter ? css2.backdropFilter !== "none" : false) || !webkit && (css2.filter ? css2.filter !== "none" : false) || willChangeValues.some((value) => (css2.willChange || "").includes(value)) || containValues.some((value) => (css2.contain || "").includes(value));
19602
19608
  }
19603
19609
  function getContainingBlock$1(element) {
19604
19610
  let currentNode = getParentNode$1(element);
@@ -19616,8 +19622,9 @@
19616
19622
  if (typeof CSS === "undefined" || !CSS.supports) return false;
19617
19623
  return CSS.supports("-webkit-backdrop-filter", "none");
19618
19624
  }
19625
+ const lastTraversableNodeNames = /* @__PURE__ */ new Set(["html", "body", "#document"]);
19619
19626
  function isLastTraversableNode(node) {
19620
- return ["html", "body", "#document"].includes(getNodeName$1(node));
19627
+ return lastTraversableNodeNames.has(getNodeName$1(node));
19621
19628
  }
19622
19629
  function getComputedStyle$2(element) {
19623
19630
  return getWindow$1(element).getComputedStyle(element);
@@ -19817,8 +19824,9 @@
19817
19824
  function getAxisLength(axis) {
19818
19825
  return axis === "y" ? "height" : "width";
19819
19826
  }
19827
+ const yAxisSides = /* @__PURE__ */ new Set(["top", "bottom"]);
19820
19828
  function getSideAxis(placement) {
19821
- return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x";
19829
+ return yAxisSides.has(getSide(placement)) ? "y" : "x";
19822
19830
  }
19823
19831
  function getAlignmentAxis(placement) {
19824
19832
  return getOppositeAxis(getSideAxis(placement));
@@ -19843,19 +19851,19 @@
19843
19851
  function getOppositeAlignmentPlacement(placement) {
19844
19852
  return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]);
19845
19853
  }
19854
+ const lrPlacement = ["left", "right"];
19855
+ const rlPlacement = ["right", "left"];
19856
+ const tbPlacement = ["top", "bottom"];
19857
+ const btPlacement = ["bottom", "top"];
19846
19858
  function getSideList(side, isStart, rtl) {
19847
- const lr = ["left", "right"];
19848
- const rl = ["right", "left"];
19849
- const tb = ["top", "bottom"];
19850
- const bt2 = ["bottom", "top"];
19851
19859
  switch (side) {
19852
19860
  case "top":
19853
19861
  case "bottom":
19854
- if (rtl) return isStart ? rl : lr;
19855
- return isStart ? lr : rl;
19862
+ if (rtl) return isStart ? rlPlacement : lrPlacement;
19863
+ return isStart ? lrPlacement : rlPlacement;
19856
19864
  case "left":
19857
19865
  case "right":
19858
- return isStart ? tb : bt2;
19866
+ return isStart ? tbPlacement : btPlacement;
19859
19867
  default:
19860
19868
  return [];
19861
19869
  }
@@ -20617,15 +20625,20 @@
20617
20625
  const nextIndex2 = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
20618
20626
  const nextPlacement = placements2[nextIndex2];
20619
20627
  if (nextPlacement) {
20620
- return {
20621
- data: {
20622
- index: nextIndex2,
20623
- overflows: overflowsData
20624
- },
20625
- reset: {
20626
- placement: nextPlacement
20627
- }
20628
- };
20628
+ const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false;
20629
+ if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis
20630
+ // overflows the main axis.
20631
+ overflowsData.every((d2) => d2.overflows[0] > 0 && getSideAxis(d2.placement) === initialSideAxis)) {
20632
+ return {
20633
+ data: {
20634
+ index: nextIndex2,
20635
+ overflows: overflowsData
20636
+ },
20637
+ reset: {
20638
+ placement: nextPlacement
20639
+ }
20640
+ };
20641
+ }
20629
20642
  }
20630
20643
  let resetPlacement = (_overflowsData$filter = overflowsData.filter((d2) => d2.overflows[0] <= 0).sort((a2, b2) => a2.overflows[1] - b2.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
20631
20644
  if (!resetPlacement) {
@@ -20663,6 +20676,7 @@
20663
20676
  }
20664
20677
  };
20665
20678
  };
20679
+ const originSides = /* @__PURE__ */ new Set(["left", "top"]);
20666
20680
  async function convertValueToCoords(state, options) {
20667
20681
  const {
20668
20682
  placement,
@@ -20673,7 +20687,7 @@
20673
20687
  const side = getSide(placement);
20674
20688
  const alignment = getAlignment(placement);
20675
20689
  const isVertical = getSideAxis(placement) === "y";
20676
- const mainAxisMulti = ["left", "top"].includes(side) ? -1 : 1;
20690
+ const mainAxisMulti = originSides.has(side) ? -1 : 1;
20677
20691
  const crossAxisMulti = rtl && isVertical ? -1 : 1;
20678
20692
  const rawValue = evaluate(options, state);
20679
20693
  let {
@@ -21103,6 +21117,7 @@
21103
21117
  y
21104
21118
  };
21105
21119
  }
21120
+ const absoluteOrFixed = /* @__PURE__ */ new Set(["absolute", "fixed"]);
21106
21121
  function getInnerBoundingClientRect$1(element, strategy) {
21107
21122
  const clientRect = getBoundingClientRect$1(element, true, strategy === "fixed");
21108
21123
  const top2 = clientRect.top + element.clientTop;
@@ -21160,7 +21175,7 @@
21160
21175
  if (!currentNodeIsContaining && computedStyle.position === "fixed") {
21161
21176
  currentContainingBlockComputedStyle = null;
21162
21177
  }
21163
- const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
21178
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
21164
21179
  if (shouldDropCurrentNode) {
21165
21180
  result = result.filter((ancestor) => ancestor !== currentNode);
21166
21181
  } else {
@@ -21216,6 +21231,9 @@
21216
21231
  scrollTop: 0
21217
21232
  };
21218
21233
  const offsets = createCoords(0);
21234
+ function setLeftRTLScrollbarOffset() {
21235
+ offsets.x = getWindowScrollBarX$1(documentElement);
21236
+ }
21219
21237
  if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
21220
21238
  if (getNodeName$1(offsetParent) !== "body" || isOverflowElement(documentElement)) {
21221
21239
  scroll = getNodeScroll$1(offsetParent);
@@ -21225,9 +21243,12 @@
21225
21243
  offsets.x = offsetRect.x + offsetParent.clientLeft;
21226
21244
  offsets.y = offsetRect.y + offsetParent.clientTop;
21227
21245
  } else if (documentElement) {
21228
- offsets.x = getWindowScrollBarX$1(documentElement);
21246
+ setLeftRTLScrollbarOffset();
21229
21247
  }
21230
21248
  }
21249
+ if (isFixed && !isOffsetParentAnElement && documentElement) {
21250
+ setLeftRTLScrollbarOffset();
21251
+ }
21231
21252
  const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
21232
21253
  const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
21233
21254
  const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
@@ -21307,6 +21328,9 @@
21307
21328
  isElement: isElement$1,
21308
21329
  isRTL
21309
21330
  };
21331
+ function rectsAreEqual(a2, b2) {
21332
+ return a2.x === b2.x && a2.y === b2.y && a2.width === b2.width && a2.height === b2.height;
21333
+ }
21310
21334
  function observeMove(element, onMove) {
21311
21335
  let io = null;
21312
21336
  let timeoutId2;
@@ -21325,12 +21349,13 @@
21325
21349
  threshold = 1;
21326
21350
  }
21327
21351
  cleanup();
21352
+ const elementRectForRootMargin = element.getBoundingClientRect();
21328
21353
  const {
21329
21354
  left: left2,
21330
21355
  top: top2,
21331
21356
  width,
21332
21357
  height
21333
- } = element.getBoundingClientRect();
21358
+ } = elementRectForRootMargin;
21334
21359
  if (!skip) {
21335
21360
  onMove();
21336
21361
  }
@@ -21361,6 +21386,9 @@
21361
21386
  refresh(false, ratio);
21362
21387
  }
21363
21388
  }
21389
+ if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
21390
+ refresh();
21391
+ }
21364
21392
  isFirstUpdate = false;
21365
21393
  }
21366
21394
  try {
@@ -21369,7 +21397,7 @@
21369
21397
  // Handle <iframe>s
21370
21398
  root: root.ownerDocument
21371
21399
  });
21372
- } catch (e2) {
21400
+ } catch (_e2) {
21373
21401
  io = new IntersectionObserver(handleObserve, options);
21374
21402
  }
21375
21403
  io.observe(element);
@@ -21424,7 +21452,7 @@
21424
21452
  }
21425
21453
  function frameLoop() {
21426
21454
  const nextRefRect = getBoundingClientRect$1(reference2);
21427
- if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
21455
+ if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
21428
21456
  update();
21429
21457
  }
21430
21458
  prevRefRect = nextRefRect;
@@ -21466,7 +21494,10 @@
21466
21494
  platform: platformWithCache
21467
21495
  });
21468
21496
  };
21469
- var index$2 = typeof document !== "undefined" ? React$1.useLayoutEffect : React$1.useEffect;
21497
+ var isClient = typeof document !== "undefined";
21498
+ var noop$2 = function noop2() {
21499
+ };
21500
+ var index$2 = isClient ? React$1.useLayoutEffect : noop$2;
21470
21501
  function deepEqual(a2, b2) {
21471
21502
  if (a2 === b2) {
21472
21503
  return true;
@@ -22045,11 +22076,11 @@
22045
22076
  performedPointerEventsMutationRef.current = false;
22046
22077
  }
22047
22078
  });
22079
+ const isClickLikeOpenEvent = useEffectEvent(() => {
22080
+ return dataRef.current.openEvent ? ["click", "mousedown"].includes(dataRef.current.openEvent.type) : false;
22081
+ });
22048
22082
  React__namespace.useEffect(() => {
22049
22083
  if (!enabled) return;
22050
- function isClickLikeOpenEvent() {
22051
- return dataRef.current.openEvent ? ["click", "mousedown"].includes(dataRef.current.openEvent.type) : false;
22052
- }
22053
22084
  function onMouseEnter(event) {
22054
22085
  clearTimeout(timeoutRef.current);
22055
22086
  blockMouseMoveRef.current = false;
@@ -22063,7 +22094,7 @@
22063
22094
  onOpenChange(true, event, "hover");
22064
22095
  }
22065
22096
  }, openDelay);
22066
- } else {
22097
+ } else if (!open2) {
22067
22098
  onOpenChange(true, event, "hover");
22068
22099
  }
22069
22100
  }
@@ -22085,7 +22116,9 @@
22085
22116
  onClose() {
22086
22117
  clearPointerEvents();
22087
22118
  cleanupMouseMoveHandler();
22088
- closeWithDelay(event, true, "safe-polygon");
22119
+ if (!isClickLikeOpenEvent()) {
22120
+ closeWithDelay(event, true, "safe-polygon");
22121
+ }
22089
22122
  }
22090
22123
  });
22091
22124
  const handler = handlerRef.current;
@@ -22111,7 +22144,9 @@
22111
22144
  onClose() {
22112
22145
  clearPointerEvents();
22113
22146
  cleanupMouseMoveHandler();
22114
- closeWithDelay(event);
22147
+ if (!isClickLikeOpenEvent()) {
22148
+ closeWithDelay(event);
22149
+ }
22115
22150
  }
22116
22151
  })(event);
22117
22152
  }
@@ -22134,7 +22169,7 @@
22134
22169
  ref.removeEventListener("mouseleave", onMouseLeave);
22135
22170
  };
22136
22171
  }
22137
- }, [elements, enabled, context2, mouseOnly, restMs, move, closeWithDelay, cleanupMouseMoveHandler, clearPointerEvents, onOpenChange, open2, openRef, tree, delayRef, handleCloseRef, dataRef]);
22172
+ }, [elements, enabled, context2, mouseOnly, restMs, move, closeWithDelay, cleanupMouseMoveHandler, clearPointerEvents, onOpenChange, open2, openRef, tree, delayRef, handleCloseRef, dataRef, isClickLikeOpenEvent]);
22138
22173
  index$1(() => {
22139
22174
  var _handleCloseRef$curre;
22140
22175
  if (!enabled) return;
@@ -22217,9 +22252,11 @@
22217
22252
  clearTimeout(timeoutRef.current);
22218
22253
  },
22219
22254
  onMouseLeave(event) {
22220
- closeWithDelay(event.nativeEvent, false);
22255
+ if (!isClickLikeOpenEvent()) {
22256
+ closeWithDelay(event.nativeEvent, false);
22257
+ }
22221
22258
  }
22222
- }), [closeWithDelay]);
22259
+ }), [closeWithDelay, isClickLikeOpenEvent]);
22223
22260
  return React__namespace.useMemo(() => enabled ? {
22224
22261
  reference: reference2,
22225
22262
  floating
@@ -22503,7 +22540,8 @@
22503
22540
  event: eventOption = "click",
22504
22541
  toggle = true,
22505
22542
  ignoreMouse = false,
22506
- keyboardHandlers = true
22543
+ keyboardHandlers = true,
22544
+ stickIfOpen = true
22507
22545
  } = props;
22508
22546
  const pointerTypeRef = React__namespace.useRef();
22509
22547
  const didKeyDownRef = React__namespace.useRef(false);
@@ -22516,7 +22554,7 @@
22516
22554
  if (event.button !== 0) return;
22517
22555
  if (eventOption === "click") return;
22518
22556
  if (isMouseLikePointerType(pointerType, true) && ignoreMouse) return;
22519
- if (open2 && toggle && (dataRef.current.openEvent ? dataRef.current.openEvent.type === "mousedown" : true)) {
22557
+ if (open2 && toggle && (dataRef.current.openEvent && stickIfOpen ? dataRef.current.openEvent.type === "mousedown" : true)) {
22520
22558
  onOpenChange(false, event.nativeEvent, "click");
22521
22559
  } else {
22522
22560
  event.preventDefault();
@@ -22530,7 +22568,7 @@
22530
22568
  return;
22531
22569
  }
22532
22570
  if (isMouseLikePointerType(pointerType, true) && ignoreMouse) return;
22533
- if (open2 && toggle && (dataRef.current.openEvent ? dataRef.current.openEvent.type === "click" : true)) {
22571
+ if (open2 && toggle && (dataRef.current.openEvent && stickIfOpen ? dataRef.current.openEvent.type === "click" : true)) {
22534
22572
  onOpenChange(false, event.nativeEvent, "click");
22535
22573
  } else {
22536
22574
  onOpenChange(true, event.nativeEvent, "click");
@@ -22566,7 +22604,7 @@
22566
22604
  }
22567
22605
  }
22568
22606
  }
22569
- }), [dataRef, domReference, eventOption, ignoreMouse, keyboardHandlers, onOpenChange, open2, toggle]);
22607
+ }), [dataRef, domReference, eventOption, ignoreMouse, keyboardHandlers, onOpenChange, open2, stickIfOpen, toggle]);
22570
22608
  return React__namespace.useMemo(() => enabled ? {
22571
22609
  reference: reference2
22572
22610
  } : {}, [enabled, reference2]);
@@ -23906,6 +23944,10 @@
23906
23944
 
23907
23945
  border: none;
23908
23946
  border-radius: 0.25rem;
23947
+
23948
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
23949
+ transition-duration: 150ms;
23950
+ transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
23909
23951
  `;
23910
23952
  function getOutlinedButtonStyle(buttonColor, disabled2, theme2) {
23911
23953
  return `
@@ -32390,6 +32432,112 @@
32390
32432
  cursor: not-allowed;
32391
32433
  color: ${(props) => props.theme.colors.grey2};
32392
32434
  }
32435
+ `;
32436
+ styled.div`
32437
+ overflow: hidden;
32438
+ display: flex;
32439
+ flex-direction: column;
32440
+
32441
+ background-color: ${(props) => props.theme.colors.blue1};
32442
+ border-radius: 4px;
32443
+ outline: none;
32444
+ box-shadow: rgb(0 0 0 / 10%) 0 2px 5px;
32445
+
32446
+ & > button:first-child {
32447
+ border-radius: 4px;
32448
+ }
32449
+
32450
+ &.enter {
32451
+ transition-timing-function: cubic-bezier(0, 0, 0.2, 1);
32452
+ transition-duration: 100ms;
32453
+ transition-property: opacity, transform;
32454
+ }
32455
+
32456
+ &.enter-from {
32457
+ transform: scale(0.95);
32458
+ opacity: 0;
32459
+ }
32460
+
32461
+ &.enter-to {
32462
+ transform: scale(1);
32463
+ opacity: 1;
32464
+ }
32465
+
32466
+ &.leave {
32467
+ transition-timing-function: cubic-bezier(0.4, 0, 1, 1);
32468
+ transition-duration: 75ms;
32469
+ transition-property: opacity, transform;
32470
+ }
32471
+
32472
+ &.leave-from {
32473
+ transform: scale(1);
32474
+ opacity: 1;
32475
+ }
32476
+
32477
+ &.leave-to {
32478
+ transform: scale(0.95);
32479
+ opacity: 0;
32480
+ }
32481
+ `;
32482
+ styled.button`
32483
+ cursor: pointer;
32484
+
32485
+ display: flex;
32486
+ gap: 0.25rem;
32487
+ align-items: center;
32488
+ justify-content: space-between;
32489
+
32490
+ width: 100%;
32491
+ min-width: 160px;
32492
+ height: fit-content;
32493
+ padding: 5px 8px;
32494
+
32495
+ font-size: 0.9rem;
32496
+ color: ${(props) => props.theme.colors.text};
32497
+ white-space: nowrap;
32498
+
32499
+ background-color: ${(props) => props.theme.colors.blue1};
32500
+ border: none;
32501
+ border-radius: 4px;
32502
+ box-shadow: none;
32503
+
32504
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
32505
+ transition-duration: 150ms;
32506
+ transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
32507
+
32508
+ &:hover {
32509
+ background-color: ${(props) => props.theme.colors.grey1};
32510
+ }
32511
+
32512
+ &:active {
32513
+ background-color: ${(props) => props.theme.colors.grey2};
32514
+ }
32515
+
32516
+ &:disabled {
32517
+ cursor: not-allowed;
32518
+ color: ${(props) => props.theme.colors.grey3};
32519
+
32520
+ svg {
32521
+ color: ${(props) => props.theme.colors.grey3};
32522
+ }
32523
+ }
32524
+ `;
32525
+ styled.div`
32526
+ padding: 4px;
32527
+ `;
32528
+ styled.hr`
32529
+ width: 100%;
32530
+ margin: 0.25rem 0;
32531
+ border: none;
32532
+ border-top: 1px solid ${(props) => props.theme.colors.grey2};
32533
+ `;
32534
+ styled.div`
32535
+ display: flex;
32536
+ gap: 0.5rem;
32537
+ width: 100%;
32538
+ `;
32539
+ styled.div`
32540
+ color: ${(props) => props.theme.colors.grey3};
32393
32541
  `;
32394
32542
  var locale$1 = {
32395
32543
  localize: localize$1
@@ -37785,7 +37933,7 @@
37785
37933
  effect,
37786
37934
  data: {}
37787
37935
  };
37788
- var hash$2 = {
37936
+ var hash$1 = {
37789
37937
  left: "right",
37790
37938
  right: "left",
37791
37939
  bottom: "top",
@@ -37793,16 +37941,16 @@
37793
37941
  };
37794
37942
  function getOppositePlacement(placement) {
37795
37943
  return placement.replace(/left|right|bottom|top/g, function(matched) {
37796
- return hash$2[matched];
37944
+ return hash$1[matched];
37797
37945
  });
37798
37946
  }
37799
- var hash$1 = {
37947
+ var hash = {
37800
37948
  start: "end",
37801
37949
  end: "start"
37802
37950
  };
37803
37951
  function getOppositeVariationPlacement(placement) {
37804
37952
  return placement.replace(/start|end/g, function(matched) {
37805
- return hash$1[matched];
37953
+ return hash[matched];
37806
37954
  });
37807
37955
  }
37808
37956
  function getWindowScroll(node) {
@@ -43506,10 +43654,13 @@
43506
43654
  const unpackedItems = React$1.useMemo(() => unpackSectionedList(props.items), [props.items]);
43507
43655
  const [pendingHighlight, setPendingHighlight] = React$1.useState(null);
43508
43656
  const [items, setItems] = React$1.useState(unpackedItems);
43509
- const [inputValue, setInputValue] = React$1.useState((_b = (_a = props.selectedItem) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : "");
43657
+ const [inputValue, setInputValue] = React$1.useState(((_a = props.selectedItem) === null || _a === void 0 ? void 0 : _a.label) && props.selectedItem.label !== "null" ? props.selectedItem.label : (_b = props.placeholder) !== null && _b !== void 0 ? _b : "");
43510
43658
  const [kbdHighlightIdx, setKbdHighlightIdx] = React$1.useState();
43511
43659
  const { selectedItem, isOpen, getMenuProps, getInputProps, getToggleButtonProps, getItemProps, setHighlightedIndex } = useCombobox(Object.assign(Object.assign(Object.assign({ initialIsOpen: false, initialSelectedItem: (_c = props.initialValue) !== null && _c !== void 0 ? _c : props.selectedItem, itemToString: (item) => item ? item.label : "", items, onInputValueChange: (change) => {
43512
- setInputValue(change.inputValue);
43660
+ const shouldUpdateInput = [stateChangeTypes.ItemClick, stateChangeTypes.InputChange].includes(change.type);
43661
+ if (shouldUpdateInput) {
43662
+ setInputValue(change.inputValue);
43663
+ }
43513
43664
  if (!change.inputValue) {
43514
43665
  setItems(unpackedItems);
43515
43666
  return;
@@ -43574,10 +43725,11 @@
43574
43725
  }
43575
43726
  }, [isOpen, pendingHighlight, setHighlightedIndex]);
43576
43727
  React$1.useEffect(() => {
43728
+ var _a2;
43577
43729
  if (props.selectedItem === null) {
43578
- setInputValue("");
43730
+ setInputValue((_a2 = props.placeholder) !== null && _a2 !== void 0 ? _a2 : "");
43579
43731
  }
43580
- }, [props.selectedItem]);
43732
+ }, [props.selectedItem, props.placeholder]);
43581
43733
  const { refs, floatingStyles, context: context2 } = useFloating({
43582
43734
  open: isOpen,
43583
43735
  placement: "bottom-start",
@@ -43639,9 +43791,11 @@
43639
43791
  requireRound();
43640
43792
  const $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c = typeof document !== "undefined" ? React$1.useLayoutEffect : () => {
43641
43793
  };
43794
+ var $8ae05eaa5c114e9c$var$_React_useInsertionEffect;
43795
+ const $8ae05eaa5c114e9c$var$useEarlyEffect = ($8ae05eaa5c114e9c$var$_React_useInsertionEffect = React$1["useInsertionEffect"]) !== null && $8ae05eaa5c114e9c$var$_React_useInsertionEffect !== void 0 ? $8ae05eaa5c114e9c$var$_React_useInsertionEffect : $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c;
43642
43796
  function $8ae05eaa5c114e9c$export$7f54fc3180508a52(fn) {
43643
43797
  const ref = React$1.useRef(null);
43644
- $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
43798
+ $8ae05eaa5c114e9c$var$useEarlyEffect(() => {
43645
43799
  ref.current = fn;
43646
43800
  }, [
43647
43801
  fn
@@ -43881,11 +44035,54 @@
43881
44035
  "ping",
43882
44036
  "referrerPolicy"
43883
44037
  ]);
44038
+ const $65484d02dcb7eb3e$var$globalAttrs = /* @__PURE__ */ new Set([
44039
+ "dir",
44040
+ "lang",
44041
+ "hidden",
44042
+ "inert",
44043
+ "translate"
44044
+ ]);
44045
+ const $65484d02dcb7eb3e$var$globalEvents = /* @__PURE__ */ new Set([
44046
+ "onClick",
44047
+ "onAuxClick",
44048
+ "onContextMenu",
44049
+ "onDoubleClick",
44050
+ "onMouseDown",
44051
+ "onMouseEnter",
44052
+ "onMouseLeave",
44053
+ "onMouseMove",
44054
+ "onMouseOut",
44055
+ "onMouseOver",
44056
+ "onMouseUp",
44057
+ "onTouchCancel",
44058
+ "onTouchEnd",
44059
+ "onTouchMove",
44060
+ "onTouchStart",
44061
+ "onPointerDown",
44062
+ "onPointerMove",
44063
+ "onPointerUp",
44064
+ "onPointerCancel",
44065
+ "onPointerEnter",
44066
+ "onPointerLeave",
44067
+ "onPointerOver",
44068
+ "onPointerOut",
44069
+ "onGotPointerCapture",
44070
+ "onLostPointerCapture",
44071
+ "onScroll",
44072
+ "onWheel",
44073
+ "onAnimationStart",
44074
+ "onAnimationEnd",
44075
+ "onAnimationIteration",
44076
+ "onTransitionCancel",
44077
+ "onTransitionEnd",
44078
+ "onTransitionRun",
44079
+ "onTransitionStart"
44080
+ ]);
43884
44081
  const $65484d02dcb7eb3e$var$propRe = /^(data-.*)$/;
43885
44082
  function $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, opts = {}) {
43886
- let { labelable, isLink, propNames } = opts;
44083
+ let { labelable, isLink, global: global2, events = global2, propNames } = opts;
43887
44084
  let filteredProps = {};
43888
- for (const prop in props) if (Object.prototype.hasOwnProperty.call(props, prop) && ($65484d02dcb7eb3e$var$DOMPropNames.has(prop) || labelable && $65484d02dcb7eb3e$var$labelablePropNames.has(prop) || isLink && $65484d02dcb7eb3e$var$linkPropNames.has(prop) || (propNames === null || propNames === void 0 ? void 0 : propNames.has(prop)) || $65484d02dcb7eb3e$var$propRe.test(prop))) filteredProps[prop] = props[prop];
44085
+ for (const prop in props) if (Object.prototype.hasOwnProperty.call(props, prop) && ($65484d02dcb7eb3e$var$DOMPropNames.has(prop) || labelable && $65484d02dcb7eb3e$var$labelablePropNames.has(prop) || isLink && $65484d02dcb7eb3e$var$linkPropNames.has(prop) || global2 && $65484d02dcb7eb3e$var$globalAttrs.has(prop) || events && $65484d02dcb7eb3e$var$globalEvents.has(prop) || prop.endsWith("Capture") && $65484d02dcb7eb3e$var$globalEvents.has(prop.slice(0, -7)) || (propNames === null || propNames === void 0 ? void 0 : propNames.has(prop)) || $65484d02dcb7eb3e$var$propRe.test(prop))) filteredProps[prop] = props[prop];
43889
44086
  return filteredProps;
43890
44087
  }
43891
44088
  function $7215afc6de606d6b$export$de79e2c695e052f3(element) {
@@ -43943,7 +44140,8 @@
43943
44140
  function $c87311424ea30a05$var$testUserAgent(re) {
43944
44141
  var _window_navigator_userAgentData;
43945
44142
  if (typeof window === "undefined" || window.navigator == null) return false;
43946
- return ((_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.brands.some((brand) => re.test(brand.brand))) || re.test(window.navigator.userAgent);
44143
+ let brands = (_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.brands;
44144
+ return Array.isArray(brands) && brands.some((brand) => re.test(brand.brand)) || re.test(window.navigator.userAgent);
43947
44145
  }
43948
44146
  function $c87311424ea30a05$var$testPlatform(re) {
43949
44147
  var _window_navigator_userAgentData;
@@ -44133,9 +44331,8 @@
44133
44331
  return event.detail === 0 && !event.pointerType;
44134
44332
  }
44135
44333
  function $99facab73266f662$export$5add1d006293d136(ref, initialValue, onReset) {
44136
- let resetValue = React$1.useRef(initialValue);
44137
44334
  let handleReset2 = $8ae05eaa5c114e9c$export$7f54fc3180508a52(() => {
44138
- if (onReset) onReset(resetValue.current);
44335
+ if (onReset) onReset(initialValue);
44139
44336
  });
44140
44337
  React$1.useEffect(() => {
44141
44338
  var _ref_current;
@@ -44196,9 +44393,14 @@
44196
44393
  }
44197
44394
  function $9446cca9a3875146$export$e1a7b8e69ef6c52f(value, step) {
44198
44395
  let roundedValue = value;
44396
+ let precision = 0;
44199
44397
  let stepString = step.toString();
44200
- let pointIndex = stepString.indexOf(".");
44201
- let precision = pointIndex >= 0 ? stepString.length - pointIndex : 0;
44398
+ let eIndex = stepString.toLowerCase().indexOf("e-");
44399
+ if (eIndex > 0) precision = Math.abs(Math.floor(Math.log10(Math.abs(step)))) + eIndex;
44400
+ else {
44401
+ let pointIndex = stepString.indexOf(".");
44402
+ if (pointIndex >= 0) precision = stepString.length - pointIndex;
44403
+ }
44202
44404
  if (precision > 0) {
44203
44405
  let pow = Math.pow(10, precision);
44204
44406
  roundedValue = Math.round(roundedValue * pow) / pow;
@@ -44785,7 +44987,9 @@
44785
44987
  }
44786
44988
  function $6179b936705e76d3$var$setupGlobalTouchEvents() {
44787
44989
  if (typeof document === "undefined") return;
44788
- if (typeof PointerEvent !== "undefined") document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent);
44990
+ if ($6179b936705e76d3$var$hoverCount === 0) {
44991
+ if (typeof PointerEvent !== "undefined") document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent);
44992
+ }
44789
44993
  $6179b936705e76d3$var$hoverCount++;
44790
44994
  return () => {
44791
44995
  $6179b936705e76d3$var$hoverCount--;
@@ -45320,7 +45524,8 @@
45320
45524
  step
45321
45525
  ]);
45322
45526
  let value = React$1.useMemo(() => restrictValues($28f99e3e86e6ec45$var$convertValue(props.value)), [
45323
- props.value
45527
+ props.value,
45528
+ restrictValues
45324
45529
  ]);
45325
45530
  let defaultValue = React$1.useMemo(() => {
45326
45531
  var _convertValue;
@@ -45329,11 +45534,13 @@
45329
45534
  ]);
45330
45535
  }, [
45331
45536
  props.defaultValue,
45332
- minValue
45537
+ minValue,
45538
+ restrictValues
45333
45539
  ]);
45334
45540
  let onChange2 = $28f99e3e86e6ec45$var$createOnChange(props.value, props.defaultValue, props.onChange);
45335
45541
  let onChangeEnd = $28f99e3e86e6ec45$var$createOnChange(props.value, props.defaultValue, props.onChangeEnd);
45336
45542
  const [values, setValuesState] = $458b0a5536c1a7cf$export$40bfa8c7b0832715(value, defaultValue, onChange2);
45543
+ let [initialValues] = React$1.useState(values);
45337
45544
  const [isDraggings, setDraggingsState] = React$1.useState(new Array(values.length).fill(false));
45338
45545
  const isEditablesRef = React$1.useRef(new Array(values.length).fill(true));
45339
45546
  const [focusedIndex, setFocusedIndex] = React$1.useState(void 0);
@@ -45401,6 +45608,7 @@
45401
45608
  }
45402
45609
  return {
45403
45610
  values,
45611
+ defaultValues: props.defaultValue !== void 0 ? defaultValue : initialValues,
45404
45612
  getThumbValue: (index2) => values[index2],
45405
45613
  setThumbValue: updateValue,
45406
45614
  setThumbPercent,
@@ -45619,7 +45827,7 @@
45619
45827
  };
45620
45828
  }
45621
45829
  function $47b897dc8cdb026b$export$8d15029008292ae(opts, state) {
45622
- let { index: index2 = 0, isRequired, validationState, isInvalid, trackRef, inputRef, orientation = state.orientation, name } = opts;
45830
+ let { index: index2 = 0, isRequired, validationState, isInvalid, trackRef, inputRef, orientation = state.orientation, name, form } = opts;
45623
45831
  let isDisabled = opts.isDisabled || state.isDisabled;
45624
45832
  let isVertical = orientation === "vertical";
45625
45833
  let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
@@ -45738,7 +45946,7 @@
45738
45946
  onDown(e2.changedTouches[0].identifier);
45739
45947
  }
45740
45948
  }) : {};
45741
- $99facab73266f662$export$5add1d006293d136(inputRef, value, (v) => {
45949
+ $99facab73266f662$export$5add1d006293d136(inputRef, state.defaultValues[index2], (v) => {
45742
45950
  state.setThumbValue(index2, v);
45743
45951
  });
45744
45952
  return {
@@ -45750,6 +45958,7 @@
45750
45958
  step: state.step,
45751
45959
  value,
45752
45960
  name,
45961
+ form,
45753
45962
  disabled: isDisabled,
45754
45963
  "aria-orientation": orientation,
45755
45964
  "aria-valuetext": state.getThumbValueLabel(index2),
@@ -45810,7 +46019,9 @@
45810
46019
  },
45811
46020
  defaultClassName: "react-aria-Slider"
45812
46021
  });
45813
- let DOMProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props);
46022
+ let DOMProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, {
46023
+ global: true
46024
+ });
45814
46025
  delete DOMProps.id;
45815
46026
  return /* @__PURE__ */ React$1.createElement($64fa3d84918910a7$export$2881499e37b75b9a, {
45816
46027
  values: [
@@ -45838,9 +46049,7 @@
45838
46049
  ]
45839
46050
  ]
45840
46051
  }, /* @__PURE__ */ React$1.createElement("div", {
45841
- ...DOMProps,
45842
- ...groupProps,
45843
- ...renderProps,
46052
+ ...$3ef42575df84b30b$export$9d1611c77c2fe928(DOMProps, renderProps, groupProps),
45844
46053
  ref,
45845
46054
  slot: props.slot || void 0,
45846
46055
  "data-orientation": state.orientation,
@@ -45904,7 +46113,9 @@
45904
46113
  isDisabled
45905
46114
  }
45906
46115
  });
45907
- let DOMProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props);
46116
+ let DOMProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, {
46117
+ global: true
46118
+ });
45908
46119
  delete DOMProps.id;
45909
46120
  return /* @__PURE__ */ React$1.createElement("div", {
45910
46121
  ...$3ef42575df84b30b$export$9d1611c77c2fe928(DOMProps, thumbProps, hoverProps),
@@ -56275,14 +56486,26 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
56275
56486
  const maxDisconnectedTime = 1e4;
56276
56487
  const interPingInterval = 5e3;
56277
56488
  const maxAttempts = Math.round(maxDisconnectedTime / interAttemptTimeout);
56489
+ class TaskCancelledError extends Error {
56490
+ constructor(message, task_id) {
56491
+ super(message);
56492
+ this.task_id = task_id;
56493
+ }
56494
+ }
56495
+ class TaskError extends Error {
56496
+ constructor(message, task_id) {
56497
+ super(message);
56498
+ this.task_id = task_id;
56499
+ }
56500
+ }
56278
56501
  function isInitMessage(message) {
56279
56502
  return message.type === "init";
56280
56503
  }
56281
56504
  function isTaskNotification(message) {
56282
56505
  return message.type === "message" && "status" in message.message && "task_id" in message.message;
56283
56506
  }
56284
- function isServerTriggerMessage(message) {
56285
- return message.type === "message" && "data_id" in message.message;
56507
+ function isServerVariableMessage(message) {
56508
+ return message.type === "message" && "__type" in message.message && message.message.__type === "ServerVariable";
56286
56509
  }
56287
56510
  function isServerErrorMessage(message) {
56288
56511
  return message.type === "message" && "error" in message.message;
@@ -56408,6 +56631,12 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
56408
56631
  map$2((msg) => msg.message)
56409
56632
  );
56410
56633
  }
56634
+ serverVariableMessages$() {
56635
+ return this.messages$.pipe(
56636
+ filter(isServerVariableMessage),
56637
+ map$2((msg) => msg.message)
56638
+ );
56639
+ }
56411
56640
  /**
56412
56641
  * Get the observable to receive the new channel when the socket reconnects
56413
56642
  */
@@ -56442,17 +56671,6 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
56442
56671
  )
56443
56672
  );
56444
56673
  }
56445
- /**
56446
- * Get the observable to receive server trigger messages for a given data variable
56447
- *
56448
- * @param dataId id of the data variable triggered
56449
- */
56450
- serverTriggers$(dataId) {
56451
- return this.messages$.pipe(
56452
- filter(isServerTriggerMessage),
56453
- filter((msg) => msg.message?.data_id === dataId)
56454
- );
56455
- }
56456
56674
  /**
56457
56675
  * Get the observable to receive server error messages
56458
56676
  */
@@ -56483,21 +56701,21 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
56483
56701
  return this.messages$.pipe(filter(isCustomMessage));
56484
56702
  }
56485
56703
  /**
56486
- * Returns a promise that will resolve when the task is completed. If the task is cancelled then this will throw an
56704
+ * Returns a promise that will resolve when the task is completed. If the task is cancelled or errored then this will throw an
56487
56705
  * error to signify that.
56488
56706
  *
56489
56707
  * @param task_id the id of the task to wait for
56490
56708
  */
56491
56709
  waitForTask(task_id) {
56492
56710
  return this.messages$.pipe(
56493
- filter(
56494
- (msg) => isTaskNotification(msg) && msg.message?.task_id === task_id && msg.message.status !== "PROGRESS"
56495
- /* PROGRESS */
56496
- // don't take progress updates
56497
- ),
56711
+ filter((msg) => {
56712
+ return isTaskNotification(msg) && msg.message?.task_id === task_id && msg.message.status !== "PROGRESS";
56713
+ }),
56498
56714
  map$2((msg) => {
56499
- if (isTaskNotification(msg) && msg.message.status === "CANCELED") {
56500
- throw new Error("CANCELED");
56715
+ if (msg.message.status === "CANCELED") {
56716
+ throw new TaskCancelledError("Task was cancelled", msg.message.task_id);
56717
+ } else if (msg.message.status === "ERROR") {
56718
+ throw new TaskError(msg.message.error, msg.message.task_id);
56501
56719
  }
56502
56720
  return msg;
56503
56721
  }),
@@ -56638,17 +56856,14 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
56638
56856
  function isVariable(variable) {
56639
56857
  return variable && typeof variable == "object" && variable.hasOwnProperty("uid") && variable.hasOwnProperty("__typename") && variable.__typename.includes("Variable");
56640
56858
  }
56641
- function isUrlVariable(variable) {
56642
- return isVariable(variable) && variable.__typename === "UrlVariable";
56859
+ function isSingleVariable(variable) {
56860
+ return isVariable(variable) && variable.__typename === "Variable";
56643
56861
  }
56644
56862
  function isDerivedVariable(variable) {
56645
56863
  return isVariable(variable) && variable.__typename === "DerivedVariable";
56646
56864
  }
56647
- function isDataVariable(variable) {
56648
- return isVariable(variable) && variable.__typename === "DataVariable";
56649
- }
56650
- function isDerivedDataVariable(variable) {
56651
- return isVariable(variable) && variable.__typename === "DerivedDataVariable";
56865
+ function isServerVariable(variable) {
56866
+ return isVariable(variable) && variable.__typename === "ServerVariable";
56652
56867
  }
56653
56868
  function isLoopVariable(variable) {
56654
56869
  return variable && typeof variable == "object" && variable.hasOwnProperty("uid") && variable.hasOwnProperty("__typename") && variable.__typename === "LoopVariable";
@@ -56656,14 +56871,14 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
56656
56871
  function isSwitchVariable(variable) {
56657
56872
  return isVariable(variable) && variable.__typename === "SwitchVariable";
56658
56873
  }
56874
+ function isStateVariable(variable) {
56875
+ return isVariable(variable) && variable.__typename === "StateVariable";
56876
+ }
56659
56877
  function isResolvedDerivedVariable(value) {
56660
56878
  return value && typeof value === "object" && "values" in value && "type" in value && value.type === "derived" && "uid" in value;
56661
56879
  }
56662
- function isResolvedDataVariable(value) {
56663
- return value && typeof value === "object" && "filters" in value && "type" in value && value.type === "data" && "uid" in value;
56664
- }
56665
- function isResolvedDerivedDataVariable(value) {
56666
- return value && typeof value === "object" && "filters" in value && "values" in value && "type" in value && value.type === "derived-data" && "uid" in value;
56880
+ function isResolvedServerVariable(value) {
56881
+ return value && typeof value === "object" && "type" in value && value.type === "server" && "uid" in value && "sequence_number" in value;
56667
56882
  }
56668
56883
  function isResolvedSwitchVariable(value) {
56669
56884
  return value && typeof value === "object" && "type" in value && value.type === "switch" && "uid" in value && "value_map" in value;
@@ -56672,7 +56887,7 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
56672
56887
  return action && typeof action === "object" && action.__typename === "ActionImpl";
56673
56888
  }
56674
56889
  function isAnnotatedAction(action) {
56675
- return action && "uid" in action && "definition_uid" in action && "dynamic_kwargs" in action;
56890
+ return action && isObject(action) && "uid" in action && "definition_uid" in action && "dynamic_kwargs" in action;
56676
56891
  }
56677
56892
  const isPyComponent = (value) => isObject(value) && "props" in value && isObject(value.props) && "func_name" in value.props && "dynamic_kwargs" in value.props;
56678
56893
  function isCondition(value) {
@@ -56801,813 +57016,6 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
56801
57016
  });
56802
57017
  return res.ok;
56803
57018
  }
56804
- function commonjsRequire(path) {
56805
- throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
56806
- }
56807
- var object_hash = { exports: {} };
56808
- var hasRequiredObject_hash;
56809
- function requireObject_hash() {
56810
- if (hasRequiredObject_hash) return object_hash.exports;
56811
- hasRequiredObject_hash = 1;
56812
- (function(module2, exports2) {
56813
- !function(e2) {
56814
- module2.exports = e2();
56815
- }(function() {
56816
- return function r2(o2, i2, u) {
56817
- function s(n2, e3) {
56818
- if (!i2[n2]) {
56819
- if (!o2[n2]) {
56820
- var t2 = "function" == typeof commonjsRequire && commonjsRequire;
56821
- if (!e3 && t2) return t2(n2, true);
56822
- if (a2) return a2(n2, true);
56823
- throw new Error("Cannot find module '" + n2 + "'");
56824
- }
56825
- e3 = i2[n2] = { exports: {} };
56826
- o2[n2][0].call(e3.exports, function(e4) {
56827
- var t3 = o2[n2][1][e4];
56828
- return s(t3 || e4);
56829
- }, e3, e3.exports, r2, o2, i2, u);
56830
- }
56831
- return i2[n2].exports;
56832
- }
56833
- for (var a2 = "function" == typeof commonjsRequire && commonjsRequire, e2 = 0; e2 < u.length; e2++) s(u[e2]);
56834
- return s;
56835
- }({ 1: [function(w2, b2, m) {
56836
- !(function(e2, n2, s, c, d2, h, p2, g, y) {
56837
- var r2 = w2("crypto");
56838
- function t2(e3, t3) {
56839
- t3 = u(e3, t3);
56840
- var n3;
56841
- return void 0 === (n3 = "passthrough" !== t3.algorithm ? r2.createHash(t3.algorithm) : new l2()).write && (n3.write = n3.update, n3.end = n3.update), f(t3, n3).dispatch(e3), n3.update || n3.end(""), n3.digest ? n3.digest("buffer" === t3.encoding ? void 0 : t3.encoding) : (e3 = n3.read(), "buffer" !== t3.encoding ? e3.toString(t3.encoding) : e3);
56842
- }
56843
- (m = b2.exports = t2).sha1 = function(e3) {
56844
- return t2(e3);
56845
- }, m.keys = function(e3) {
56846
- return t2(e3, { excludeValues: true, algorithm: "sha1", encoding: "hex" });
56847
- }, m.MD5 = function(e3) {
56848
- return t2(e3, { algorithm: "md5", encoding: "hex" });
56849
- }, m.keysMD5 = function(e3) {
56850
- return t2(e3, { algorithm: "md5", encoding: "hex", excludeValues: true });
56851
- };
56852
- var o2 = r2.getHashes ? r2.getHashes().slice() : ["sha1", "md5"], i2 = (o2.push("passthrough"), ["buffer", "hex", "binary", "base64"]);
56853
- function u(e3, t3) {
56854
- var n3 = {};
56855
- if (n3.algorithm = (t3 = t3 || {}).algorithm || "sha1", n3.encoding = t3.encoding || "hex", n3.excludeValues = !!t3.excludeValues, n3.algorithm = n3.algorithm.toLowerCase(), n3.encoding = n3.encoding.toLowerCase(), n3.ignoreUnknown = true === t3.ignoreUnknown, n3.respectType = false !== t3.respectType, n3.respectFunctionNames = false !== t3.respectFunctionNames, n3.respectFunctionProperties = false !== t3.respectFunctionProperties, n3.unorderedArrays = true === t3.unorderedArrays, n3.unorderedSets = false !== t3.unorderedSets, n3.unorderedObjects = false !== t3.unorderedObjects, n3.replacer = t3.replacer || void 0, n3.excludeKeys = t3.excludeKeys || void 0, void 0 === e3) throw new Error("Object argument required.");
56856
- for (var r3 = 0; r3 < o2.length; ++r3) o2[r3].toLowerCase() === n3.algorithm.toLowerCase() && (n3.algorithm = o2[r3]);
56857
- if (-1 === o2.indexOf(n3.algorithm)) throw new Error('Algorithm "' + n3.algorithm + '" not supported. supported values: ' + o2.join(", "));
56858
- if (-1 === i2.indexOf(n3.encoding) && "passthrough" !== n3.algorithm) throw new Error('Encoding "' + n3.encoding + '" not supported. supported values: ' + i2.join(", "));
56859
- return n3;
56860
- }
56861
- function a2(e3) {
56862
- if ("function" == typeof e3) return null != /^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i.exec(Function.prototype.toString.call(e3));
56863
- }
56864
- function f(o3, t3, i3) {
56865
- i3 = i3 || [];
56866
- function u2(e3) {
56867
- return t3.update ? t3.update(e3, "utf8") : t3.write(e3, "utf8");
56868
- }
56869
- return { dispatch: function(e3) {
56870
- return this["_" + (null === (e3 = o3.replacer ? o3.replacer(e3) : e3) ? "null" : typeof e3)](e3);
56871
- }, _object: function(t4) {
56872
- var n3, e3 = Object.prototype.toString.call(t4), r3 = /\[object (.*)\]/i.exec(e3);
56873
- r3 = (r3 = r3 ? r3[1] : "unknown:[" + e3 + "]").toLowerCase();
56874
- if (0 <= (e3 = i3.indexOf(t4))) return this.dispatch("[CIRCULAR:" + e3 + "]");
56875
- if (i3.push(t4), void 0 !== s && s.isBuffer && s.isBuffer(t4)) return u2("buffer:"), u2(t4);
56876
- if ("object" === r3 || "function" === r3 || "asyncfunction" === r3) return e3 = Object.keys(t4), o3.unorderedObjects && (e3 = e3.sort()), false === o3.respectType || a2(t4) || e3.splice(0, 0, "prototype", "__proto__", "constructor"), o3.excludeKeys && (e3 = e3.filter(function(e4) {
56877
- return !o3.excludeKeys(e4);
56878
- })), u2("object:" + e3.length + ":"), n3 = this, e3.forEach(function(e4) {
56879
- n3.dispatch(e4), u2(":"), o3.excludeValues || n3.dispatch(t4[e4]), u2(",");
56880
- });
56881
- if (!this["_" + r3]) {
56882
- if (o3.ignoreUnknown) return u2("[" + r3 + "]");
56883
- throw new Error('Unknown object type "' + r3 + '"');
56884
- }
56885
- this["_" + r3](t4);
56886
- }, _array: function(e3, t4) {
56887
- t4 = void 0 !== t4 ? t4 : false !== o3.unorderedArrays;
56888
- var n3 = this;
56889
- if (u2("array:" + e3.length + ":"), !t4 || e3.length <= 1) return e3.forEach(function(e4) {
56890
- return n3.dispatch(e4);
56891
- });
56892
- var r3 = [], t4 = e3.map(function(e4) {
56893
- var t5 = new l2(), n4 = i3.slice();
56894
- return f(o3, t5, n4).dispatch(e4), r3 = r3.concat(n4.slice(i3.length)), t5.read().toString();
56895
- });
56896
- return i3 = i3.concat(r3), t4.sort(), this._array(t4, false);
56897
- }, _date: function(e3) {
56898
- return u2("date:" + e3.toJSON());
56899
- }, _symbol: function(e3) {
56900
- return u2("symbol:" + e3.toString());
56901
- }, _error: function(e3) {
56902
- return u2("error:" + e3.toString());
56903
- }, _boolean: function(e3) {
56904
- return u2("bool:" + e3.toString());
56905
- }, _string: function(e3) {
56906
- u2("string:" + e3.length + ":"), u2(e3.toString());
56907
- }, _function: function(e3) {
56908
- u2("fn:"), a2(e3) ? this.dispatch("[native]") : this.dispatch(e3.toString()), false !== o3.respectFunctionNames && this.dispatch("function-name:" + String(e3.name)), o3.respectFunctionProperties && this._object(e3);
56909
- }, _number: function(e3) {
56910
- return u2("number:" + e3.toString());
56911
- }, _xml: function(e3) {
56912
- return u2("xml:" + e3.toString());
56913
- }, _null: function() {
56914
- return u2("Null");
56915
- }, _undefined: function() {
56916
- return u2("Undefined");
56917
- }, _regexp: function(e3) {
56918
- return u2("regex:" + e3.toString());
56919
- }, _uint8array: function(e3) {
56920
- return u2("uint8array:"), this.dispatch(Array.prototype.slice.call(e3));
56921
- }, _uint8clampedarray: function(e3) {
56922
- return u2("uint8clampedarray:"), this.dispatch(Array.prototype.slice.call(e3));
56923
- }, _int8array: function(e3) {
56924
- return u2("int8array:"), this.dispatch(Array.prototype.slice.call(e3));
56925
- }, _uint16array: function(e3) {
56926
- return u2("uint16array:"), this.dispatch(Array.prototype.slice.call(e3));
56927
- }, _int16array: function(e3) {
56928
- return u2("int16array:"), this.dispatch(Array.prototype.slice.call(e3));
56929
- }, _uint32array: function(e3) {
56930
- return u2("uint32array:"), this.dispatch(Array.prototype.slice.call(e3));
56931
- }, _int32array: function(e3) {
56932
- return u2("int32array:"), this.dispatch(Array.prototype.slice.call(e3));
56933
- }, _float32array: function(e3) {
56934
- return u2("float32array:"), this.dispatch(Array.prototype.slice.call(e3));
56935
- }, _float64array: function(e3) {
56936
- return u2("float64array:"), this.dispatch(Array.prototype.slice.call(e3));
56937
- }, _arraybuffer: function(e3) {
56938
- return u2("arraybuffer:"), this.dispatch(new Uint8Array(e3));
56939
- }, _url: function(e3) {
56940
- return u2("url:" + e3.toString());
56941
- }, _map: function(e3) {
56942
- u2("map:");
56943
- e3 = Array.from(e3);
56944
- return this._array(e3, false !== o3.unorderedSets);
56945
- }, _set: function(e3) {
56946
- u2("set:");
56947
- e3 = Array.from(e3);
56948
- return this._array(e3, false !== o3.unorderedSets);
56949
- }, _file: function(e3) {
56950
- return u2("file:"), this.dispatch([e3.name, e3.size, e3.type, e3.lastModfied]);
56951
- }, _blob: function() {
56952
- if (o3.ignoreUnknown) return u2("[blob]");
56953
- throw Error('Hashing Blob objects is currently not supported\n(see https://github.com/puleos/object-hash/issues/26)\nUse "options.replacer" or "options.ignoreUnknown"\n');
56954
- }, _domwindow: function() {
56955
- return u2("domwindow");
56956
- }, _bigint: function(e3) {
56957
- return u2("bigint:" + e3.toString());
56958
- }, _process: function() {
56959
- return u2("process");
56960
- }, _timer: function() {
56961
- return u2("timer");
56962
- }, _pipe: function() {
56963
- return u2("pipe");
56964
- }, _tcp: function() {
56965
- return u2("tcp");
56966
- }, _udp: function() {
56967
- return u2("udp");
56968
- }, _tty: function() {
56969
- return u2("tty");
56970
- }, _statwatcher: function() {
56971
- return u2("statwatcher");
56972
- }, _securecontext: function() {
56973
- return u2("securecontext");
56974
- }, _connection: function() {
56975
- return u2("connection");
56976
- }, _zlib: function() {
56977
- return u2("zlib");
56978
- }, _context: function() {
56979
- return u2("context");
56980
- }, _nodescript: function() {
56981
- return u2("nodescript");
56982
- }, _httpparser: function() {
56983
- return u2("httpparser");
56984
- }, _dataview: function() {
56985
- return u2("dataview");
56986
- }, _signal: function() {
56987
- return u2("signal");
56988
- }, _fsevent: function() {
56989
- return u2("fsevent");
56990
- }, _tlswrap: function() {
56991
- return u2("tlswrap");
56992
- } };
56993
- }
56994
- function l2() {
56995
- return { buf: "", write: function(e3) {
56996
- this.buf += e3;
56997
- }, end: function(e3) {
56998
- this.buf += e3;
56999
- }, read: function() {
57000
- return this.buf;
57001
- } };
57002
- }
57003
- m.writeToStream = function(e3, t3, n3) {
57004
- return void 0 === n3 && (n3 = t3, t3 = {}), f(t3 = u(e3, t3), n3).dispatch(e3);
57005
- };
57006
- }).call(this, w2("lYpoI2"), "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}, w2("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/fake_9a5aa49d.js", "/");
57007
- }, { buffer: 3, crypto: 5, lYpoI2: 11 }], 2: [function(e2, t2, f) {
57008
- !(function(e3, t3, n2, r2, o2, i2, u, s, a2) {
57009
- !function(e4) {
57010
- var a3 = "undefined" != typeof Uint8Array ? Uint8Array : Array, t4 = "+".charCodeAt(0), n3 = "/".charCodeAt(0), r3 = "0".charCodeAt(0), o3 = "a".charCodeAt(0), i3 = "A".charCodeAt(0), u2 = "-".charCodeAt(0), s2 = "_".charCodeAt(0);
57011
- function f2(e5) {
57012
- e5 = e5.charCodeAt(0);
57013
- return e5 === t4 || e5 === u2 ? 62 : e5 === n3 || e5 === s2 ? 63 : e5 < r3 ? -1 : e5 < r3 + 10 ? e5 - r3 + 26 + 26 : e5 < i3 + 26 ? e5 - i3 : e5 < o3 + 26 ? e5 - o3 + 26 : void 0;
57014
- }
57015
- e4.toByteArray = function(e5) {
57016
- var t5, n4;
57017
- if (0 < e5.length % 4) throw new Error("Invalid string. Length must be a multiple of 4");
57018
- var r4 = e5.length, r4 = "=" === e5.charAt(r4 - 2) ? 2 : "=" === e5.charAt(r4 - 1) ? 1 : 0, o4 = new a3(3 * e5.length / 4 - r4), i4 = 0 < r4 ? e5.length - 4 : e5.length, u3 = 0;
57019
- function s3(e6) {
57020
- o4[u3++] = e6;
57021
- }
57022
- for (t5 = 0; t5 < i4; t5 += 4, 0) s3((16711680 & (n4 = f2(e5.charAt(t5)) << 18 | f2(e5.charAt(t5 + 1)) << 12 | f2(e5.charAt(t5 + 2)) << 6 | f2(e5.charAt(t5 + 3)))) >> 16), s3((65280 & n4) >> 8), s3(255 & n4);
57023
- return 2 == r4 ? s3(255 & (n4 = f2(e5.charAt(t5)) << 2 | f2(e5.charAt(t5 + 1)) >> 4)) : 1 == r4 && (s3((n4 = f2(e5.charAt(t5)) << 10 | f2(e5.charAt(t5 + 1)) << 4 | f2(e5.charAt(t5 + 2)) >> 2) >> 8 & 255), s3(255 & n4)), o4;
57024
- }, e4.fromByteArray = function(e5) {
57025
- var t5, n4, r4, o4, i4 = e5.length % 3, u3 = "";
57026
- function s3(e6) {
57027
- return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e6);
57028
- }
57029
- for (t5 = 0, r4 = e5.length - i4; t5 < r4; t5 += 3) n4 = (e5[t5] << 16) + (e5[t5 + 1] << 8) + e5[t5 + 2], u3 += s3((o4 = n4) >> 18 & 63) + s3(o4 >> 12 & 63) + s3(o4 >> 6 & 63) + s3(63 & o4);
57030
- switch (i4) {
57031
- case 1:
57032
- u3 = (u3 += s3((n4 = e5[e5.length - 1]) >> 2)) + s3(n4 << 4 & 63) + "==";
57033
- break;
57034
- case 2:
57035
- u3 = (u3 = (u3 += s3((n4 = (e5[e5.length - 2] << 8) + e5[e5.length - 1]) >> 10)) + s3(n4 >> 4 & 63)) + s3(n4 << 2 & 63) + "=";
57036
- }
57037
- return u3;
57038
- };
57039
- }(void 0 === f ? this.base64js = {} : f);
57040
- }).call(this, e2("lYpoI2"), "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}, e2("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js", "/node_modules/gulp-browserify/node_modules/base64-js/lib");
57041
- }, { buffer: 3, lYpoI2: 11 }], 3: [function(O, e2, H) {
57042
- !(function(e3, n2, f, r2, h, p2, g, y, w2) {
57043
- var a2 = O("base64-js"), i2 = O("ieee754");
57044
- function f(e4, t3, n3) {
57045
- if (!(this instanceof f)) return new f(e4, t3, n3);
57046
- var r3, o3, i3, u2, s2 = typeof e4;
57047
- if ("base64" === t3 && "string" == s2) for (e4 = (u2 = e4).trim ? u2.trim() : u2.replace(/^\s+|\s+$/g, ""); e4.length % 4 != 0; ) e4 += "=";
57048
- if ("number" == s2) r3 = j(e4);
57049
- else if ("string" == s2) r3 = f.byteLength(e4, t3);
57050
- else {
57051
- if ("object" != s2) throw new Error("First argument needs to be a number, array or string.");
57052
- r3 = j(e4.length);
57053
- }
57054
- if (f._useTypedArrays ? o3 = f._augment(new Uint8Array(r3)) : ((o3 = this).length = r3, o3._isBuffer = true), f._useTypedArrays && "number" == typeof e4.byteLength) o3._set(e4);
57055
- else if (C(u2 = e4) || f.isBuffer(u2) || u2 && "object" == typeof u2 && "number" == typeof u2.length) for (i3 = 0; i3 < r3; i3++) f.isBuffer(e4) ? o3[i3] = e4.readUInt8(i3) : o3[i3] = e4[i3];
57056
- else if ("string" == s2) o3.write(e4, 0, t3);
57057
- else if ("number" == s2 && !f._useTypedArrays && !n3) for (i3 = 0; i3 < r3; i3++) o3[i3] = 0;
57058
- return o3;
57059
- }
57060
- function b2(e4, t3, n3, r3) {
57061
- return f._charsWritten = c(function(e5) {
57062
- for (var t4 = [], n4 = 0; n4 < e5.length; n4++) t4.push(255 & e5.charCodeAt(n4));
57063
- return t4;
57064
- }(t3), e4, n3, r3);
57065
- }
57066
- function m(e4, t3, n3, r3) {
57067
- return f._charsWritten = c(function(e5) {
57068
- for (var t4, n4, r4 = [], o3 = 0; o3 < e5.length; o3++) n4 = e5.charCodeAt(o3), t4 = n4 >> 8, n4 = n4 % 256, r4.push(n4), r4.push(t4);
57069
- return r4;
57070
- }(t3), e4, n3, r3);
57071
- }
57072
- function v(e4, t3, n3) {
57073
- var r3 = "";
57074
- n3 = Math.min(e4.length, n3);
57075
- for (var o3 = t3; o3 < n3; o3++) r3 += String.fromCharCode(e4[o3]);
57076
- return r3;
57077
- }
57078
- function o2(e4, t3, n3, r3) {
57079
- r3 || (d2("boolean" == typeof n3, "missing or invalid endian"), d2(null != t3, "missing offset"), d2(t3 + 1 < e4.length, "Trying to read beyond buffer length"));
57080
- var o3, r3 = e4.length;
57081
- if (!(r3 <= t3)) return n3 ? (o3 = e4[t3], t3 + 1 < r3 && (o3 |= e4[t3 + 1] << 8)) : (o3 = e4[t3] << 8, t3 + 1 < r3 && (o3 |= e4[t3 + 1])), o3;
57082
- }
57083
- function u(e4, t3, n3, r3) {
57084
- r3 || (d2("boolean" == typeof n3, "missing or invalid endian"), d2(null != t3, "missing offset"), d2(t3 + 3 < e4.length, "Trying to read beyond buffer length"));
57085
- var o3, r3 = e4.length;
57086
- if (!(r3 <= t3)) return n3 ? (t3 + 2 < r3 && (o3 = e4[t3 + 2] << 16), t3 + 1 < r3 && (o3 |= e4[t3 + 1] << 8), o3 |= e4[t3], t3 + 3 < r3 && (o3 += e4[t3 + 3] << 24 >>> 0)) : (t3 + 1 < r3 && (o3 = e4[t3 + 1] << 16), t3 + 2 < r3 && (o3 |= e4[t3 + 2] << 8), t3 + 3 < r3 && (o3 |= e4[t3 + 3]), o3 += e4[t3] << 24 >>> 0), o3;
57087
- }
57088
- function _(e4, t3, n3, r3) {
57089
- if (r3 || (d2("boolean" == typeof n3, "missing or invalid endian"), d2(null != t3, "missing offset"), d2(t3 + 1 < e4.length, "Trying to read beyond buffer length")), !(e4.length <= t3)) return r3 = o2(e4, t3, n3, true), 32768 & r3 ? -1 * (65535 - r3 + 1) : r3;
57090
- }
57091
- function E(e4, t3, n3, r3) {
57092
- if (r3 || (d2("boolean" == typeof n3, "missing or invalid endian"), d2(null != t3, "missing offset"), d2(t3 + 3 < e4.length, "Trying to read beyond buffer length")), !(e4.length <= t3)) return r3 = u(e4, t3, n3, true), 2147483648 & r3 ? -1 * (4294967295 - r3 + 1) : r3;
57093
- }
57094
- function I(e4, t3, n3, r3) {
57095
- return r3 || (d2("boolean" == typeof n3, "missing or invalid endian"), d2(t3 + 3 < e4.length, "Trying to read beyond buffer length")), i2.read(e4, t3, n3, 23, 4);
57096
- }
57097
- function A(e4, t3, n3, r3) {
57098
- return r3 || (d2("boolean" == typeof n3, "missing or invalid endian"), d2(t3 + 7 < e4.length, "Trying to read beyond buffer length")), i2.read(e4, t3, n3, 52, 8);
57099
- }
57100
- function s(e4, t3, n3, r3, o3) {
57101
- o3 || (d2(null != t3, "missing value"), d2("boolean" == typeof r3, "missing or invalid endian"), d2(null != n3, "missing offset"), d2(n3 + 1 < e4.length, "trying to write beyond buffer length"), Y(t3, 65535));
57102
- o3 = e4.length;
57103
- if (!(o3 <= n3)) for (var i3 = 0, u2 = Math.min(o3 - n3, 2); i3 < u2; i3++) e4[n3 + i3] = (t3 & 255 << 8 * (r3 ? i3 : 1 - i3)) >>> 8 * (r3 ? i3 : 1 - i3);
57104
- }
57105
- function l2(e4, t3, n3, r3, o3) {
57106
- o3 || (d2(null != t3, "missing value"), d2("boolean" == typeof r3, "missing or invalid endian"), d2(null != n3, "missing offset"), d2(n3 + 3 < e4.length, "trying to write beyond buffer length"), Y(t3, 4294967295));
57107
- o3 = e4.length;
57108
- if (!(o3 <= n3)) for (var i3 = 0, u2 = Math.min(o3 - n3, 4); i3 < u2; i3++) e4[n3 + i3] = t3 >>> 8 * (r3 ? i3 : 3 - i3) & 255;
57109
- }
57110
- function B(e4, t3, n3, r3, o3) {
57111
- o3 || (d2(null != t3, "missing value"), d2("boolean" == typeof r3, "missing or invalid endian"), d2(null != n3, "missing offset"), d2(n3 + 1 < e4.length, "Trying to write beyond buffer length"), F(t3, 32767, -32768)), e4.length <= n3 || s(e4, 0 <= t3 ? t3 : 65535 + t3 + 1, n3, r3, o3);
57112
- }
57113
- function L(e4, t3, n3, r3, o3) {
57114
- o3 || (d2(null != t3, "missing value"), d2("boolean" == typeof r3, "missing or invalid endian"), d2(null != n3, "missing offset"), d2(n3 + 3 < e4.length, "Trying to write beyond buffer length"), F(t3, 2147483647, -2147483648)), e4.length <= n3 || l2(e4, 0 <= t3 ? t3 : 4294967295 + t3 + 1, n3, r3, o3);
57115
- }
57116
- function U(e4, t3, n3, r3, o3) {
57117
- o3 || (d2(null != t3, "missing value"), d2("boolean" == typeof r3, "missing or invalid endian"), d2(null != n3, "missing offset"), d2(n3 + 3 < e4.length, "Trying to write beyond buffer length"), D(t3, 34028234663852886e22, -34028234663852886e22)), e4.length <= n3 || i2.write(e4, t3, n3, r3, 23, 4);
57118
- }
57119
- function x(e4, t3, n3, r3, o3) {
57120
- o3 || (d2(null != t3, "missing value"), d2("boolean" == typeof r3, "missing or invalid endian"), d2(null != n3, "missing offset"), d2(n3 + 7 < e4.length, "Trying to write beyond buffer length"), D(t3, 17976931348623157e292, -17976931348623157e292)), e4.length <= n3 || i2.write(e4, t3, n3, r3, 52, 8);
57121
- }
57122
- H.Buffer = f, H.SlowBuffer = f, H.INSPECT_MAX_BYTES = 50, f.poolSize = 8192, f._useTypedArrays = function() {
57123
- try {
57124
- var e4 = new ArrayBuffer(0), t3 = new Uint8Array(e4);
57125
- return t3.foo = function() {
57126
- return 42;
57127
- }, 42 === t3.foo() && "function" == typeof t3.subarray;
57128
- } catch (e5) {
57129
- return false;
57130
- }
57131
- }(), f.isEncoding = function(e4) {
57132
- switch (String(e4).toLowerCase()) {
57133
- case "hex":
57134
- case "utf8":
57135
- case "utf-8":
57136
- case "ascii":
57137
- case "binary":
57138
- case "base64":
57139
- case "raw":
57140
- case "ucs2":
57141
- case "ucs-2":
57142
- case "utf16le":
57143
- case "utf-16le":
57144
- return true;
57145
- default:
57146
- return false;
57147
- }
57148
- }, f.isBuffer = function(e4) {
57149
- return !(null == e4 || !e4._isBuffer);
57150
- }, f.byteLength = function(e4, t3) {
57151
- var n3;
57152
- switch (e4 += "", t3 || "utf8") {
57153
- case "hex":
57154
- n3 = e4.length / 2;
57155
- break;
57156
- case "utf8":
57157
- case "utf-8":
57158
- n3 = T(e4).length;
57159
- break;
57160
- case "ascii":
57161
- case "binary":
57162
- case "raw":
57163
- n3 = e4.length;
57164
- break;
57165
- case "base64":
57166
- n3 = M(e4).length;
57167
- break;
57168
- case "ucs2":
57169
- case "ucs-2":
57170
- case "utf16le":
57171
- case "utf-16le":
57172
- n3 = 2 * e4.length;
57173
- break;
57174
- default:
57175
- throw new Error("Unknown encoding");
57176
- }
57177
- return n3;
57178
- }, f.concat = function(e4, t3) {
57179
- if (d2(C(e4), "Usage: Buffer.concat(list, [totalLength])\nlist should be an Array."), 0 === e4.length) return new f(0);
57180
- if (1 === e4.length) return e4[0];
57181
- if ("number" != typeof t3) for (o3 = t3 = 0; o3 < e4.length; o3++) t3 += e4[o3].length;
57182
- for (var n3 = new f(t3), r3 = 0, o3 = 0; o3 < e4.length; o3++) {
57183
- var i3 = e4[o3];
57184
- i3.copy(n3, r3), r3 += i3.length;
57185
- }
57186
- return n3;
57187
- }, f.prototype.write = function(e4, t3, n3, r3) {
57188
- isFinite(t3) ? isFinite(n3) || (r3 = n3, n3 = void 0) : (a3 = r3, r3 = t3, t3 = n3, n3 = a3), t3 = Number(t3) || 0;
57189
- var o3, i3, u2, s2, a3 = this.length - t3;
57190
- switch ((!n3 || a3 < (n3 = Number(n3))) && (n3 = a3), r3 = String(r3 || "utf8").toLowerCase()) {
57191
- case "hex":
57192
- o3 = function(e5, t4, n4, r4) {
57193
- n4 = Number(n4) || 0;
57194
- var o4 = e5.length - n4;
57195
- (!r4 || o4 < (r4 = Number(r4))) && (r4 = o4), d2((o4 = t4.length) % 2 == 0, "Invalid hex string"), o4 / 2 < r4 && (r4 = o4 / 2);
57196
- for (var i4 = 0; i4 < r4; i4++) {
57197
- var u3 = parseInt(t4.substr(2 * i4, 2), 16);
57198
- d2(!isNaN(u3), "Invalid hex string"), e5[n4 + i4] = u3;
57199
- }
57200
- return f._charsWritten = 2 * i4, i4;
57201
- }(this, e4, t3, n3);
57202
- break;
57203
- case "utf8":
57204
- case "utf-8":
57205
- i3 = this, u2 = t3, s2 = n3, o3 = f._charsWritten = c(T(e4), i3, u2, s2);
57206
- break;
57207
- case "ascii":
57208
- case "binary":
57209
- o3 = b2(this, e4, t3, n3);
57210
- break;
57211
- case "base64":
57212
- i3 = this, u2 = t3, s2 = n3, o3 = f._charsWritten = c(M(e4), i3, u2, s2);
57213
- break;
57214
- case "ucs2":
57215
- case "ucs-2":
57216
- case "utf16le":
57217
- case "utf-16le":
57218
- o3 = m(this, e4, t3, n3);
57219
- break;
57220
- default:
57221
- throw new Error("Unknown encoding");
57222
- }
57223
- return o3;
57224
- }, f.prototype.toString = function(e4, t3, n3) {
57225
- var r3, o3, i3, u2, s2 = this;
57226
- if (e4 = String(e4 || "utf8").toLowerCase(), t3 = Number(t3) || 0, (n3 = void 0 !== n3 ? Number(n3) : s2.length) === t3) return "";
57227
- switch (e4) {
57228
- case "hex":
57229
- r3 = function(e5, t4, n4) {
57230
- var r4 = e5.length;
57231
- (!t4 || t4 < 0) && (t4 = 0);
57232
- (!n4 || n4 < 0 || r4 < n4) && (n4 = r4);
57233
- for (var o4 = "", i4 = t4; i4 < n4; i4++) o4 += k(e5[i4]);
57234
- return o4;
57235
- }(s2, t3, n3);
57236
- break;
57237
- case "utf8":
57238
- case "utf-8":
57239
- r3 = function(e5, t4, n4) {
57240
- var r4 = "", o4 = "";
57241
- n4 = Math.min(e5.length, n4);
57242
- for (var i4 = t4; i4 < n4; i4++) e5[i4] <= 127 ? (r4 += N(o4) + String.fromCharCode(e5[i4]), o4 = "") : o4 += "%" + e5[i4].toString(16);
57243
- return r4 + N(o4);
57244
- }(s2, t3, n3);
57245
- break;
57246
- case "ascii":
57247
- case "binary":
57248
- r3 = v(s2, t3, n3);
57249
- break;
57250
- case "base64":
57251
- o3 = s2, u2 = n3, r3 = 0 === (i3 = t3) && u2 === o3.length ? a2.fromByteArray(o3) : a2.fromByteArray(o3.slice(i3, u2));
57252
- break;
57253
- case "ucs2":
57254
- case "ucs-2":
57255
- case "utf16le":
57256
- case "utf-16le":
57257
- r3 = function(e5, t4, n4) {
57258
- for (var r4 = e5.slice(t4, n4), o4 = "", i4 = 0; i4 < r4.length; i4 += 2) o4 += String.fromCharCode(r4[i4] + 256 * r4[i4 + 1]);
57259
- return o4;
57260
- }(s2, t3, n3);
57261
- break;
57262
- default:
57263
- throw new Error("Unknown encoding");
57264
- }
57265
- return r3;
57266
- }, f.prototype.toJSON = function() {
57267
- return { type: "Buffer", data: Array.prototype.slice.call(this._arr || this, 0) };
57268
- }, f.prototype.copy = function(e4, t3, n3, r3) {
57269
- if (t3 = t3 || 0, (r3 = r3 || 0 === r3 ? r3 : this.length) !== (n3 = n3 || 0) && 0 !== e4.length && 0 !== this.length) {
57270
- d2(n3 <= r3, "sourceEnd < sourceStart"), d2(0 <= t3 && t3 < e4.length, "targetStart out of bounds"), d2(0 <= n3 && n3 < this.length, "sourceStart out of bounds"), d2(0 <= r3 && r3 <= this.length, "sourceEnd out of bounds"), r3 > this.length && (r3 = this.length);
57271
- var o3 = (r3 = e4.length - t3 < r3 - n3 ? e4.length - t3 + n3 : r3) - n3;
57272
- if (o3 < 100 || !f._useTypedArrays) for (var i3 = 0; i3 < o3; i3++) e4[i3 + t3] = this[i3 + n3];
57273
- else e4._set(this.subarray(n3, n3 + o3), t3);
57274
- }
57275
- }, f.prototype.slice = function(e4, t3) {
57276
- var n3 = this.length;
57277
- if (e4 = S(e4, n3, 0), t3 = S(t3, n3, n3), f._useTypedArrays) return f._augment(this.subarray(e4, t3));
57278
- for (var r3 = t3 - e4, o3 = new f(r3, void 0, true), i3 = 0; i3 < r3; i3++) o3[i3] = this[i3 + e4];
57279
- return o3;
57280
- }, f.prototype.get = function(e4) {
57281
- return console.log(".get() is deprecated. Access using array indexes instead."), this.readUInt8(e4);
57282
- }, f.prototype.set = function(e4, t3) {
57283
- return console.log(".set() is deprecated. Access using array indexes instead."), this.writeUInt8(e4, t3);
57284
- }, f.prototype.readUInt8 = function(e4, t3) {
57285
- if (t3 || (d2(null != e4, "missing offset"), d2(e4 < this.length, "Trying to read beyond buffer length")), !(e4 >= this.length)) return this[e4];
57286
- }, f.prototype.readUInt16LE = function(e4, t3) {
57287
- return o2(this, e4, true, t3);
57288
- }, f.prototype.readUInt16BE = function(e4, t3) {
57289
- return o2(this, e4, false, t3);
57290
- }, f.prototype.readUInt32LE = function(e4, t3) {
57291
- return u(this, e4, true, t3);
57292
- }, f.prototype.readUInt32BE = function(e4, t3) {
57293
- return u(this, e4, false, t3);
57294
- }, f.prototype.readInt8 = function(e4, t3) {
57295
- if (t3 || (d2(null != e4, "missing offset"), d2(e4 < this.length, "Trying to read beyond buffer length")), !(e4 >= this.length)) return 128 & this[e4] ? -1 * (255 - this[e4] + 1) : this[e4];
57296
- }, f.prototype.readInt16LE = function(e4, t3) {
57297
- return _(this, e4, true, t3);
57298
- }, f.prototype.readInt16BE = function(e4, t3) {
57299
- return _(this, e4, false, t3);
57300
- }, f.prototype.readInt32LE = function(e4, t3) {
57301
- return E(this, e4, true, t3);
57302
- }, f.prototype.readInt32BE = function(e4, t3) {
57303
- return E(this, e4, false, t3);
57304
- }, f.prototype.readFloatLE = function(e4, t3) {
57305
- return I(this, e4, true, t3);
57306
- }, f.prototype.readFloatBE = function(e4, t3) {
57307
- return I(this, e4, false, t3);
57308
- }, f.prototype.readDoubleLE = function(e4, t3) {
57309
- return A(this, e4, true, t3);
57310
- }, f.prototype.readDoubleBE = function(e4, t3) {
57311
- return A(this, e4, false, t3);
57312
- }, f.prototype.writeUInt8 = function(e4, t3, n3) {
57313
- n3 || (d2(null != e4, "missing value"), d2(null != t3, "missing offset"), d2(t3 < this.length, "trying to write beyond buffer length"), Y(e4, 255)), t3 >= this.length || (this[t3] = e4);
57314
- }, f.prototype.writeUInt16LE = function(e4, t3, n3) {
57315
- s(this, e4, t3, true, n3);
57316
- }, f.prototype.writeUInt16BE = function(e4, t3, n3) {
57317
- s(this, e4, t3, false, n3);
57318
- }, f.prototype.writeUInt32LE = function(e4, t3, n3) {
57319
- l2(this, e4, t3, true, n3);
57320
- }, f.prototype.writeUInt32BE = function(e4, t3, n3) {
57321
- l2(this, e4, t3, false, n3);
57322
- }, f.prototype.writeInt8 = function(e4, t3, n3) {
57323
- n3 || (d2(null != e4, "missing value"), d2(null != t3, "missing offset"), d2(t3 < this.length, "Trying to write beyond buffer length"), F(e4, 127, -128)), t3 >= this.length || (0 <= e4 ? this.writeUInt8(e4, t3, n3) : this.writeUInt8(255 + e4 + 1, t3, n3));
57324
- }, f.prototype.writeInt16LE = function(e4, t3, n3) {
57325
- B(this, e4, t3, true, n3);
57326
- }, f.prototype.writeInt16BE = function(e4, t3, n3) {
57327
- B(this, e4, t3, false, n3);
57328
- }, f.prototype.writeInt32LE = function(e4, t3, n3) {
57329
- L(this, e4, t3, true, n3);
57330
- }, f.prototype.writeInt32BE = function(e4, t3, n3) {
57331
- L(this, e4, t3, false, n3);
57332
- }, f.prototype.writeFloatLE = function(e4, t3, n3) {
57333
- U(this, e4, t3, true, n3);
57334
- }, f.prototype.writeFloatBE = function(e4, t3, n3) {
57335
- U(this, e4, t3, false, n3);
57336
- }, f.prototype.writeDoubleLE = function(e4, t3, n3) {
57337
- x(this, e4, t3, true, n3);
57338
- }, f.prototype.writeDoubleBE = function(e4, t3, n3) {
57339
- x(this, e4, t3, false, n3);
57340
- }, f.prototype.fill = function(e4, t3, n3) {
57341
- if (t3 = t3 || 0, n3 = n3 || this.length, d2("number" == typeof (e4 = "string" == typeof (e4 = e4 || 0) ? e4.charCodeAt(0) : e4) && !isNaN(e4), "value is not a number"), d2(t3 <= n3, "end < start"), n3 !== t3 && 0 !== this.length) {
57342
- d2(0 <= t3 && t3 < this.length, "start out of bounds"), d2(0 <= n3 && n3 <= this.length, "end out of bounds");
57343
- for (var r3 = t3; r3 < n3; r3++) this[r3] = e4;
57344
- }
57345
- }, f.prototype.inspect = function() {
57346
- for (var e4 = [], t3 = this.length, n3 = 0; n3 < t3; n3++) if (e4[n3] = k(this[n3]), n3 === H.INSPECT_MAX_BYTES) {
57347
- e4[n3 + 1] = "...";
57348
- break;
57349
- }
57350
- return "<Buffer " + e4.join(" ") + ">";
57351
- }, f.prototype.toArrayBuffer = function() {
57352
- if ("undefined" == typeof Uint8Array) throw new Error("Buffer.toArrayBuffer not supported in this browser");
57353
- if (f._useTypedArrays) return new f(this).buffer;
57354
- for (var e4 = new Uint8Array(this.length), t3 = 0, n3 = e4.length; t3 < n3; t3 += 1) e4[t3] = this[t3];
57355
- return e4.buffer;
57356
- };
57357
- var t2 = f.prototype;
57358
- function S(e4, t3, n3) {
57359
- return "number" != typeof e4 ? n3 : t3 <= (e4 = ~~e4) ? t3 : 0 <= e4 || 0 <= (e4 += t3) ? e4 : 0;
57360
- }
57361
- function j(e4) {
57362
- return (e4 = ~~Math.ceil(+e4)) < 0 ? 0 : e4;
57363
- }
57364
- function C(e4) {
57365
- return (Array.isArray || function(e5) {
57366
- return "[object Array]" === Object.prototype.toString.call(e5);
57367
- })(e4);
57368
- }
57369
- function k(e4) {
57370
- return e4 < 16 ? "0" + e4.toString(16) : e4.toString(16);
57371
- }
57372
- function T(e4) {
57373
- for (var t3 = [], n3 = 0; n3 < e4.length; n3++) {
57374
- var r3 = e4.charCodeAt(n3);
57375
- if (r3 <= 127) t3.push(e4.charCodeAt(n3));
57376
- else for (var o3 = n3, i3 = (55296 <= r3 && r3 <= 57343 && n3++, encodeURIComponent(e4.slice(o3, n3 + 1)).substr(1).split("%")), u2 = 0; u2 < i3.length; u2++) t3.push(parseInt(i3[u2], 16));
57377
- }
57378
- return t3;
57379
- }
57380
- function M(e4) {
57381
- return a2.toByteArray(e4);
57382
- }
57383
- function c(e4, t3, n3, r3) {
57384
- for (var o3 = 0; o3 < r3 && !(o3 + n3 >= t3.length || o3 >= e4.length); o3++) t3[o3 + n3] = e4[o3];
57385
- return o3;
57386
- }
57387
- function N(e4) {
57388
- try {
57389
- return decodeURIComponent(e4);
57390
- } catch (e5) {
57391
- return String.fromCharCode(65533);
57392
- }
57393
- }
57394
- function Y(e4, t3) {
57395
- d2("number" == typeof e4, "cannot write a non-number as a number"), d2(0 <= e4, "specified a negative value for writing an unsigned value"), d2(e4 <= t3, "value is larger than maximum value for type"), d2(Math.floor(e4) === e4, "value has a fractional component");
57396
- }
57397
- function F(e4, t3, n3) {
57398
- d2("number" == typeof e4, "cannot write a non-number as a number"), d2(e4 <= t3, "value larger than maximum allowed value"), d2(n3 <= e4, "value smaller than minimum allowed value"), d2(Math.floor(e4) === e4, "value has a fractional component");
57399
- }
57400
- function D(e4, t3, n3) {
57401
- d2("number" == typeof e4, "cannot write a non-number as a number"), d2(e4 <= t3, "value larger than maximum allowed value"), d2(n3 <= e4, "value smaller than minimum allowed value");
57402
- }
57403
- function d2(e4, t3) {
57404
- if (!e4) throw new Error(t3 || "Failed assertion");
57405
- }
57406
- f._augment = function(e4) {
57407
- return e4._isBuffer = true, e4._get = e4.get, e4._set = e4.set, e4.get = t2.get, e4.set = t2.set, e4.write = t2.write, e4.toString = t2.toString, e4.toLocaleString = t2.toString, e4.toJSON = t2.toJSON, e4.copy = t2.copy, e4.slice = t2.slice, e4.readUInt8 = t2.readUInt8, e4.readUInt16LE = t2.readUInt16LE, e4.readUInt16BE = t2.readUInt16BE, e4.readUInt32LE = t2.readUInt32LE, e4.readUInt32BE = t2.readUInt32BE, e4.readInt8 = t2.readInt8, e4.readInt16LE = t2.readInt16LE, e4.readInt16BE = t2.readInt16BE, e4.readInt32LE = t2.readInt32LE, e4.readInt32BE = t2.readInt32BE, e4.readFloatLE = t2.readFloatLE, e4.readFloatBE = t2.readFloatBE, e4.readDoubleLE = t2.readDoubleLE, e4.readDoubleBE = t2.readDoubleBE, e4.writeUInt8 = t2.writeUInt8, e4.writeUInt16LE = t2.writeUInt16LE, e4.writeUInt16BE = t2.writeUInt16BE, e4.writeUInt32LE = t2.writeUInt32LE, e4.writeUInt32BE = t2.writeUInt32BE, e4.writeInt8 = t2.writeInt8, e4.writeInt16LE = t2.writeInt16LE, e4.writeInt16BE = t2.writeInt16BE, e4.writeInt32LE = t2.writeInt32LE, e4.writeInt32BE = t2.writeInt32BE, e4.writeFloatLE = t2.writeFloatLE, e4.writeFloatBE = t2.writeFloatBE, e4.writeDoubleLE = t2.writeDoubleLE, e4.writeDoubleBE = t2.writeDoubleBE, e4.fill = t2.fill, e4.inspect = t2.inspect, e4.toArrayBuffer = t2.toArrayBuffer, e4;
57408
- };
57409
- }).call(this, O("lYpoI2"), "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}, O("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/buffer/index.js", "/node_modules/gulp-browserify/node_modules/buffer");
57410
- }, { "base64-js": 2, buffer: 3, ieee754: 10, lYpoI2: 11 }], 4: [function(c, d2, e2) {
57411
- !(function(e3, t2, a2, n2, r2, o2, i2, u, s) {
57412
- var a2 = c("buffer").Buffer, f = 4, l2 = new a2(f);
57413
- l2.fill(0);
57414
- d2.exports = { hash: function(e4, t3, n3, r3) {
57415
- for (var o3 = t3(function(e5, t4) {
57416
- e5.length % f != 0 && (n4 = e5.length + (f - e5.length % f), e5 = a2.concat([e5, l2], n4));
57417
- for (var n4, r4 = [], o4 = t4 ? e5.readInt32BE : e5.readInt32LE, i4 = 0; i4 < e5.length; i4 += f) r4.push(o4.call(e5, i4));
57418
- return r4;
57419
- }(e4 = a2.isBuffer(e4) ? e4 : new a2(e4), r3), 8 * e4.length), t3 = r3, i3 = new a2(n3), u2 = t3 ? i3.writeInt32BE : i3.writeInt32LE, s2 = 0; s2 < o3.length; s2++) u2.call(i3, o3[s2], 4 * s2, true);
57420
- return i3;
57421
- } };
57422
- }).call(this, c("lYpoI2"), "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}, c("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/crypto-browserify/helpers.js", "/node_modules/gulp-browserify/node_modules/crypto-browserify");
57423
- }, { buffer: 3, lYpoI2: 11 }], 5: [function(v, e2, _) {
57424
- !(function(l2, c, u, d2, h, p2, g, y, w2) {
57425
- var u = v("buffer").Buffer, e3 = v("./sha"), t2 = v("./sha256"), n2 = v("./rng"), b2 = { sha1: e3, sha256: t2, md5: v("./md5") }, s = 64, a2 = new u(s);
57426
- function r2(e4, n3) {
57427
- var r3 = b2[e4 = e4 || "sha1"], o3 = [];
57428
- return r3 || i2("algorithm:", e4, "is not yet supported"), { update: function(e5) {
57429
- return u.isBuffer(e5) || (e5 = new u(e5)), o3.push(e5), e5.length, this;
57430
- }, digest: function(e5) {
57431
- var t3 = u.concat(o3), t3 = n3 ? function(e6, t4, n4) {
57432
- u.isBuffer(t4) || (t4 = new u(t4)), u.isBuffer(n4) || (n4 = new u(n4)), t4.length > s ? t4 = e6(t4) : t4.length < s && (t4 = u.concat([t4, a2], s));
57433
- for (var r4 = new u(s), o4 = new u(s), i3 = 0; i3 < s; i3++) r4[i3] = 54 ^ t4[i3], o4[i3] = 92 ^ t4[i3];
57434
- return n4 = e6(u.concat([r4, n4])), e6(u.concat([o4, n4]));
57435
- }(r3, n3, t3) : r3(t3);
57436
- return o3 = null, e5 ? t3.toString(e5) : t3;
57437
- } };
57438
- }
57439
- function i2() {
57440
- var e4 = [].slice.call(arguments).join(" ");
57441
- throw new Error([e4, "we accept pull requests", "http://github.com/dominictarr/crypto-browserify"].join("\n"));
57442
- }
57443
- a2.fill(0), _.createHash = function(e4) {
57444
- return r2(e4);
57445
- }, _.createHmac = r2, _.randomBytes = function(e4, t3) {
57446
- if (!t3 || !t3.call) return new u(n2(e4));
57447
- try {
57448
- t3.call(this, void 0, new u(n2(e4)));
57449
- } catch (e5) {
57450
- t3(e5);
57451
- }
57452
- };
57453
- var o2, f = ["createCredentials", "createCipher", "createCipheriv", "createDecipher", "createDecipheriv", "createSign", "createVerify", "createDiffieHellman", "pbkdf2"], m = function(e4) {
57454
- _[e4] = function() {
57455
- i2("sorry,", e4, "is not implemented yet");
57456
- };
57457
- };
57458
- for (o2 in f) m(f[o2]);
57459
- }).call(this, v("lYpoI2"), "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}, v("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/crypto-browserify/index.js", "/node_modules/gulp-browserify/node_modules/crypto-browserify");
57460
- }, { "./md5": 6, "./rng": 7, "./sha": 8, "./sha256": 9, buffer: 3, lYpoI2: 11 }], 6: [function(w2, b2, e2) {
57461
- !(function(e3, r2, o2, i2, u, a2, f, l2, y) {
57462
- var t2 = w2("./helpers");
57463
- function n2(e4, t3) {
57464
- e4[t3 >> 5] |= 128 << t3 % 32, e4[14 + (t3 + 64 >>> 9 << 4)] = t3;
57465
- for (var n3 = 1732584193, r3 = -271733879, o3 = -1732584194, i3 = 271733878, u2 = 0; u2 < e4.length; u2 += 16) {
57466
- var s2 = n3, a3 = r3, f2 = o3, l3 = i3, n3 = c(n3, r3, o3, i3, e4[u2 + 0], 7, -680876936), i3 = c(i3, n3, r3, o3, e4[u2 + 1], 12, -389564586), o3 = c(o3, i3, n3, r3, e4[u2 + 2], 17, 606105819), r3 = c(r3, o3, i3, n3, e4[u2 + 3], 22, -1044525330);
57467
- n3 = c(n3, r3, o3, i3, e4[u2 + 4], 7, -176418897), i3 = c(i3, n3, r3, o3, e4[u2 + 5], 12, 1200080426), o3 = c(o3, i3, n3, r3, e4[u2 + 6], 17, -1473231341), r3 = c(r3, o3, i3, n3, e4[u2 + 7], 22, -45705983), n3 = c(n3, r3, o3, i3, e4[u2 + 8], 7, 1770035416), i3 = c(i3, n3, r3, o3, e4[u2 + 9], 12, -1958414417), o3 = c(o3, i3, n3, r3, e4[u2 + 10], 17, -42063), r3 = c(r3, o3, i3, n3, e4[u2 + 11], 22, -1990404162), n3 = c(n3, r3, o3, i3, e4[u2 + 12], 7, 1804603682), i3 = c(i3, n3, r3, o3, e4[u2 + 13], 12, -40341101), o3 = c(o3, i3, n3, r3, e4[u2 + 14], 17, -1502002290), n3 = d2(n3, r3 = c(r3, o3, i3, n3, e4[u2 + 15], 22, 1236535329), o3, i3, e4[u2 + 1], 5, -165796510), i3 = d2(i3, n3, r3, o3, e4[u2 + 6], 9, -1069501632), o3 = d2(o3, i3, n3, r3, e4[u2 + 11], 14, 643717713), r3 = d2(r3, o3, i3, n3, e4[u2 + 0], 20, -373897302), n3 = d2(n3, r3, o3, i3, e4[u2 + 5], 5, -701558691), i3 = d2(i3, n3, r3, o3, e4[u2 + 10], 9, 38016083), o3 = d2(o3, i3, n3, r3, e4[u2 + 15], 14, -660478335), r3 = d2(r3, o3, i3, n3, e4[u2 + 4], 20, -405537848), n3 = d2(n3, r3, o3, i3, e4[u2 + 9], 5, 568446438), i3 = d2(i3, n3, r3, o3, e4[u2 + 14], 9, -1019803690), o3 = d2(o3, i3, n3, r3, e4[u2 + 3], 14, -187363961), r3 = d2(r3, o3, i3, n3, e4[u2 + 8], 20, 1163531501), n3 = d2(n3, r3, o3, i3, e4[u2 + 13], 5, -1444681467), i3 = d2(i3, n3, r3, o3, e4[u2 + 2], 9, -51403784), o3 = d2(o3, i3, n3, r3, e4[u2 + 7], 14, 1735328473), n3 = h(n3, r3 = d2(r3, o3, i3, n3, e4[u2 + 12], 20, -1926607734), o3, i3, e4[u2 + 5], 4, -378558), i3 = h(i3, n3, r3, o3, e4[u2 + 8], 11, -2022574463), o3 = h(o3, i3, n3, r3, e4[u2 + 11], 16, 1839030562), r3 = h(r3, o3, i3, n3, e4[u2 + 14], 23, -35309556), n3 = h(n3, r3, o3, i3, e4[u2 + 1], 4, -1530992060), i3 = h(i3, n3, r3, o3, e4[u2 + 4], 11, 1272893353), o3 = h(o3, i3, n3, r3, e4[u2 + 7], 16, -155497632), r3 = h(r3, o3, i3, n3, e4[u2 + 10], 23, -1094730640), n3 = h(n3, r3, o3, i3, e4[u2 + 13], 4, 681279174), i3 = h(i3, n3, r3, o3, e4[u2 + 0], 11, -358537222), o3 = h(o3, i3, n3, r3, e4[u2 + 3], 16, -722521979), r3 = h(r3, o3, i3, n3, e4[u2 + 6], 23, 76029189), n3 = h(n3, r3, o3, i3, e4[u2 + 9], 4, -640364487), i3 = h(i3, n3, r3, o3, e4[u2 + 12], 11, -421815835), o3 = h(o3, i3, n3, r3, e4[u2 + 15], 16, 530742520), n3 = p2(n3, r3 = h(r3, o3, i3, n3, e4[u2 + 2], 23, -995338651), o3, i3, e4[u2 + 0], 6, -198630844), i3 = p2(i3, n3, r3, o3, e4[u2 + 7], 10, 1126891415), o3 = p2(o3, i3, n3, r3, e4[u2 + 14], 15, -1416354905), r3 = p2(r3, o3, i3, n3, e4[u2 + 5], 21, -57434055), n3 = p2(n3, r3, o3, i3, e4[u2 + 12], 6, 1700485571), i3 = p2(i3, n3, r3, o3, e4[u2 + 3], 10, -1894986606), o3 = p2(o3, i3, n3, r3, e4[u2 + 10], 15, -1051523), r3 = p2(r3, o3, i3, n3, e4[u2 + 1], 21, -2054922799), n3 = p2(n3, r3, o3, i3, e4[u2 + 8], 6, 1873313359), i3 = p2(i3, n3, r3, o3, e4[u2 + 15], 10, -30611744), o3 = p2(o3, i3, n3, r3, e4[u2 + 6], 15, -1560198380), r3 = p2(r3, o3, i3, n3, e4[u2 + 13], 21, 1309151649), n3 = p2(n3, r3, o3, i3, e4[u2 + 4], 6, -145523070), i3 = p2(i3, n3, r3, o3, e4[u2 + 11], 10, -1120210379), o3 = p2(o3, i3, n3, r3, e4[u2 + 2], 15, 718787259), r3 = p2(r3, o3, i3, n3, e4[u2 + 9], 21, -343485551), n3 = g(n3, s2), r3 = g(r3, a3), o3 = g(o3, f2), i3 = g(i3, l3);
57468
- }
57469
- return Array(n3, r3, o3, i3);
57470
- }
57471
- function s(e4, t3, n3, r3, o3, i3) {
57472
- return g((t3 = g(g(t3, e4), g(r3, i3))) << o3 | t3 >>> 32 - o3, n3);
57473
- }
57474
- function c(e4, t3, n3, r3, o3, i3, u2) {
57475
- return s(t3 & n3 | ~t3 & r3, e4, t3, o3, i3, u2);
57476
- }
57477
- function d2(e4, t3, n3, r3, o3, i3, u2) {
57478
- return s(t3 & r3 | n3 & ~r3, e4, t3, o3, i3, u2);
57479
- }
57480
- function h(e4, t3, n3, r3, o3, i3, u2) {
57481
- return s(t3 ^ n3 ^ r3, e4, t3, o3, i3, u2);
57482
- }
57483
- function p2(e4, t3, n3, r3, o3, i3, u2) {
57484
- return s(n3 ^ (t3 | ~r3), e4, t3, o3, i3, u2);
57485
- }
57486
- function g(e4, t3) {
57487
- var n3 = (65535 & e4) + (65535 & t3);
57488
- return (e4 >> 16) + (t3 >> 16) + (n3 >> 16) << 16 | 65535 & n3;
57489
- }
57490
- b2.exports = function(e4) {
57491
- return t2.hash(e4, n2, 16);
57492
- };
57493
- }).call(this, w2("lYpoI2"), "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}, w2("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js", "/node_modules/gulp-browserify/node_modules/crypto-browserify");
57494
- }, { "./helpers": 4, buffer: 3, lYpoI2: 11 }], 7: [function(e2, l2, t2) {
57495
- !(function(e3, t3, n2, r2, o2, i2, u, s, f) {
57496
- l2.exports = function(e4) {
57497
- for (var t4, n3 = new Array(e4), r3 = 0; r3 < e4; r3++) 0 == (3 & r3) && (t4 = 4294967296 * Math.random()), n3[r3] = t4 >>> ((3 & r3) << 3) & 255;
57498
- return n3;
57499
- };
57500
- }).call(this, e2("lYpoI2"), "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}, e2("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js", "/node_modules/gulp-browserify/node_modules/crypto-browserify");
57501
- }, { buffer: 3, lYpoI2: 11 }], 8: [function(c, d2, e2) {
57502
- !(function(e3, t2, n2, r2, o2, s, a2, f, l2) {
57503
- var i2 = c("./helpers");
57504
- function u(l3, c2) {
57505
- l3[c2 >> 5] |= 128 << 24 - c2 % 32, l3[15 + (c2 + 64 >> 9 << 4)] = c2;
57506
- for (var e4, t3, n3, r3 = Array(80), o3 = 1732584193, i3 = -271733879, u2 = -1732584194, s2 = 271733878, d3 = -1009589776, h = 0; h < l3.length; h += 16) {
57507
- for (var p2 = o3, g = i3, y = u2, w2 = s2, b2 = d3, a3 = 0; a3 < 80; a3++) {
57508
- r3[a3] = a3 < 16 ? l3[h + a3] : v(r3[a3 - 3] ^ r3[a3 - 8] ^ r3[a3 - 14] ^ r3[a3 - 16], 1);
57509
- var f2 = m(m(v(o3, 5), (f2 = i3, t3 = u2, n3 = s2, (e4 = a3) < 20 ? f2 & t3 | ~f2 & n3 : !(e4 < 40) && e4 < 60 ? f2 & t3 | f2 & n3 | t3 & n3 : f2 ^ t3 ^ n3)), m(m(d3, r3[a3]), (e4 = a3) < 20 ? 1518500249 : e4 < 40 ? 1859775393 : e4 < 60 ? -1894007588 : -899497514)), d3 = s2, s2 = u2, u2 = v(i3, 30), i3 = o3, o3 = f2;
57510
- }
57511
- o3 = m(o3, p2), i3 = m(i3, g), u2 = m(u2, y), s2 = m(s2, w2), d3 = m(d3, b2);
57512
- }
57513
- return Array(o3, i3, u2, s2, d3);
57514
- }
57515
- function m(e4, t3) {
57516
- var n3 = (65535 & e4) + (65535 & t3);
57517
- return (e4 >> 16) + (t3 >> 16) + (n3 >> 16) << 16 | 65535 & n3;
57518
- }
57519
- function v(e4, t3) {
57520
- return e4 << t3 | e4 >>> 32 - t3;
57521
- }
57522
- d2.exports = function(e4) {
57523
- return i2.hash(e4, u, 20, true);
57524
- };
57525
- }).call(this, c("lYpoI2"), "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}, c("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js", "/node_modules/gulp-browserify/node_modules/crypto-browserify");
57526
- }, { "./helpers": 4, buffer: 3, lYpoI2: 11 }], 9: [function(c, d2, e2) {
57527
- !(function(e3, t2, n2, r2, u, s, a2, f, l2) {
57528
- function b2(e4, t3) {
57529
- var n3 = (65535 & e4) + (65535 & t3);
57530
- return (e4 >> 16) + (t3 >> 16) + (n3 >> 16) << 16 | 65535 & n3;
57531
- }
57532
- function o2(e4, l3) {
57533
- var c2, d3 = new Array(1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298), t3 = new Array(1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225), n3 = new Array(64);
57534
- e4[l3 >> 5] |= 128 << 24 - l3 % 32, e4[15 + (l3 + 64 >> 9 << 4)] = l3;
57535
- for (var r3, o3, h = 0; h < e4.length; h += 16) {
57536
- for (var i3 = t3[0], u2 = t3[1], s2 = t3[2], p2 = t3[3], a3 = t3[4], g = t3[5], y = t3[6], w2 = t3[7], f2 = 0; f2 < 64; f2++) n3[f2] = f2 < 16 ? e4[f2 + h] : b2(b2(b2((o3 = n3[f2 - 2], m(o3, 17) ^ m(o3, 19) ^ v(o3, 10)), n3[f2 - 7]), (o3 = n3[f2 - 15], m(o3, 7) ^ m(o3, 18) ^ v(o3, 3))), n3[f2 - 16]), c2 = b2(b2(b2(b2(w2, m(o3 = a3, 6) ^ m(o3, 11) ^ m(o3, 25)), a3 & g ^ ~a3 & y), d3[f2]), n3[f2]), r3 = b2(m(r3 = i3, 2) ^ m(r3, 13) ^ m(r3, 22), i3 & u2 ^ i3 & s2 ^ u2 & s2), w2 = y, y = g, g = a3, a3 = b2(p2, c2), p2 = s2, s2 = u2, u2 = i3, i3 = b2(c2, r3);
57537
- t3[0] = b2(i3, t3[0]), t3[1] = b2(u2, t3[1]), t3[2] = b2(s2, t3[2]), t3[3] = b2(p2, t3[3]), t3[4] = b2(a3, t3[4]), t3[5] = b2(g, t3[5]), t3[6] = b2(y, t3[6]), t3[7] = b2(w2, t3[7]);
57538
- }
57539
- return t3;
57540
- }
57541
- var i2 = c("./helpers"), m = function(e4, t3) {
57542
- return e4 >>> t3 | e4 << 32 - t3;
57543
- }, v = function(e4, t3) {
57544
- return e4 >>> t3;
57545
- };
57546
- d2.exports = function(e4) {
57547
- return i2.hash(e4, o2, 32, true);
57548
- };
57549
- }).call(this, c("lYpoI2"), "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}, c("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js", "/node_modules/gulp-browserify/node_modules/crypto-browserify");
57550
- }, { "./helpers": 4, buffer: 3, lYpoI2: 11 }], 10: [function(e2, t2, f) {
57551
- !(function(e3, t3, n2, r2, o2, i2, u, s, a2) {
57552
- f.read = function(e4, t4, n3, r3, o3) {
57553
- var i3, u2, l2 = 8 * o3 - r3 - 1, c = (1 << l2) - 1, d2 = c >> 1, s2 = -7, a3 = n3 ? o3 - 1 : 0, f2 = n3 ? -1 : 1, o3 = e4[t4 + a3];
57554
- for (a3 += f2, i3 = o3 & (1 << -s2) - 1, o3 >>= -s2, s2 += l2; 0 < s2; i3 = 256 * i3 + e4[t4 + a3], a3 += f2, s2 -= 8) ;
57555
- for (u2 = i3 & (1 << -s2) - 1, i3 >>= -s2, s2 += r3; 0 < s2; u2 = 256 * u2 + e4[t4 + a3], a3 += f2, s2 -= 8) ;
57556
- if (0 === i3) i3 = 1 - d2;
57557
- else {
57558
- if (i3 === c) return u2 ? NaN : 1 / 0 * (o3 ? -1 : 1);
57559
- u2 += Math.pow(2, r3), i3 -= d2;
57560
- }
57561
- return (o3 ? -1 : 1) * u2 * Math.pow(2, i3 - r3);
57562
- }, f.write = function(e4, t4, l2, n3, r3, c) {
57563
- var o3, i3, u2 = 8 * c - r3 - 1, s2 = (1 << u2) - 1, a3 = s2 >> 1, d2 = 23 === r3 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, f2 = n3 ? 0 : c - 1, h = n3 ? 1 : -1, c = t4 < 0 || 0 === t4 && 1 / t4 < 0 ? 1 : 0;
57564
- for (t4 = Math.abs(t4), isNaN(t4) || t4 === 1 / 0 ? (i3 = isNaN(t4) ? 1 : 0, o3 = s2) : (o3 = Math.floor(Math.log(t4) / Math.LN2), t4 * (n3 = Math.pow(2, -o3)) < 1 && (o3--, n3 *= 2), 2 <= (t4 += 1 <= o3 + a3 ? d2 / n3 : d2 * Math.pow(2, 1 - a3)) * n3 && (o3++, n3 /= 2), s2 <= o3 + a3 ? (i3 = 0, o3 = s2) : 1 <= o3 + a3 ? (i3 = (t4 * n3 - 1) * Math.pow(2, r3), o3 += a3) : (i3 = t4 * Math.pow(2, a3 - 1) * Math.pow(2, r3), o3 = 0)); 8 <= r3; e4[l2 + f2] = 255 & i3, f2 += h, i3 /= 256, r3 -= 8) ;
57565
- for (o3 = o3 << r3 | i3, u2 += r3; 0 < u2; e4[l2 + f2] = 255 & o3, f2 += h, o3 /= 256, u2 -= 8) ;
57566
- e4[l2 + f2 - h] |= 128 * c;
57567
- };
57568
- }).call(this, e2("lYpoI2"), "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}, e2("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/ieee754/index.js", "/node_modules/gulp-browserify/node_modules/ieee754");
57569
- }, { buffer: 3, lYpoI2: 11 }], 11: [function(e2, h, t2) {
57570
- !(function(e3, t3, n2, r2, o2, f, l2, c, d2) {
57571
- var i2, u, s;
57572
- function a2() {
57573
- }
57574
- (e3 = h.exports = {}).nextTick = (u = "undefined" != typeof window && window.setImmediate, s = "undefined" != typeof window && window.postMessage && window.addEventListener, u ? function(e4) {
57575
- return window.setImmediate(e4);
57576
- } : s ? (i2 = [], window.addEventListener("message", function(e4) {
57577
- var t4 = e4.source;
57578
- t4 !== window && null !== t4 || "process-tick" !== e4.data || (e4.stopPropagation(), 0 < i2.length && i2.shift()());
57579
- }, true), function(e4) {
57580
- i2.push(e4), window.postMessage("process-tick", "*");
57581
- }) : function(e4) {
57582
- setTimeout(e4, 0);
57583
- }), e3.title = "browser", e3.browser = true, e3.env = {}, e3.argv = [], e3.on = a2, e3.addListener = a2, e3.once = a2, e3.off = a2, e3.removeListener = a2, e3.removeAllListeners = a2, e3.emit = a2, e3.binding = function(e4) {
57584
- throw new Error("process.binding is not supported");
57585
- }, e3.cwd = function() {
57586
- return "/";
57587
- }, e3.chdir = function(e4) {
57588
- throw new Error("process.chdir is not supported");
57589
- };
57590
- }).call(this, e2("lYpoI2"), "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}, e2("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/process/browser.js", "/node_modules/gulp-browserify/node_modules/process");
57591
- }, { buffer: 3, lYpoI2: 11 }] }, {}, [1])(1);
57592
- });
57593
- })(object_hash);
57594
- return object_hash.exports;
57595
- }
57596
- var object_hashExports = requireObject_hash();
57597
- const hash = /* @__PURE__ */ getDefaultExportFromCjs(object_hashExports);
57598
- function hashObject(obj) {
57599
- return hash(obj, { unorderedArrays: true, unorderedObjects: true, unorderedSets: true });
57600
- }
57601
- function getUniqueIdentifier(variable) {
57602
- let identifier = variable.uid;
57603
- if ("nested" in variable) {
57604
- identifier += variable.nested.join(",");
57605
- }
57606
- if ("filters" in variable && variable.filters) {
57607
- identifier += hashObject(variable.filters);
57608
- }
57609
- return identifier;
57610
- }
57611
57019
  function isPlaceholder(value) {
57612
57020
  return typeof value === "object" && "__ref" in value;
57613
57021
  }
@@ -57616,9 +57024,6 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
57616
57024
  if ("nested" in variable && variable.nested.length > 0) {
57617
57025
  id += `:${variable.nested.join(",")}`;
57618
57026
  }
57619
- if ("filters" in variable) {
57620
- id += `:${hashObject(variable.filters)}`;
57621
- }
57622
57027
  return id;
57623
57028
  }
57624
57029
  function getEntries(obj) {
@@ -57649,7 +57054,7 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
57649
57054
  const normalizedValues = [];
57650
57055
  let lookup = {};
57651
57056
  for (const [key, val] of resolved.values.entries()) {
57652
- if (isResolvedDerivedVariable(val) || isResolvedDerivedDataVariable(val)) {
57057
+ if (isResolvedDerivedVariable(val)) {
57653
57058
  const { data: nestedNormalized, lookup: nestedLookup } = normalizeResolvedDerivedVariable(
57654
57059
  val,
57655
57060
  def.variables[key]
@@ -57686,7 +57091,7 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
57686
57091
  const kwargDef = kwargsDefinition[key];
57687
57092
  if (!kwargDef) {
57688
57093
  data[key] = val;
57689
- } else if (isDerivedVariable(kwargDef) || isDerivedDataVariable(kwargDef)) {
57094
+ } else if (isDerivedVariable(kwargDef)) {
57690
57095
  const { data: nestedData, lookup: nestedLookup } = normalizeResolvedDerivedVariable(val, kwargDef);
57691
57096
  data[key] = nestedData;
57692
57097
  lookup = {
@@ -57778,7 +57183,13 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
57778
57183
  await validateResponse(res, `Failed to cancel task with id: ${taskId}`);
57779
57184
  return true;
57780
57185
  }
57781
- const dataRegistry = /* @__PURE__ */ new Map();
57186
+ function getUniqueIdentifier(variable) {
57187
+ let identifier = variable.uid;
57188
+ if ("nested" in variable) {
57189
+ identifier += variable.nested.join(",");
57190
+ }
57191
+ return identifier;
57192
+ }
57782
57193
  const atomRegistry = /* @__PURE__ */ new Map();
57783
57194
  const atomFamilyRegistry = /* @__PURE__ */ new Map();
57784
57195
  const atomFamilyMembersRegistry = /* @__PURE__ */ new Map();
@@ -57795,7 +57206,6 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
57795
57206
  }
57796
57207
  function clearRegistries_TEST() {
57797
57208
  for (const registry of [
57798
- dataRegistry,
57799
57209
  atomRegistry,
57800
57210
  atomFamilyRegistry,
57801
57211
  atomFamilyMembersRegistry,
@@ -57812,6 +57222,7 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
57812
57222
  return false;
57813
57223
  }
57814
57224
  switch (variable.__typename) {
57225
+ case "ServerVariable":
57815
57226
  case "Variable": {
57816
57227
  if (atomRegistry.has(variable.uid)) {
57817
57228
  return true;
@@ -57822,17 +57233,10 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
57822
57233
  }
57823
57234
  return atomFamilyMembersRegistry.get(family).size > 0;
57824
57235
  }
57825
- case "UrlVariable":
57826
- case "DataVariable":
57827
- return atomRegistry.has(variable.uid);
57828
57236
  case "DerivedVariable": {
57829
57237
  const key = getRegistryKey(variable, "selector");
57830
57238
  return selectorFamilyRegistry.has(key);
57831
57239
  }
57832
- case "DerivedDataVariable": {
57833
- const key = getRegistryKey(variable, "selector");
57834
- return selectorFamilyRegistry.has(key);
57835
- }
57836
57240
  default:
57837
57241
  return false;
57838
57242
  }
@@ -58095,8 +57499,9 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
58095
57499
  console.warn("No valid theme was found. Defaulting to light theme.");
58096
57500
  return theme;
58097
57501
  }
58098
- function useDeferLoadable(loadable) {
58099
- const { suspend } = useFallbackCtx();
57502
+ function useDeferLoadable(loadable, suspendOverride) {
57503
+ const { suspend: ctxSuspend } = useFallbackCtx();
57504
+ const suspend = suspendOverride ?? ctxSuspend;
58100
57505
  const [availableState, setAvailableState] = React$1.useState(() => loadable.getValue());
58101
57506
  const timerId = React$1.useRef(null);
58102
57507
  const isFirstRender = React$1.useRef(true);
@@ -58258,16 +57663,9 @@ Inferred class string: "${iconClasses}."`
58258
57663
  return /* @__PURE__ */ React__namespace.createElement(EventBusContext.Provider, { value: bus }, children);
58259
57664
  }
58260
57665
  class StateSynchronizer {
58261
- static #instance;
58262
- #observers = /* @__PURE__ */ new Map();
58263
- // eslint-disable-next-line no-useless-constructor, no-empty-function
57666
+ #observers;
58264
57667
  constructor() {
58265
- }
58266
- static getInstance() {
58267
- if (!StateSynchronizer.#instance) {
58268
- StateSynchronizer.#instance = new StateSynchronizer();
58269
- }
58270
- return StateSynchronizer.#instance;
57668
+ this.#observers = /* @__PURE__ */ new Map();
58271
57669
  }
58272
57670
  /**
58273
57671
  * Register a key in the state synchronizer
@@ -58329,6 +57727,7 @@ Inferred class string: "${iconClasses}."`
58329
57727
  this.#observers.get(key).next(update);
58330
57728
  }
58331
57729
  }
57730
+ const STATE_SYNCHRONIZER$1 = new StateSynchronizer();
58332
57731
  function getOrRegisterPlainVariable(variable, wsClient, taskContext, extras) {
58333
57732
  const isNested = variable.nested && variable.nested.length > 0;
58334
57733
  const isDefaultDerived = isDerivedVariable(variable.default);
@@ -58352,15 +57751,15 @@ Inferred class string: "${iconClasses}."`
58352
57751
  ) : variable.default,
58353
57752
  effects: (extrasSerializable2) => {
58354
57753
  const familySync = ({ onSet, setSelf, resetSelf, node }) => {
58355
- if (!StateSynchronizer.getInstance().isRegistered(variable.uid)) {
58356
- StateSynchronizer.getInstance().register(variable.uid, variable.default);
57754
+ if (!STATE_SYNCHRONIZER$1.isRegistered(variable.uid)) {
57755
+ STATE_SYNCHRONIZER$1.register(variable.uid, variable.default);
58357
57756
  } else {
58358
- const currentState = StateSynchronizer.getInstance().getCurrentState(variable.uid);
57757
+ const currentState = STATE_SYNCHRONIZER$1.getCurrentState(variable.uid);
58359
57758
  if (!isDefaultDerived || currentState?.type !== "initial") {
58360
57759
  setSelf(currentState?.value);
58361
57760
  }
58362
57761
  }
58363
- const unsub = StateSynchronizer.getInstance().subscribe(variable.uid, (update) => {
57762
+ const unsub = STATE_SYNCHRONIZER$1.subscribe(variable.uid, (update) => {
58364
57763
  if (update.type === "initial") {
58365
57764
  return;
58366
57765
  }
@@ -58374,7 +57773,7 @@ Inferred class string: "${iconClasses}."`
58374
57773
  }
58375
57774
  });
58376
57775
  onSet((newValue, oldValue, isReset) => {
58377
- StateSynchronizer.getInstance().notify(variable.uid, {
57776
+ STATE_SYNCHRONIZER$1.notify(variable.uid, {
58378
57777
  isReset,
58379
57778
  nodeKey: node.key,
58380
57779
  oldValue,
@@ -58388,12 +57787,15 @@ Inferred class string: "${iconClasses}."`
58388
57787
  const storeEffect = getEffect(variable);
58389
57788
  if (storeEffect) {
58390
57789
  effects.push(storeEffect(variable, extrasSerializable2, wsClient, taskContext));
58391
- } else {
58392
- if (variable.persist_value || isEmbedded()) {
58393
- effects.push(
58394
- STORES.BrowserStore.effect(variable, extrasSerializable2, wsClient, taskContext)
58395
- );
58396
- }
57790
+ } else if (isEmbedded()) {
57791
+ effects.push(
57792
+ STORES.BrowserStore.effect(
57793
+ variable,
57794
+ extrasSerializable2,
57795
+ wsClient,
57796
+ taskContext
57797
+ )
57798
+ );
58397
57799
  }
58398
57800
  return effects;
58399
57801
  },
@@ -58440,6 +57842,108 @@ Inferred class string: "${iconClasses}."`
58440
57842
  }
58441
57843
  return atomInstance;
58442
57844
  }
57845
+ function createDataUrl(path, pagination) {
57846
+ const url = new URL(path, window.location.origin);
57847
+ if (pagination?.limit) {
57848
+ url.searchParams.set("limit", String(pagination.limit));
57849
+ }
57850
+ if (pagination?.offset) {
57851
+ url.searchParams.set("offset", String(pagination.offset));
57852
+ }
57853
+ if (pagination?.sort) {
57854
+ url.searchParams.set("order_by", (pagination.sort.desc ? "-" : "") + pagination.sort.id);
57855
+ }
57856
+ if (pagination?.index) {
57857
+ url.searchParams.set("index", String(pagination.index));
57858
+ }
57859
+ return url;
57860
+ }
57861
+ async function validateTabularResponse(uid2, response) {
57862
+ if (response.status === 415) {
57863
+ let msg = `The requested variable ${uid2} data is not tabular`;
57864
+ try {
57865
+ const data = await response.json();
57866
+ if ("detail" in data) {
57867
+ msg += `. ${data.detail}`;
57868
+ }
57869
+ } catch {
57870
+ }
57871
+ throw new UserError(msg);
57872
+ }
57873
+ }
57874
+ function isDataResponse(response) {
57875
+ return response && typeof response === "object" && "data" in response && "count" in response;
57876
+ }
57877
+ async function fetchTabularServerVariable({
57878
+ variable,
57879
+ // Explicitly unused, required for the callback dependency to ensure its identity changes
57880
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
57881
+ seqNumber,
57882
+ wsClient,
57883
+ extras,
57884
+ filters = null,
57885
+ pagination = null
57886
+ }) {
57887
+ const url = createDataUrl(`/api/core/tabular-variable/${variable.uid}`, pagination);
57888
+ const body = {
57889
+ filters: filters ?? null,
57890
+ ws_channel: await wsClient.getChannel()
57891
+ };
57892
+ const response = await request(url, { body: JSON.stringify(body), method: HTTP_METHOD.POST }, extras);
57893
+ await handleAuthErrors(response, true);
57894
+ await validateTabularResponse(variable.uid, response);
57895
+ await validateResponse(response, "Failed to fetch tabular data");
57896
+ return response.json();
57897
+ }
57898
+ function useFetchTabularServerVariable(variable, seqNumber, wsClient, extras) {
57899
+ return React$1.useCallback(
57900
+ async (filters, pagination) => {
57901
+ return fetchTabularServerVariable({ variable, seqNumber, wsClient, extras, filters, pagination });
57902
+ },
57903
+ [wsClient, variable, seqNumber, extras]
57904
+ );
57905
+ }
57906
+ function useFetchTabularDerivedVariable(variable, dvResult, wsClient, taskContext, extras) {
57907
+ const previousResult = React$1.useRef({
57908
+ data: null,
57909
+ count: 0,
57910
+ schema: { fields: [], primaryKey: [] }
57911
+ });
57912
+ return React$1.useCallback(
57913
+ async (filters, pagination) => {
57914
+ const url = createDataUrl(`/api/core/tabular-variable/${variable.uid}`, pagination);
57915
+ const body = {
57916
+ filters: filters ?? null,
57917
+ ws_channel: await wsClient.getChannel(),
57918
+ dv_values: normalizeRequest(cleanArgs(dvResult.values), variable.variables)
57919
+ };
57920
+ const response = await request(url, { body: JSON.stringify(body), method: HTTP_METHOD.POST }, extras);
57921
+ await handleAuthErrors(response, true);
57922
+ await validateTabularResponse(variable.uid, response);
57923
+ await validateResponse(response, "Failed to fetch tabular data");
57924
+ const responseJson = await response.json();
57925
+ const variableTaskId = `${variable.uid}-filter`;
57926
+ taskContext.cleanupRunningTasks(variableTaskId);
57927
+ if (!("task_id" in responseJson)) {
57928
+ previousResult.current = responseJson;
57929
+ return responseJson;
57930
+ }
57931
+ const taskId = responseJson.task_id;
57932
+ taskContext.startTask(taskId, variableTaskId);
57933
+ try {
57934
+ await wsClient.waitForTask(taskId);
57935
+ } catch {
57936
+ return previousResult.current;
57937
+ } finally {
57938
+ taskContext.endTask(taskId);
57939
+ }
57940
+ const taskResult = await fetchTaskResult(taskId, extras);
57941
+ previousResult.current = taskResult;
57942
+ return taskResult;
57943
+ },
57944
+ [variable.uid, variable.variables, dvResult, wsClient, taskContext, extras]
57945
+ );
57946
+ }
58443
57947
  function _defineProperty(obj, key, value) {
58444
57948
  if (key in obj) {
58445
57949
  Object.defineProperty(obj, key, {
@@ -58784,183 +58288,109 @@ Inferred class string: "${iconClasses}."`
58784
58288
  mixed: mixed$1
58785
58289
  };
58786
58290
  var Refine_index_6 = Refine_index.mixed;
58787
- function getOrRegisterUrlVariable(variable) {
58788
- if (!atomRegistry.has(variable.uid)) {
58789
- atomRegistry.set(
58291
+ const STORE_EXTRAS_MAP$1 = /* @__PURE__ */ new Map();
58292
+ function serverSyncEffect(variable, requestExtras) {
58293
+ STORE_EXTRAS_MAP$1.set(variable.uid, requestExtras);
58294
+ return RecoilSync_index_2({
58295
+ /** Use store uid as the unique identifier */
58296
+ itemKey: variable.uid,
58297
+ refine: Refine_index_6(),
58298
+ storeKey: "ServerVariable"
58299
+ });
58300
+ }
58301
+ const STATE_SYNCHRONIZER = new StateSynchronizer();
58302
+ function getOrRegisterServerVariable(variable, extras) {
58303
+ if (!atomFamilyRegistry.has(variable.uid)) {
58304
+ atomFamilyRegistry.set(
58790
58305
  variable.uid,
58791
- Recoil_index_8({
58792
- default: variable.default,
58793
- effects: [
58794
- RecoilSync_index_6({
58795
- history: "push",
58796
- itemKey: variable.query,
58797
- refine: Refine_index_6()
58798
- })
58799
- ],
58306
+ Recoil_index_10({
58307
+ // NOTE: No default provided, atom starts in a pending state
58308
+ effects: (extrasSerializable2) => {
58309
+ const familySync = ({ onSet, setSelf, resetSelf, node }) => {
58310
+ if (!STATE_SYNCHRONIZER.isRegistered(variable.uid)) {
58311
+ STATE_SYNCHRONIZER.register(variable.uid, null);
58312
+ } else {
58313
+ const currentState = STATE_SYNCHRONIZER.getCurrentState(variable.uid);
58314
+ if (currentState?.type !== "initial") {
58315
+ setSelf(currentState?.value);
58316
+ }
58317
+ }
58318
+ const unsub = STATE_SYNCHRONIZER.subscribe(variable.uid, (update) => {
58319
+ if (update.type === "initial") {
58320
+ return;
58321
+ }
58322
+ if (update.nodeKey === node.key) {
58323
+ return;
58324
+ }
58325
+ if (update.isReset) {
58326
+ resetSelf();
58327
+ } else {
58328
+ setSelf(update.value);
58329
+ }
58330
+ });
58331
+ onSet((newValue, oldValue, isReset) => {
58332
+ STATE_SYNCHRONIZER.notify(variable.uid, {
58333
+ isReset,
58334
+ nodeKey: node.key,
58335
+ oldValue,
58336
+ type: "update",
58337
+ value: newValue
58338
+ });
58339
+ });
58340
+ return unsub;
58341
+ };
58342
+ return [familySync, serverSyncEffect(variable, extrasSerializable2)];
58343
+ },
58800
58344
  key: variable.uid
58801
58345
  })
58802
58346
  );
58803
58347
  }
58804
- return atomRegistry.get(variable.uid);
58805
- }
58806
- function useUrlVariable(variable) {
58807
- return Recoil_index_22(getOrRegisterUrlVariable(variable));
58808
- }
58809
- function combineFilters(combinator, queries) {
58810
- const validQueries = queries.filter(Boolean);
58811
- if (validQueries.length === 0) {
58812
- return null;
58813
- }
58814
- if (validQueries.length === 1) {
58815
- return validQueries[0];
58348
+ const family = atomFamilyRegistry.get(variable.uid);
58349
+ const extrasSerializable = new RequestExtrasSerializable(extras);
58350
+ const atomInstance = family(extrasSerializable);
58351
+ if (!atomFamilyMembersRegistry.has(family)) {
58352
+ atomFamilyMembersRegistry.set(family, /* @__PURE__ */ new Map());
58816
58353
  }
58817
- return {
58818
- clauses: validQueries,
58819
- combinator
58820
- };
58354
+ atomFamilyMembersRegistry.get(family).set(extrasSerializable.toJSON(), atomInstance);
58355
+ return atomInstance;
58821
58356
  }
58822
- function resolveDataVariable(variable) {
58357
+ async function resolveServerVariable(variable, extras, resolver) {
58358
+ const atom2 = getOrRegisterServerVariable(variable, extras);
58359
+ const seqNumber = await resolver(atom2);
58823
58360
  return {
58824
- filters: variable.filters,
58825
- type: "data",
58826
- uid: variable.uid
58361
+ type: "server",
58362
+ uid: variable.uid,
58363
+ sequence_number: seqNumber
58827
58364
  };
58828
58365
  }
58829
- function createDataUrl(path, pagination) {
58830
- const url = new URL(path, window.location.origin);
58831
- if (pagination?.limit) {
58832
- url.searchParams.set("limit", String(pagination.limit));
58833
- }
58834
- if (pagination?.offset) {
58835
- url.searchParams.set("offset", String(pagination.offset));
58836
- }
58837
- if (pagination?.sort) {
58838
- url.searchParams.set("order_by", (pagination.sort.desc ? "-" : "") + pagination.sort.id);
58839
- }
58840
- if (pagination?.index) {
58841
- url.searchParams.set("index", String(pagination.index));
58842
- }
58843
- return url;
58844
- }
58845
- async function fetchDataVariable(uid2, extras, filters, pagination) {
58846
- const url = createDataUrl(`/api/core/data-variable/${uid2}`, pagination);
58847
- const response = await request(url, { body: JSON.stringify({ filters }), method: HTTP_METHOD.POST }, extras);
58848
- await handleAuthErrors(response, true);
58849
- await validateResponse(response, "Failed to fetch data variable");
58850
- return response.json();
58851
- }
58852
- async function fetchDerivedDataVariable(uid2, extras, cacheKey, wsChannel, filters, pagination) {
58853
- const url = createDataUrl(`/api/core/data-variable/${uid2}`, pagination);
58854
- const response = await request(
58855
- url,
58856
- { body: JSON.stringify({ cache_key: cacheKey, filters, ws_channel: wsChannel }), method: HTTP_METHOD.POST },
58857
- extras
58858
- );
58859
- await handleAuthErrors(response, true);
58860
- await validateResponse(response, "Failed to fetch data variable");
58861
- return response.json();
58862
- }
58863
- async function fetchDataVariableCount(uid2, extras, filters, cacheKey) {
58864
- const response = await request(
58865
- `/api/core/data-variable/${uid2}/count`,
58866
- { body: JSON.stringify({ cache_key: cacheKey, filters }), method: HTTP_METHOD.POST },
58867
- extras
58868
- );
58869
- await handleAuthErrors(response, true);
58870
- await validateResponse(response, "Failed to fetch data variable total count");
58871
- return response.json();
58872
- }
58873
- async function fetchDataVariableSchema(uid2, extras, cacheKey) {
58874
- const queryString = cacheKey ? new URLSearchParams({ cache_key: cacheKey }).toString() : "";
58875
- const response = await request(
58876
- `/api/core/data-variable/${uid2}/schema?${queryString}`,
58877
- { method: HTTP_METHOD.GET },
58878
- extras
58879
- );
58880
- await handleAuthErrors(response, true);
58881
- await validateResponse(response, "Failed to fetch data variable schema");
58882
- return response.json();
58883
- }
58884
- function useFetchDataVariable(variable, serverTriggerCounter) {
58885
- const eventBus = useEventBus();
58886
- const extras = useRequestExtras();
58887
- const dataCallback = React$1.useCallback(
58888
- async (filters, pagination, options) => {
58889
- const mergedFilters = combineFilters("AND", [variable.filters, filters]);
58890
- const data = await fetchDataVariable(variable.uid, extras, mergedFilters, pagination);
58891
- const [totalCount, schema = null] = await Promise.all([
58892
- fetchDataVariableCount(variable.uid, extras, mergedFilters),
58893
- ...options?.schema ? [fetchDataVariableSchema(variable.uid, extras)] : []
58894
- ]);
58895
- eventBus.publish("DATA_VARIABLE_LOADED", { variable, value: { data, totalCount } });
58896
- return {
58897
- data,
58898
- totalCount,
58899
- ...schema !== null && { schema }
58900
- };
58901
- },
58902
- [variable, extras, serverTriggerCounter, eventBus]
58903
- );
58904
- return dataCallback;
58905
- }
58906
- function useFetchDerivedDataVariable(variable, taskContext, wsClient, dvValuePromise) {
58907
- const eventBus = useEventBus();
58908
- const extras = useRequestExtras();
58909
- const previousResult = React$1.useRef({ data: null, totalCount: 0, schema: { fields: [], primaryKey: [] } });
58910
- const dataCallback = React$1.useCallback(
58911
- async (filters, pagination, options) => {
58912
- const mergedFilters = combineFilters("AND", [variable.filters, filters]);
58913
- const dvValue = await dvValuePromise;
58914
- const response = await fetchDerivedDataVariable(
58915
- variable.uid,
58916
- extras,
58917
- dvValue.cache_key,
58918
- await wsClient.getChannel(),
58919
- mergedFilters,
58920
- pagination
58921
- );
58922
- let data = null;
58923
- const variableTaskId = `${variable.uid}-filter`;
58924
- taskContext.cleanupRunningTasks(variableTaskId);
58925
- if (response && "task_id" in response) {
58926
- const taskId = response.task_id;
58927
- taskContext.startTask(taskId, variableTaskId);
58928
- try {
58929
- await wsClient.waitForTask(taskId);
58930
- } catch {
58931
- eventBus.publish("DERIVED_DATA_VARIABLE_LOADED", { variable, value: null });
58932
- return previousResult.current;
58933
- } finally {
58934
- taskContext.endTask(taskId);
58935
- }
58936
- data = await fetchTaskResult(taskId, extras);
58937
- } else {
58938
- data = response;
58939
- }
58940
- const [totalCount, schema = null] = await Promise.all([
58941
- fetchDataVariableCount(variable.uid, extras, mergedFilters, dvValue.cache_key),
58942
- ...options?.schema ? [fetchDataVariableSchema(variable.uid, extras, dvValue.cache_key)] : []
58943
- ]);
58944
- previousResult.current = {
58945
- data,
58946
- totalCount,
58947
- ...schema !== null && { schema }
58948
- };
58949
- eventBus.publish("DERIVED_DATA_VARIABLE_LOADED", { variable, value: { data, totalCount } });
58950
- return {
58951
- data,
58952
- totalCount,
58953
- ...schema !== null && { schema }
58366
+ function ServerVariableSyncProvider({ children }) {
58367
+ const { client: client2 } = React$1.useContext(websocketCtx);
58368
+ const getStoreValue = React$1.useCallback(async (itemKey) => {
58369
+ const serializableExtras = STORE_EXTRAS_MAP$1.get(itemKey);
58370
+ const response = await request(
58371
+ `/api/core/server-variable/${itemKey}/sequence`,
58372
+ serializableExtras?.extras ?? {}
58373
+ );
58374
+ await handleAuthErrors(response, true);
58375
+ await validateResponse(response, `Failed to fetch the sequence number for key: ${itemKey}`);
58376
+ const { sequence_number } = await response.json();
58377
+ return sequence_number;
58378
+ }, []);
58379
+ const listenToStoreChanges = React$1.useCallback(
58380
+ ({ updateItem }) => {
58381
+ if (!client2) {
58382
+ return;
58383
+ }
58384
+ const valueSub = client2.serverVariableMessages$().subscribe((message) => {
58385
+ updateItem(message.uid, message.sequence_number);
58386
+ });
58387
+ return () => {
58388
+ valueSub.unsubscribe();
58954
58389
  };
58955
58390
  },
58956
- [variable, extras, dvValuePromise, eventBus]
58391
+ [client2]
58957
58392
  );
58958
- return dataCallback;
58959
- }
58960
- function registerDataVariable(variable) {
58961
- if (!atomRegistry.has(variable.uid)) {
58962
- atomRegistry.set(variable.uid, Recoil_index_8({ default: true, key: variable.uid }));
58963
- }
58393
+ return /* @__PURE__ */ React$1.createElement(RecoilSync_index_1, { listen: listenToStoreChanges, read: getStoreValue, storeKey: "ServerVariable" }, children);
58964
58394
  }
58965
58395
  var set_1;
58966
58396
  var hasRequiredSet;
@@ -58992,50 +58422,11 @@ Inferred class string: "${iconClasses}."`
58992
58422
  }
58993
58423
  return atomRegistry.get(triggerKey);
58994
58424
  }
58995
- function getOrRegisterDataVariableTrigger(variable, wsClient) {
58996
- const key = `${variable.uid}-data`;
58997
- if (!dataRegistry.has(key)) {
58998
- dataRegistry.set(
58999
- key,
59000
- Recoil_index_8({
59001
- default: {
59002
- force_key: null,
59003
- inc: 0
59004
- },
59005
- effects: [
59006
- // synchronize with server triggers - increment when the variable is triggered on the server side
59007
- // In the DataVariable case we always force so new key is generated
59008
- ({ setSelf }) => {
59009
- const subscription = wsClient.serverTriggers$(variable.uid).subscribe(() => {
59010
- setSelf((v) => {
59011
- if (typeof v === "object" && "inc" in v) {
59012
- return {
59013
- force_key: nanoid(),
59014
- inc: v.inc + 1
59015
- };
59016
- }
59017
- return {
59018
- force_key: nanoid(),
59019
- inc: 1
59020
- };
59021
- });
59022
- });
59023
- return () => {
59024
- subscription?.unsubscribe();
59025
- };
59026
- }
59027
- ],
59028
- key
59029
- })
59030
- );
59031
- }
59032
- return dataRegistry.get(key);
59033
- }
59034
58425
  function buildTriggerList(variables) {
59035
58426
  const triggers = [];
59036
58427
  function walk(vars, path) {
59037
58428
  for (const [idx, variable] of vars.entries()) {
59038
- if (isDerivedVariable(variable) || isDerivedDataVariable(variable)) {
58429
+ if (isDerivedVariable(variable)) {
59039
58430
  const varPath = [...path, String(idx)];
59040
58431
  triggers.push({
59041
58432
  path: varPath,
@@ -59043,27 +58434,17 @@ Inferred class string: "${iconClasses}."`
59043
58434
  });
59044
58435
  walk(variable.variables, [...varPath, "values"]);
59045
58436
  }
59046
- if (isDataVariable(variable)) {
59047
- triggers.push({
59048
- path: path.length > 0 ? path.slice(0, -1) : [],
59049
- variable
59050
- });
59051
- }
59052
58437
  }
59053
58438
  }
59054
58439
  walk(variables, []);
59055
58440
  return triggers;
59056
58441
  }
59057
- function registerChildTriggers(triggerList, wsClient, registerFunc = Recoil_index_20) {
58442
+ function registerChildTriggers(triggerList, registerFunc = Recoil_index_20) {
59058
58443
  return triggerList.map((triggerInfo) => {
59059
- if (isDerivedVariable(triggerInfo.variable) || isDerivedDataVariable(triggerInfo.variable)) {
58444
+ if (isDerivedVariable(triggerInfo.variable)) {
59060
58445
  const triggerIndex = getOrRegisterTrigger(triggerInfo.variable);
59061
58446
  return registerFunc(triggerIndex);
59062
58447
  }
59063
- if (isDataVariable(triggerInfo.variable)) {
59064
- const serverTrigger = getOrRegisterDataVariableTrigger(triggerInfo.variable, wsClient);
59065
- return registerFunc(serverTrigger);
59066
- }
59067
58448
  throw new Error("Invalid trigger variable type");
59068
58449
  });
59069
58450
  }
@@ -59076,8 +58457,7 @@ Inferred class string: "${iconClasses}."`
59076
58457
  force_key,
59077
58458
  variableUid,
59078
58459
  values,
59079
- wsClient,
59080
- is_data_variable = false
58460
+ wsClient
59081
58461
  }) {
59082
58462
  const cacheControl = cache2 === null ? {
59083
58463
  "cache-control": "none"
@@ -59086,7 +58466,7 @@ Inferred class string: "${iconClasses}."`
59086
58466
  const res = await request(
59087
58467
  `/api/core/derived-variable/${variableUid}`,
59088
58468
  {
59089
- body: JSON.stringify({ is_data_variable, values, ws_channel, force_key: force_key ?? null }),
58469
+ body: JSON.stringify({ values, ws_channel, force_key: force_key ?? null }),
59090
58470
  headers: { ...cacheControl },
59091
58471
  method: HTTP_METHOD.POST
59092
58472
  },
@@ -59105,8 +58485,7 @@ Inferred class string: "${iconClasses}."`
59105
58485
  wsClient,
59106
58486
  extras,
59107
58487
  cache: cache2,
59108
- force_key,
59109
- is_data_variable = false
58488
+ force_key
59110
58489
  }) {
59111
58490
  if (!debouncedFetchSubjects[selectorKey]) {
59112
58491
  debouncedFetchSubjects[selectorKey] = new BehaviorSubject(null);
@@ -59121,7 +58500,6 @@ Inferred class string: "${iconClasses}."`
59121
58500
  cache: cache2,
59122
58501
  extras,
59123
58502
  force_key,
59124
- is_data_variable,
59125
58503
  selectorKey,
59126
58504
  values,
59127
58505
  variableUid,
@@ -59132,7 +58510,7 @@ Inferred class string: "${iconClasses}."`
59132
58510
  });
59133
58511
  }
59134
58512
  function resolveValue(value, getter) {
59135
- if (isResolvedDerivedVariable(value) || isResolvedDerivedDataVariable(value)) {
58513
+ if (isResolvedDerivedVariable(value)) {
59136
58514
  const resolvedValues = value.values.map((v) => resolveValue(v, getter));
59137
58515
  return {
59138
58516
  ...value,
@@ -59147,8 +58525,11 @@ Inferred class string: "${iconClasses}."`
59147
58525
  default: resolveValue(value.default, getter)
59148
58526
  };
59149
58527
  }
59150
- if (isResolvedDataVariable(value)) {
59151
- return value;
58528
+ if (isResolvedServerVariable(value)) {
58529
+ return {
58530
+ ...value,
58531
+ sequence_number: Recoil_index_2(value.sequence_number) ? getter(value.sequence_number) : value.sequence_number
58532
+ };
59152
58533
  }
59153
58534
  if (isCondition(value)) {
59154
58535
  return {
@@ -59167,9 +58548,12 @@ Inferred class string: "${iconClasses}."`
59167
58548
  if (deps && !deps.includes(idx)) {
59168
58549
  return [];
59169
58550
  }
59170
- if (isResolvedDerivedVariable(val) || isResolvedDerivedDataVariable(val)) {
58551
+ if (isResolvedDerivedVariable(val)) {
59171
58552
  return getDeps(val.values, val.deps).flat();
59172
58553
  }
58554
+ if (isResolvedServerVariable(val)) {
58555
+ return val.sequence_number;
58556
+ }
59173
58557
  if (isResolvedSwitchVariable(val)) {
59174
58558
  return getDeps([val.value, val.value_map, val.default], [0, 1, 2]).flat();
59175
58559
  }
@@ -59179,9 +58563,9 @@ Inferred class string: "${iconClasses}."`
59179
58563
  function useTriggerIndex(variable) {
59180
58564
  return Recoil_index_20(getOrRegisterTrigger(variable));
59181
58565
  }
59182
- function resolveDerivedValue(key, variables, deps, resolvedVariables, wsClient, get, selfTrigger) {
58566
+ function resolveDerivedValue(key, variables, deps, resolvedVariables, get, selfTrigger) {
59183
58567
  const triggerList = buildTriggerList(variables);
59184
- const triggers = registerChildTriggers(triggerList, wsClient, get);
58568
+ const triggers = registerChildTriggers(triggerList, get);
59185
58569
  if (selfTrigger) {
59186
58570
  triggers.unshift(selfTrigger);
59187
58571
  }
@@ -59200,7 +58584,9 @@ Inferred class string: "${iconClasses}."`
59200
58584
  if (areArgsTheSame) {
59201
58585
  return {
59202
58586
  entry: previousEntry,
59203
- type: "previous"
58587
+ type: "previous",
58588
+ values,
58589
+ depsKey: key
59204
58590
  };
59205
58591
  }
59206
58592
  const previousTriggerCounters = previousEntry.args.slice(
@@ -59227,18 +58613,20 @@ Inferred class string: "${iconClasses}."`
59227
58613
  relevantValues,
59228
58614
  selfTriggerForceKey,
59229
58615
  type: "current",
59230
- values
58616
+ values,
58617
+ depsKey: key
59231
58618
  };
59232
58619
  }
59233
58620
  return {
59234
58621
  relevantValues,
59235
58622
  selfTriggerForceKey: null,
59236
58623
  type: "current",
59237
- values
58624
+ values,
58625
+ depsKey: key
59238
58626
  };
59239
58627
  }
59240
- function getOrRegisterDerivedVariable(variable, wsClient, taskContext, currentExtras) {
59241
- const key = getRegistryKey(variable, "selector");
58628
+ function getOrRegisterDerivedVariableResult(variable, wsClient, taskContext, currentExtras) {
58629
+ const key = getRegistryKey(variable, "result-selector");
59242
58630
  if (!selectorFamilyRegistry.has(key)) {
59243
58631
  getOrRegisterTrigger(variable);
59244
58632
  selectorFamilyRegistry.set(
@@ -59248,34 +58636,68 @@ Inferred class string: "${iconClasses}."`
59248
58636
  eviction: "most-recent"
59249
58637
  },
59250
58638
  get: (extrasSerializable) => async ({ get }) => {
59251
- const resolvedVariables = variable.variables.map((v) => {
59252
- if (!isVariable(v)) {
59253
- return v;
59254
- }
59255
- return resolveVariable(v, wsClient, taskContext, currentExtras);
59256
- });
58639
+ const resolvedVariables = await Promise.all(
58640
+ variable.variables.map(async (v) => {
58641
+ if (!isVariable(v)) {
58642
+ return Promise.resolve(v);
58643
+ }
58644
+ return resolveVariable(v, wsClient, taskContext, currentExtras);
58645
+ })
58646
+ );
59257
58647
  const selfTrigger = get(getOrRegisterTrigger(variable));
59258
- const { extras } = extrasSerializable;
59259
58648
  const selectorKey = key + extrasSerializable.toJSON();
59260
58649
  const derivedResult = resolveDerivedValue(
59261
58650
  selectorKey,
59262
58651
  variable.variables,
59263
58652
  variable.deps,
59264
58653
  resolvedVariables,
59265
- wsClient,
59266
58654
  get,
59267
58655
  selfTrigger
59268
58656
  );
58657
+ return derivedResult;
58658
+ },
58659
+ key: nanoid()
58660
+ })
58661
+ );
58662
+ }
58663
+ const family = selectorFamilyRegistry.get(key);
58664
+ const serializableExtras = new RequestExtrasSerializable(currentExtras);
58665
+ const selectorInstance = family(serializableExtras);
58666
+ if (!selectorFamilyMembersRegistry.has(family)) {
58667
+ selectorFamilyMembersRegistry.set(family, /* @__PURE__ */ new Map());
58668
+ }
58669
+ selectorFamilyMembersRegistry.get(family).set(serializableExtras.toJSON(), selectorInstance);
58670
+ return selectorInstance;
58671
+ }
58672
+ function getOrRegisterDerivedVariable(variable, wsClient, taskContext, currentExtras) {
58673
+ const key = getRegistryKey(variable, "selector");
58674
+ if (!selectorFamilyRegistry.has(key)) {
58675
+ getOrRegisterTrigger(variable);
58676
+ selectorFamilyRegistry.set(
58677
+ key,
58678
+ Recoil_index_11({
58679
+ cachePolicy_UNSTABLE: {
58680
+ eviction: "most-recent"
58681
+ },
58682
+ get: (extrasSerializable) => async ({ get }) => {
58683
+ const selectorKey = key + extrasSerializable.toJSON();
58684
+ const dvResultSelector = getOrRegisterDerivedVariableResult(
58685
+ variable,
58686
+ wsClient,
58687
+ taskContext,
58688
+ extrasSerializable.extras
58689
+ );
58690
+ const derivedResult = get(dvResultSelector);
59269
58691
  if (derivedResult.type === "previous") {
59270
58692
  return { cache_key: derivedResult.entry.cacheKey, value: derivedResult.entry.result };
59271
58693
  }
58694
+ const { extras } = extrasSerializable;
59272
58695
  let variableResponse = null;
59273
58696
  try {
59274
58697
  variableResponse = await debouncedFetchDerivedVariable({
59275
58698
  cache: variable.cache,
59276
58699
  extras,
59277
58700
  force_key: derivedResult.selfTriggerForceKey,
59278
- is_data_variable: isDerivedDataVariable(variable),
59279
58701
  selectorKey,
59280
58702
  values: normalizeRequest(cleanArgs(derivedResult.values), variable.variables),
59281
58703
  variableUid: variable.uid,
@@ -59288,34 +58710,37 @@ Inferred class string: "${iconClasses}."`
59288
58710
  }
59289
58711
  const cacheKey = variableResponse.cache_key;
59290
58712
  let variableValue = null;
59291
- if (isDerivedVariable(variable)) {
59292
- taskContext.cleanupRunningTasks(variable.uid);
59293
- if (isTaskResponse$1(variableResponse)) {
59294
- const taskId = variableResponse.task_id;
59295
- taskContext.startTask(taskId, variable.uid, getRegistryKey(variable, "trigger"));
59296
- try {
59297
- await wsClient.waitForTask(taskId);
59298
- } catch {
59299
- return {
59300
- cache_key: cacheKey,
59301
- value: null
59302
- };
59303
- } finally {
59304
- taskContext.endTask(taskId);
59305
- }
59306
- try {
59307
- variableValue = await fetchTaskResult(taskId, extras);
59308
- } catch (e2) {
58713
+ taskContext.cleanupRunningTasks(variable.uid);
58714
+ if (isTaskResponse$1(variableResponse)) {
58715
+ const taskId = variableResponse.task_id;
58716
+ taskContext.startTask(taskId, variable.uid, getRegistryKey(variable, "trigger"));
58717
+ try {
58718
+ await wsClient.waitForTask(taskId);
58719
+ } catch (e2) {
58720
+ if (e2 instanceof TaskError) {
59309
58721
  e2.selectorId = key;
59310
58722
  e2.selectorExtras = extrasSerializable.toJSON();
59311
58723
  throw e2;
59312
58724
  }
59313
- } else {
59314
- variableValue = variableResponse.value;
58725
+ return {
58726
+ cache_key: cacheKey,
58727
+ value: null
58728
+ };
58729
+ } finally {
58730
+ taskContext.endTask(taskId);
58731
+ }
58732
+ try {
58733
+ variableValue = await fetchTaskResult(taskId, extras);
58734
+ } catch (e2) {
58735
+ e2.selectorId = key;
58736
+ e2.selectorExtras = extrasSerializable.toJSON();
58737
+ throw e2;
59315
58738
  }
58739
+ } else {
58740
+ variableValue = variableResponse.value;
59316
58741
  }
59317
58742
  variableValue = "nested" in variable ? resolveNested(variableValue, variable.nested) : variableValue;
59318
- depsRegistry.set(selectorKey, {
58743
+ depsRegistry.set(derivedResult.depsKey, {
59319
58744
  args: derivedResult.relevantValues,
59320
58745
  cacheKey,
59321
58746
  result: variableValue
@@ -59427,20 +58852,13 @@ Inferred class string: "${iconClasses}."`
59427
58852
  cloned[key] = nested.length === 1 ? newValue : setNested(cloned[key], nested.slice(1), newValue);
59428
58853
  return cloned;
59429
58854
  }
59430
- function resolveVariable(variable, client2, taskContext, extras, resolver = (val) => val) {
59431
- if (isDerivedVariable(variable) || isDerivedDataVariable(variable)) {
58855
+ async function resolveVariable(variable, client2, taskContext, extras, resolver = (state) => Promise.resolve(state)) {
58856
+ if (isDerivedVariable(variable)) {
59432
58857
  getOrRegisterDerivedVariable(variable, client2, taskContext, extras);
59433
- const values = variable.variables.map((v) => resolveVariable(v, client2, taskContext, extras, resolver));
58858
+ const values = await Promise.all(
58859
+ variable.variables.map((v) => resolveVariable(v, client2, taskContext, extras, resolver))
58860
+ );
59434
58861
  const deps = variable.deps.map((dep) => variable.variables.findIndex((v) => v.uid === dep.uid));
59435
- if (isDerivedDataVariable(variable)) {
59436
- return {
59437
- deps,
59438
- filters: variable.filters,
59439
- type: "derived-data",
59440
- uid: variable.uid,
59441
- values
59442
- };
59443
- }
59444
58862
  return {
59445
58863
  deps,
59446
58864
  type: "derived",
@@ -59448,22 +58866,20 @@ Inferred class string: "${iconClasses}."`
59448
58866
  values
59449
58867
  };
59450
58868
  }
59451
- if (isDataVariable(variable)) {
59452
- return resolveDataVariable(variable);
59453
- }
59454
- if (isUrlVariable(variable)) {
59455
- return resolver(getOrRegisterUrlVariable(variable));
58869
+ if (isServerVariable(variable)) {
58870
+ getOrRegisterServerVariable(variable, extras);
58871
+ return resolveServerVariable(variable, extras, resolver);
59456
58872
  }
59457
58873
  if (isSwitchVariable(variable)) {
59458
- let resolvedValue = isVariable(variable.value) ? resolveVariable(variable.value, client2, taskContext, extras, resolver) : variable.value;
58874
+ let resolvedValue = isVariable(variable.value) ? await resolveVariable(variable.value, client2, taskContext, extras, resolver) : variable.value;
59459
58875
  if (isCondition(resolvedValue)) {
59460
58876
  resolvedValue = {
59461
58877
  ...resolvedValue,
59462
- variable: resolveVariable(resolvedValue.variable, client2, taskContext, extras, resolver)
58878
+ variable: await resolveVariable(resolvedValue.variable, client2, taskContext, extras, resolver)
59463
58879
  };
59464
58880
  }
59465
- const resolvedValueMap = isVariable(variable.value_map) ? resolveVariable(variable.value_map, client2, taskContext, extras, resolver) : variable.value_map;
59466
- const resolvedDefault = isVariable(variable.default) ? resolveVariable(variable.default, client2, taskContext, extras, resolver) : variable.default;
58881
+ const resolvedValueMap = isVariable(variable.value_map) ? await resolveVariable(variable.value_map, client2, taskContext, extras, resolver) : variable.value_map;
58882
+ const resolvedDefault = isVariable(variable.default) ? await resolveVariable(variable.default, client2, taskContext, extras, resolver) : variable.default;
59467
58883
  return {
59468
58884
  type: "switch",
59469
58885
  uid: variable.uid,
@@ -59472,10 +58888,13 @@ Inferred class string: "${iconClasses}."`
59472
58888
  default: resolvedDefault
59473
58889
  };
59474
58890
  }
58891
+ if (isStateVariable(variable)) {
58892
+ throw new Error("StateVariable should not be resolved - it should be handled by useVariable hook");
58893
+ }
59475
58894
  return resolver(getOrRegisterPlainVariable(variable, client2, taskContext, extras));
59476
58895
  }
59477
58896
  function cleanValue(value, forceKeyOverride) {
59478
- if (isResolvedDerivedVariable(value) || isResolvedDerivedDataVariable(value)) {
58897
+ if (isResolvedDerivedVariable(value)) {
59479
58898
  const { deps, ...rest } = value;
59480
58899
  const cleanedValues = value.values.map((v) => cleanValue(v));
59481
58900
  return {
@@ -60383,19 +59802,27 @@ Inferred class string: "${iconClasses}."`
60383
59802
  storeKey: "BrowserStore"
60384
59803
  });
60385
59804
  }
59805
+ function urlEffect(variable) {
59806
+ return RecoilSync_index_6({
59807
+ history: "push",
59808
+ itemKey: variable.store.query,
59809
+ refine: Refine_index_6()
59810
+ });
59811
+ }
60386
59812
  const STORES = {
60387
59813
  BackendStore: {
60388
- effect: backendStoreEffect,
60389
- sync: BackendStoreSync
59814
+ effect: backendStoreEffect
60390
59815
  },
60391
59816
  BrowserStore: {
60392
- effect: localStorageEffect,
60393
- sync: BrowserStoreSync
59817
+ effect: localStorageEffect
59818
+ },
59819
+ QueryParamStore: {
59820
+ effect: urlEffect
60394
59821
  }
60395
59822
  };
60396
59823
  function getEffect(variable) {
60397
59824
  const storeName = variable.store?.__typename;
60398
- if (!storeName) {
59825
+ if (!storeName || !(storeName in STORES)) {
60399
59826
  return null;
60400
59827
  }
60401
59828
  return STORES[storeName]?.effect ?? null;
@@ -60427,25 +59854,290 @@ Inferred class string: "${iconClasses}."`
60427
59854
  }
60428
59855
  throw new Error(`Unexpected operator ${String(operator)} passed to conditional (If) component`);
60429
59856
  }
60430
- function useConditionOrVariable(arg) {
59857
+ function useConditionOrVariable(arg, opts = {}) {
60431
59858
  if (isCondition(arg)) {
60432
- const value = useVariable(arg.variable)[0];
60433
- const other = useVariable(arg.other)[0];
59859
+ const value = useVariable(arg.variable, opts)[0];
59860
+ const other = useVariable(arg.other, opts)[0];
60434
59861
  return isConditionTrue(arg.operator, value, other);
60435
59862
  }
60436
- return useVariable(arg)[0];
59863
+ return useVariable(arg, opts)[0];
60437
59864
  }
60438
59865
  function useSwitchVariable(variable) {
60439
- const value = useConditionOrVariable(variable.value);
60440
- const [valueMap] = useVariable(variable.value_map);
60441
- const [defaultValue] = useVariable(variable.default);
59866
+ const value = useConditionOrVariable(variable.value, { suspend: false });
59867
+ const [valueMap] = useVariable(variable.value_map, { suspend: false });
59868
+ const [defaultValue] = useVariable(variable.default, { suspend: false });
60442
59869
  const lookupKey = String(value);
60443
59870
  return valueMap[lookupKey] ?? defaultValue;
60444
59871
  }
59872
+ const COLUMN_PREFIX_REGEX = /__(?:col|index)__\d+__/;
59873
+ function combineFilters(combinator, queries) {
59874
+ const validQueries = queries.filter((x) => x !== null && x !== void 0);
59875
+ if (validQueries.length === 0) {
59876
+ return null;
59877
+ }
59878
+ if (validQueries.length === 1) {
59879
+ return validQueries[0];
59880
+ }
59881
+ return {
59882
+ clauses: validQueries,
59883
+ combinator
59884
+ };
59885
+ }
59886
+ function inferColumnType(value, hint) {
59887
+ if (typeof value === "number") {
59888
+ return "numerical";
59889
+ }
59890
+ if (typeof value === "string") {
59891
+ return "categorical";
59892
+ }
59893
+ if (value instanceof Date) {
59894
+ return "datetime";
59895
+ }
59896
+ return "categorical";
59897
+ }
59898
+ function filterRow(row, column, operator, value, columnHints) {
59899
+ const cellValue = row[column];
59900
+ if (operator === "CONTAINS") {
59901
+ return String(cellValue).toLowerCase().includes(String(value).toLowerCase());
59902
+ }
59903
+ const colType = inferColumnType(cellValue);
59904
+ try {
59905
+ let processedValue = value;
59906
+ let processedCellValue = cellValue;
59907
+ if (Array.isArray(value)) {
59908
+ return value.includes(cellValue);
59909
+ }
59910
+ if (colType === "datetime") {
59911
+ if (Array.isArray(value)) {
59912
+ processedValue = value.map((v) => new Date(v).getTime());
59913
+ } else {
59914
+ processedValue = new Date(value).getTime();
59915
+ }
59916
+ if (typeof cellValue === "number") {
59917
+ processedCellValue = cellValue;
59918
+ } else if (cellValue instanceof Date) {
59919
+ processedCellValue = cellValue.getTime();
59920
+ } else if (typeof cellValue === "string") {
59921
+ processedCellValue = parseISO$1(cellValue).getTime();
59922
+ } else {
59923
+ processedCellValue = 0;
59924
+ }
59925
+ } else if (colType === "categorical") {
59926
+ processedValue = String(value);
59927
+ processedCellValue = String(cellValue);
59928
+ } else if (colType === "numerical") {
59929
+ if (Array.isArray(value)) {
59930
+ processedValue = value.map((v) => {
59931
+ const num = Number(v);
59932
+ return Number.isNaN(num) ? 0 : num;
59933
+ });
59934
+ } else {
59935
+ const num = Number(value);
59936
+ processedValue = Number.isNaN(num) ? 0 : num;
59937
+ }
59938
+ const cellNum = Number(cellValue);
59939
+ processedCellValue = Number.isNaN(cellNum) ? 0 : cellNum;
59940
+ }
59941
+ switch (operator) {
59942
+ case "GT":
59943
+ return processedCellValue > processedValue;
59944
+ case "LT":
59945
+ return processedCellValue < processedValue;
59946
+ case "NE":
59947
+ return processedCellValue !== processedValue;
59948
+ case "BT":
59949
+ if (Array.isArray(processedValue) && processedValue.length === 2) {
59950
+ return processedCellValue >= processedValue[0] && processedCellValue <= processedValue[1];
59951
+ }
59952
+ return false;
59953
+ case "EQ":
59954
+ default:
59955
+ return processedCellValue === processedValue;
59956
+ }
59957
+ } catch (error) {
59958
+ console.warn("Filter error:", error, { column, value, operator });
59959
+ return true;
59960
+ }
59961
+ }
59962
+ function resolveFilterQuery(row, query, columnHints) {
59963
+ if ("column" in query) {
59964
+ const cleanColumn = query.column.replace(COLUMN_PREFIX_REGEX, "");
59965
+ return filterRow(row, cleanColumn, query.operator, query.value);
59966
+ }
59967
+ const results = query.clauses.map((clause) => resolveFilterQuery(row, clause));
59968
+ if (query.combinator === "AND") {
59969
+ return results.every((result) => result);
59970
+ }
59971
+ if (query.combinator === "OR") {
59972
+ return results.some((result) => result);
59973
+ }
59974
+ return true;
59975
+ }
59976
+ function applyFilters(data, filters, pagination, columnHints) {
59977
+ if (!data || data.length === 0) {
59978
+ return { data: [], count: 0, schema: null };
59979
+ }
59980
+ let filteredData = data;
59981
+ if (filters) {
59982
+ filteredData = data.filter((row) => resolveFilterQuery(row, filters));
59983
+ }
59984
+ const totalCount = filteredData.length;
59985
+ if (pagination) {
59986
+ if (pagination.index !== void 0) {
59987
+ const targetRow = data[pagination.index];
59988
+ return {
59989
+ data: targetRow ? [targetRow] : [],
59990
+ count: totalCount,
59991
+ schema: null
59992
+ };
59993
+ }
59994
+ if (pagination.sort) {
59995
+ const { id, desc } = pagination.sort;
59996
+ filteredData = [...filteredData].sort((a2, b2) => {
59997
+ const aVal = a2[id];
59998
+ const bVal = b2[id];
59999
+ if (aVal == null && bVal == null) {
60000
+ return 0;
60001
+ }
60002
+ if (aVal == null) {
60003
+ return desc ? 1 : -1;
60004
+ }
60005
+ if (bVal == null) {
60006
+ return desc ? -1 : 1;
60007
+ }
60008
+ const colType = inferColumnType(aVal);
60009
+ let comparison = 0;
60010
+ if (colType === "numerical") {
60011
+ comparison = Number(aVal) - Number(bVal);
60012
+ } else if (colType === "datetime") {
60013
+ let aTime = 0;
60014
+ if (typeof aVal === "number") {
60015
+ aTime = aVal;
60016
+ } else if (aVal instanceof Date) {
60017
+ aTime = aVal.getTime();
60018
+ } else if (typeof aVal === "string") {
60019
+ aTime = parseISO$1(aVal).getTime();
60020
+ }
60021
+ let bTime = 0;
60022
+ if (typeof bVal === "number") {
60023
+ bTime = bVal;
60024
+ } else if (bVal instanceof Date) {
60025
+ bTime = bVal.getTime();
60026
+ } else if (typeof bVal === "string") {
60027
+ bTime = parseISO$1(bVal).getTime();
60028
+ }
60029
+ comparison = aTime - bTime;
60030
+ } else {
60031
+ comparison = String(aVal).localeCompare(String(bVal));
60032
+ }
60033
+ return desc ? -comparison : comparison;
60034
+ });
60035
+ }
60036
+ const startIndex = pagination.offset || 0;
60037
+ const endIndex = pagination.limit ? startIndex + pagination.limit : filteredData.length;
60038
+ filteredData = filteredData.slice(startIndex, endIndex);
60039
+ }
60040
+ return {
60041
+ data: filteredData,
60042
+ count: totalCount,
60043
+ schema: null
60044
+ };
60045
+ }
60046
+ const INDEX = "__index__";
60047
+ function appendIndex(df) {
60048
+ if (df.length > 0 && !(INDEX in df[0])) {
60049
+ return df.map((row, i2) => ({ ...row, [INDEX]: i2 }));
60050
+ }
60051
+ return df;
60052
+ }
60053
+ function createFetcher(df) {
60054
+ const data = appendIndex(df);
60055
+ return async (filters, pagination) => {
60056
+ return applyFilters(data, filters, pagination);
60057
+ };
60058
+ }
60059
+ function useTabularVariable(variable) {
60060
+ const extras = useRequestExtras();
60061
+ const { client: wsClient } = React$1.useContext(websocketCtx);
60062
+ if (!isVariable(variable) || isSingleVariable(variable)) {
60063
+ const [data] = useVariable(variable);
60064
+ return React$1.useMemo(() => createFetcher(data), [data]);
60065
+ }
60066
+ const variablesContext = React$1.useContext(variablesCtx);
60067
+ variablesContext?.variables.current.add(variable.uid);
60068
+ React$1.useEffect(() => {
60069
+ return () => {
60070
+ variablesContext?.variables.current.delete(variable.uid);
60071
+ };
60072
+ }, []);
60073
+ if (isServerVariable(variable)) {
60074
+ const serverAtom = getOrRegisterServerVariable(variable, extras);
60075
+ const atomCount = Recoil_index_20(serverAtom);
60076
+ return useFetchTabularServerVariable(variable, atomCount, wsClient, extras);
60077
+ }
60078
+ const taskContext = useTaskContext();
60079
+ const dvResultSelector = getOrRegisterDerivedVariableResult(variable, wsClient, taskContext, extras);
60080
+ const dvResultLoadable = Recoil_index_21(dvResultSelector);
60081
+ const [dvResult, setDvResult] = React$1.useState(() => dvResultLoadable.getValue());
60082
+ React$1.useEffect(() => {
60083
+ if (dvResultLoadable.state === "hasValue") {
60084
+ setDvResult(dvResultLoadable.getValue());
60085
+ }
60086
+ }, [dvResultLoadable]);
60087
+ return useFetchTabularDerivedVariable(variable, dvResult, wsClient, taskContext, extras);
60088
+ }
60089
+ async function getTabularVariableValue(variable, ctx) {
60090
+ if (!isVariable(variable)) {
60091
+ return variable;
60092
+ }
60093
+ if (isSingleVariable(variable)) {
60094
+ return resolveVariable(
60095
+ variable,
60096
+ ctx.client,
60097
+ ctx.taskContext,
60098
+ ctx.extras,
60099
+ (v) => ctx.snapshot.getLoadable(v).toPromise()
60100
+ );
60101
+ }
60102
+ if (isServerVariable(variable)) {
60103
+ const response2 = await fetchTabularServerVariable({
60104
+ variable,
60105
+ // doesn't matter for fetching, will get up to date anyway
60106
+ seqNumber: 0,
60107
+ wsClient: ctx.client,
60108
+ extras: ctx.extras
60109
+ });
60110
+ return response2.data;
60111
+ }
60112
+ const resolved = await resolveVariable(
60113
+ variable,
60114
+ ctx.client,
60115
+ ctx.taskContext,
60116
+ ctx.extras,
60117
+ (v) => ctx.snapshot.getLoadable(v).toPromise()
60118
+ );
60119
+ const result = await fetchDerivedVariable({
60120
+ cache: variable.cache,
60121
+ extras: ctx.extras,
60122
+ force_key: null,
60123
+ /**
60124
+ * In this case we're not concerned about different selectors fetching the value so just use the uid
60125
+ */
60126
+ selectorKey: resolved.uid,
60127
+ values: normalizeRequest(cleanArgs(resolved.values), variable.variables),
60128
+ variableUid: resolved.uid,
60129
+ wsClient: ctx.client
60130
+ });
60131
+ if (isTaskResponse$1(result)) {
60132
+ throw new UserError("Task DerivedVariables are not supported in this context");
60133
+ }
60134
+ const response = result.value;
60135
+ return response.data;
60136
+ }
60445
60137
  function warnUpdateOnDerivedState() {
60446
60138
  console.warn("You tried to call update on variable with derived state, this is a noop and will be ignored.");
60447
60139
  }
60448
- function useVariable(variable) {
60140
+ function useVariable(variable, opts = { serverVariable: "disallow" }) {
60449
60141
  const extras = useRequestExtras();
60450
60142
  const { client: wsClient } = React$1.useContext(websocketCtx);
60451
60143
  const taskContext = useTaskContext();
@@ -60466,9 +60158,6 @@ Inferred class string: "${iconClasses}."`
60466
60158
  variablesContext?.variables.current.delete(variable.uid);
60467
60159
  };
60468
60160
  }, []);
60469
- if (isDataVariable(variable) || isDerivedDataVariable(variable)) {
60470
- throw new Error(`Non-data variable expected, got ${variable.__typename}`);
60471
- }
60472
60161
  if (isDerivedVariable(variable)) {
60473
60162
  const selector2 = useDerivedVariable(variable, wsClient, taskContext, extras);
60474
60163
  const selectorLoadable = Recoil_index_28(selector2);
@@ -60477,19 +60166,52 @@ Inferred class string: "${iconClasses}."`
60477
60166
  bus.publish("DERIVED_VARIABLE_LOADED", { variable, value: selectorLoadable.contents });
60478
60167
  }
60479
60168
  }, [selectorLoadable]);
60480
- const deferred2 = useDeferLoadable(selectorLoadable);
60169
+ const deferred2 = useDeferLoadable(selectorLoadable, opts.suspend);
60481
60170
  return [deferred2.value, warnUpdateOnDerivedState];
60482
60171
  }
60483
- if (isUrlVariable(variable)) {
60484
- const [urlValue, setUrlValue] = useUrlVariable(variable);
60485
- React$1.useEffect(() => {
60486
- bus.publish("URL_VARIABLE_LOADED", { variable, value: urlValue });
60487
- }, [urlValue]);
60488
- return [urlValue, setUrlValue];
60489
- }
60490
60172
  if (isSwitchVariable(variable)) {
60491
60173
  return [useSwitchVariable(variable), warnUpdateOnDerivedState];
60492
60174
  }
60175
+ if (isStateVariable(variable)) {
60176
+ const parentSelector = useDerivedVariable(variable.parent_variable, wsClient, taskContext, extras);
60177
+ const parentLoadable = Recoil_index_28(parentSelector);
60178
+ let stateValue;
60179
+ switch (variable.property_name) {
60180
+ case "loading":
60181
+ stateValue = parentLoadable.state === "loading";
60182
+ break;
60183
+ case "error":
60184
+ stateValue = parentLoadable.state === "hasError";
60185
+ break;
60186
+ case "hasValue":
60187
+ stateValue = parentLoadable.state === "hasValue";
60188
+ break;
60189
+ default:
60190
+ stateValue = false;
60191
+ }
60192
+ return [stateValue, warnUpdateOnDerivedState];
60193
+ }
60194
+ if (isServerVariable(variable)) {
60195
+ if (opts.serverVariable === "disallow") {
60196
+ throw new UserError("ServerVariable cannot be directly consumed by this component");
60197
+ }
60198
+ const atom2 = React$1.useMemo(() => getOrRegisterServerVariable(variable, extras), [variable, extras]);
60199
+ const [seqNumber] = Recoil_index_22(atom2);
60200
+ const fetcher = useTabularVariable(variable);
60201
+ const { data } = reactQuery.useSuspenseQuery({
60202
+ // use the seq number as a dependency to refetch on changes
60203
+ queryKey: ["use-variable-server-variable", variable.uid, seqNumber],
60204
+ queryFn: async () => {
60205
+ const result = await fetcher(null, {
60206
+ limit: 1,
60207
+ offset: 0
60208
+ });
60209
+ return result.data;
60210
+ },
60211
+ refetchOnWindowFocus: false
60212
+ });
60213
+ return [data?.[0] ?? null, warnUpdateOnDerivedState];
60214
+ }
60493
60215
  const recoilState = getOrRegisterPlainVariable(variable, wsClient, taskContext, extras);
60494
60216
  if (!isDerivedVariable(variable.default)) {
60495
60217
  const [value, setValue] = Recoil_index_22(recoilState);
@@ -60504,7 +60226,7 @@ Inferred class string: "${iconClasses}."`
60504
60226
  bus.publish("PLAIN_VARIABLE_LOADED", { variable, value: loadable.contents });
60505
60227
  }
60506
60228
  }, [loadable]);
60507
- const deferred = useDeferLoadable(loadable);
60229
+ const deferred = useDeferLoadable(loadable, opts.suspend);
60508
60230
  return [deferred, setLoadable];
60509
60231
  }
60510
60232
  function flexStyles(props, displayCtx2, useDisplayContext) {
@@ -60747,24 +60469,18 @@ Inferred class string: "${iconClasses}."`
60747
60469
  return React$1.useMemo(() => ({ get }), [get]);
60748
60470
  }
60749
60471
  async function invokeAction(input, executionId, annotatedAction, actionCtx) {
60750
- const resolvedKwargs = Object.keys(annotatedAction.dynamic_kwargs).reduce(
60751
- (acc, k) => {
60752
- const value = annotatedAction.dynamic_kwargs[k];
60753
- acc[k] = isVariable(value) ? resolveVariable(
60472
+ const resolvedKwargs = await Promise.all(
60473
+ Object.entries(annotatedAction.dynamic_kwargs).map(async ([k, value]) => {
60474
+ const resolvedValue = isVariable(value) ? await resolveVariable(
60754
60475
  value,
60755
60476
  actionCtx.wsClient,
60756
60477
  actionCtx.taskCtx,
60757
60478
  actionCtx.extras,
60758
- (v) => (
60759
- // This is only called for primitive variables so it should always resolve successfully
60760
- // hence not using a promise
60761
- actionCtx.snapshot.getLoadable(v).getValue()
60762
- )
60479
+ (v) => actionCtx.snapshot.getLoadable(v).toPromise()
60763
60480
  ) : value;
60764
- return acc;
60765
- },
60766
- {}
60767
- );
60481
+ return [k, resolvedValue];
60482
+ })
60483
+ ).then((entries) => Object.fromEntries(entries));
60768
60484
  const ws_channel = await actionCtx.wsClient.getChannel();
60769
60485
  const res = await request(
60770
60486
  `/api/core/action/${annotatedAction.definition_uid}`,
@@ -61038,128 +60754,6 @@ Inferred class string: "${iconClasses}."`
61038
60754
  const { login, logout, ...extraRoutes } = authConfig.auth_components;
61039
60755
  return /* @__PURE__ */ React.createElement(Switch$1, null, /* @__PURE__ */ React.createElement(Route, { path: "/login" }, /* @__PURE__ */ React.createElement(DynamicAuthComponent, { component: login })), /* @__PURE__ */ React.createElement(Route, { path: "/logout" }, /* @__PURE__ */ React.createElement(DynamicAuthComponent, { component: logout })), Object.entries(extraRoutes).map(([path, component]) => /* @__PURE__ */ React.createElement(Route, { key: path, path: `/${path}` }, /* @__PURE__ */ React.createElement(DynamicAuthComponent, { component }))), /* @__PURE__ */ React.createElement(Route, { component: ErrorPage, path: "/error" }), /* @__PURE__ */ React.createElement(Route, { path: "/", render: () => /* @__PURE__ */ React.createElement(PrivateRoute, null, props.children) }));
61040
60756
  }
61041
- function useDataVariable(variable) {
61042
- const extras = useRequestExtras();
61043
- const { client: wsClient } = React$1.useContext(websocketCtx);
61044
- if (isDataVariable(variable)) {
61045
- registerDataVariable(variable);
61046
- const serverTriggers$ = React$1.useMemo(() => wsClient.serverTriggers$(variable.uid), []);
61047
- const [serverTriggerCounter, setServerTriggerCounter] = React$1.useState(0);
61048
- React$1.useEffect(() => {
61049
- const sub = serverTriggers$.subscribe(() => setServerTriggerCounter((c) => c + 1));
61050
- return () => sub.unsubscribe();
61051
- }, [serverTriggers$]);
61052
- const fetchDataVariable2 = useFetchDataVariable(variable, serverTriggerCounter);
61053
- return fetchDataVariable2;
61054
- }
61055
- const variablesContext = React$1.useContext(variablesCtx);
61056
- variablesContext?.variables.current.add(variable.uid);
61057
- React$1.useEffect(() => {
61058
- return () => {
61059
- variablesContext?.variables.current.delete(variable.uid);
61060
- };
61061
- }, []);
61062
- const taskContext = useTaskContext();
61063
- const dvSelector = useDerivedVariable(variable, wsClient, taskContext, extras);
61064
- const dvLoadable = Recoil_index_21(dvSelector);
61065
- const [dvValue, setDvValue] = React$1.useState(dvLoadable.toPromise());
61066
- React$1.useEffect(() => {
61067
- if (dvLoadable.state === "loading") {
61068
- setDvValue(dvLoadable.toPromise());
61069
- }
61070
- }, [dvLoadable]);
61071
- const fetchDerivedDataVariable2 = useFetchDerivedDataVariable(variable, taskContext, wsClient, dvValue);
61072
- return fetchDerivedDataVariable2;
61073
- }
61074
- function useAnyVariable(variable) {
61075
- if (isDataVariable(variable) || isDerivedDataVariable(variable)) {
61076
- const getData = useDataVariable(variable);
61077
- const { data, refetch } = reactQuery.useQuery({
61078
- // ideally would be 0 but that causes infinite loops, see https://github.com/TanStack/query/issues/2367
61079
- cacheTime: 1,
61080
- queryFn: async () => {
61081
- const dataResponse = await getData();
61082
- return dataResponse.data;
61083
- },
61084
- queryKey: ["any-variable-data", variable.uid],
61085
- refetchOnWindowFocus: false,
61086
- suspense: true
61087
- });
61088
- React$1.useEffect(() => {
61089
- refetch();
61090
- }, [getData]);
61091
- return data ?? void 0;
61092
- }
61093
- return useVariable(variable)[0];
61094
- }
61095
- function getVariableValue(variable, shouldFetchVariable = false, ctx) {
61096
- const resolved = resolveVariable(
61097
- variable,
61098
- ctx.client,
61099
- ctx.taskContext,
61100
- ctx.extras,
61101
- (v) => ctx.snapshot.getLoadable(v).getValue()
61102
- );
61103
- if (isResolvedSwitchVariable(resolved)) {
61104
- throw new UserError("Switch variables are not supported in this context");
61105
- }
61106
- if (!shouldFetchVariable || !isDerivedVariable(variable) && !isDataVariable(variable) && !isDerivedDataVariable(variable)) {
61107
- return resolved;
61108
- }
61109
- if (!isResolvedDerivedVariable(resolved) && !isResolvedDataVariable(resolved) && !isResolvedDerivedDataVariable(resolved)) {
61110
- return resolved;
61111
- }
61112
- if (isResolvedDataVariable(resolved)) {
61113
- return fetchDataVariable(resolved.uid, ctx.extras, resolved.filters);
61114
- }
61115
- return fetchDerivedVariable({
61116
- cache: variable.cache,
61117
- extras: ctx.extras,
61118
- force_key: null,
61119
- /**
61120
- * In this case we're not concerned about different selectors fetching the value so just use the uid
61121
- */
61122
- selectorKey: resolved.uid,
61123
- values: normalizeRequest(
61124
- cleanArgs(resolved.values),
61125
- variable.variables
61126
- ),
61127
- variableUid: resolved.uid,
61128
- wsClient: ctx.client
61129
- }).then((resp) => {
61130
- if (isTaskResponse$1(resp)) {
61131
- throw new Error("Task DerivedVariables are not supported in this context");
61132
- }
61133
- if (isDerivedDataVariable(variable)) {
61134
- return ctx.client.getChannel().then(
61135
- (chan) => fetchDerivedDataVariable(variable.uid, ctx.extras, resp.cache_key, chan, variable.filters)
61136
- );
61137
- }
61138
- return resp.value;
61139
- });
61140
- }
61141
- function useVariableValue(variable, shouldFetchVariable = false) {
61142
- const taskContext = useTaskContext();
61143
- const { client: client2 } = React$1.useContext(websocketCtx);
61144
- const { search } = useLocation();
61145
- const extras = useRequestExtras();
61146
- if (!isVariable(variable)) {
61147
- return () => variable;
61148
- }
61149
- return Recoil_index_31(
61150
- ({ snapshot }) => {
61151
- return () => {
61152
- return getVariableValue(variable, shouldFetchVariable, {
61153
- client: client2,
61154
- extras,
61155
- snapshot,
61156
- taskContext
61157
- });
61158
- };
61159
- },
61160
- [variable.uid, useDeepCompare(taskContext), client2, search, extras]
61161
- );
61162
- }
61163
60757
  function useRefreshSelector() {
61164
60758
  return Recoil_index_31(({ refresh }) => {
61165
60759
  return (key, extras) => {
@@ -61178,16 +60772,16 @@ Inferred class string: "${iconClasses}."`
61178
60772
  const { client: client2 } = React$1.useContext(websocketCtx);
61179
60773
  const taskCtx = useTaskContext();
61180
60774
  return Recoil_index_31(({ snapshot }) => {
61181
- return (variable) => {
60775
+ return async (variable) => {
61182
60776
  if (!isRegistered(variable)) {
61183
60777
  return "__NOT_REGISTERED__";
61184
60778
  }
61185
- const resolvedVariable = resolveVariable(
60779
+ const resolvedVariable = await resolveVariable(
61186
60780
  variable,
61187
60781
  client2,
61188
60782
  taskCtx,
61189
60783
  extras,
61190
- (v) => snapshot.getLoadable(v).getValue()
60784
+ (v) => snapshot.getLoadable(v).toPromise()
61191
60785
  );
61192
60786
  return resolvedVariable;
61193
60787
  };
@@ -61476,14 +61070,12 @@ Inferred class string: "${iconClasses}."`
61476
61070
  eviction: "most-recent"
61477
61071
  },
61478
61072
  get: (extrasSerializable) => async ({ get }) => {
61479
- const resolvedKwargs = Object.keys(dynamicKwargs).reduce(
61480
- (acc, k) => {
61481
- const value = dynamicKwargs[k];
61482
- acc[k] = isVariable(value) ? resolveVariable(value, wsClient, taskContext, currentExtras) : value;
61483
- return acc;
61484
- },
61485
- {}
61486
- );
61073
+ const resolvedKwargs = await Promise.all(
61074
+ Object.entries(dynamicKwargs).map(async ([k, value]) => {
61075
+ const resolvedValue = isVariable(value) ? await resolveVariable(value, wsClient, taskContext, currentExtras) : value;
61076
+ return [k, resolvedValue];
61077
+ })
61078
+ ).then((entries) => Object.fromEntries(entries));
61487
61079
  const resolvedKwargsList = Object.values(resolvedKwargs);
61488
61080
  const kwargsList = Object.values(dynamicKwargs);
61489
61081
  const triggerAtom = getOrRegisterComponentTrigger(uid2);
@@ -61495,7 +61087,6 @@ Inferred class string: "${iconClasses}."`
61495
61087
  kwargsList,
61496
61088
  // pass deps=kwargs
61497
61089
  resolvedKwargsList,
61498
- wsClient,
61499
61090
  get,
61500
61091
  selfTrigger
61501
61092
  );
@@ -61531,8 +61122,10 @@ Inferred class string: "${iconClasses}."`
61531
61122
  taskContext.startTask(taskId, key, getComponentRegistryKey(uid2, true));
61532
61123
  try {
61533
61124
  await wsClient.waitForTask(taskId);
61534
- } catch {
61535
- return null;
61125
+ } catch (e2) {
61126
+ e2.selectorId = key;
61127
+ e2.selectorExtras = extrasSerializable.toJSON();
61128
+ throw e2;
61536
61129
  } finally {
61537
61130
  taskContext.endTask(taskId);
61538
61131
  }
@@ -61891,7 +61484,9 @@ Inferred class string: "${iconClasses}."`
61891
61484
  const taskIds = findRunningTasks(taskContext, props.variablesRef);
61892
61485
  if (taskIds.length > 0) {
61893
61486
  setSubscribedTaskIds(taskIds);
61894
- progressSubscription = wsClient.progressUpdates$(...taskIds).subscribe((notif) => setLatestProgressUpdate(notif.message));
61487
+ progressSubscription = wsClient.progressUpdates$(...taskIds).subscribe((notif) => {
61488
+ setLatestProgressUpdate(notif.message);
61489
+ });
61895
61490
  clearInterval(timer2);
61896
61491
  }
61897
61492
  }, POLLING_INTERVAL);
@@ -62069,7 +61664,7 @@ Inferred class string: "${iconClasses}."`
62069
61664
  pollingInterval = variable.polling_interval;
62070
61665
  }
62071
61666
  variable.variables.forEach((value) => {
62072
- if (isDerivedVariable(value) || isDerivedDataVariable(value)) {
61667
+ if (isDerivedVariable(value)) {
62073
61668
  const innerPollingInterval = getDerivedVariablePollingInterval(value);
62074
61669
  if (innerPollingInterval && (!pollingInterval || pollingInterval > innerPollingInterval)) {
62075
61670
  pollingInterval = innerPollingInterval;
@@ -62081,7 +61676,7 @@ Inferred class string: "${iconClasses}."`
62081
61676
  function computePollingInterval(kwargs, componentInterval) {
62082
61677
  let pollingInterval;
62083
61678
  Object.values(kwargs).forEach((value) => {
62084
- if (isDerivedVariable(value) || isDerivedDataVariable(value)) {
61679
+ if (isDerivedVariable(value)) {
62085
61680
  const innerPollingInterval = getDerivedVariablePollingInterval(value);
62086
61681
  if (innerPollingInterval && (!pollingInterval || pollingInterval > innerPollingInterval)) {
62087
61682
  pollingInterval = innerPollingInterval;
@@ -62782,9 +62377,9 @@ Inferred class string: "${iconClasses}."`
62782
62377
  function VariableStateProvider(props) {
62783
62378
  const getVariableState = useVariableState();
62784
62379
  React$1.useEffect(() => {
62785
- const sub = props.wsClient?.variableRequests$().subscribe((req) => {
62380
+ const sub = props.wsClient?.variableRequests$().subscribe(async (req) => {
62786
62381
  try {
62787
- const variableValue = getVariableState(req.message.variable);
62382
+ const variableValue = await getVariableState(req.message.variable);
62788
62383
  props.wsClient.sendVariable(variableValue, req.message.__rchan);
62789
62384
  } catch (err2) {
62790
62385
  console.warn(`Error when processing a getVariableValue request: ${String(err2)}`);
@@ -62894,7 +62489,7 @@ Inferred class string: "${iconClasses}."`
62894
62489
  {
62895
62490
  value: { actionRegistry: actions, componentRegistry: components, refetchComponents }
62896
62491
  },
62897
- /* @__PURE__ */ React.createElement(DynamicContext, { contextComponents: config2?.context_components ?? [] }, /* @__PURE__ */ React.createElement(StoreProviders, null, /* @__PURE__ */ React.createElement(RootWrapper, null, /* @__PURE__ */ React.createElement(DynamicComponent$1, { component: template.layout }), /* @__PURE__ */ React.createElement(VariableStateProvider, { wsClient }), config2?.enable_devtools && /* @__PURE__ */ React.createElement(DevTools, null))))
62492
+ /* @__PURE__ */ React.createElement(DynamicContext, { contextComponents: config2?.context_components ?? [] }, /* @__PURE__ */ React.createElement(StoreProviders, null, /* @__PURE__ */ React.createElement(ServerVariableSyncProvider, null, /* @__PURE__ */ React.createElement(RootWrapper, null, /* @__PURE__ */ React.createElement(DynamicComponent$1, { component: template.layout }), /* @__PURE__ */ React.createElement(VariableStateProvider, { wsClient }), config2?.enable_devtools && /* @__PURE__ */ React.createElement(DevTools, null)))))
62898
62493
  )));
62899
62494
  }
62900
62495
  const Wrapper = styled.div`
@@ -62948,21 +62543,22 @@ Inferred class string: "${iconClasses}."`
62948
62543
  };
62949
62544
  const ResetVariables = (ctx, actionImpl) => {
62950
62545
  actionImpl.variables.filter(isVariable).forEach((variable) => {
62951
- if (isDerivedVariable(variable) || isDerivedDataVariable(variable)) {
62546
+ if (isDerivedVariable(variable)) {
62952
62547
  const triggerAtom = getOrRegisterTrigger(variable);
62953
62548
  ctx.set(triggerAtom, (triggerIndexValue) => ({
62954
62549
  force_key: nanoid(),
62955
62550
  inc: triggerIndexValue.inc + 1
62956
62551
  }));
62957
- } else if (isUrlVariable(variable)) {
62958
- const urlAtom = getOrRegisterUrlVariable(variable);
62959
- ctx.set(urlAtom, variable.default);
62960
- ctx.eventBus.publish("URL_VARIABLE_LOADED", { variable, value: variable.default });
62961
- } else if (isDataVariable(variable)) ;
62962
- else if (isSwitchVariable(variable)) ;
62552
+ } else if (isSwitchVariable(variable)) ;
62553
+ else if (isStateVariable(variable)) ;
62554
+ else if (isServerVariable(variable)) ;
62963
62555
  else {
62964
62556
  const plainAtom = getOrRegisterPlainVariable(variable, ctx.wsClient, ctx.taskCtx, ctx.extras);
62965
- ctx.reset(plainAtom);
62557
+ if (variable.store?.__typename === "QueryParamStore") {
62558
+ ctx.set(plainAtom, variable.default);
62559
+ } else {
62560
+ ctx.reset(plainAtom);
62561
+ }
62966
62562
  ctx.eventBus.publish("PLAIN_VARIABLE_LOADED", { variable, value: variable.default });
62967
62563
  }
62968
62564
  });
@@ -62977,20 +62573,10 @@ Inferred class string: "${iconClasses}."`
62977
62573
  const INPUT = "__dara_input__";
62978
62574
  const TOGGLE = "__dara_toggle__";
62979
62575
  const UpdateVariable = async (ctx, actionImpl) => {
62980
- let varAtom;
62981
- let eventName;
62982
- switch (actionImpl.variable.__typename) {
62983
- case "Variable":
62984
- varAtom = getOrRegisterPlainVariable(actionImpl.variable, ctx.wsClient, ctx.taskCtx, ctx.extras);
62985
- eventName = "PLAIN_VARIABLE_LOADED";
62986
- break;
62987
- case "UrlVariable":
62988
- varAtom = getOrRegisterUrlVariable(actionImpl.variable);
62989
- eventName = "URL_VARIABLE_LOADED";
62990
- break;
62991
- case "DataVariable":
62992
- throw new Error("DataVariable is not supported in UpdateVariable action");
62576
+ if (actionImpl.variable.__typename !== "Variable") {
62577
+ throw new UserError("UpdateVariable action only supports Variables");
62993
62578
  }
62579
+ const varAtom = getOrRegisterPlainVariable(actionImpl.variable, ctx.wsClient, ctx.taskCtx, ctx.extras);
62994
62580
  let newValue;
62995
62581
  if (actionImpl.value === INPUT) {
62996
62582
  newValue = ctx.input;
@@ -63001,8 +62587,11 @@ Inferred class string: "${iconClasses}."`
63001
62587
  newValue = actionImpl.value;
63002
62588
  }
63003
62589
  ctx.set(varAtom, newValue);
63004
- ctx.eventBus.publish(eventName, { variable: actionImpl.variable, value: newValue });
62590
+ ctx.eventBus.publish("PLAIN_VARIABLE_LOADED", { variable: actionImpl.variable, value: newValue });
63005
62591
  };
62592
+ function commonjsRequire(path) {
62593
+ throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
62594
+ }
63006
62595
  var exceljs_min = { exports: {} };
63007
62596
  /*! ExcelJS 19-10-2023 */
63008
62597
  var hasRequiredExceljs_min;
@@ -86205,10 +85794,37 @@ Inferred class string: "${iconClasses}."`
86205
85794
  return FileSaver_min$1.exports;
86206
85795
  }
86207
85796
  var FileSaver_minExports = requireFileSaver_min();
85797
+ const COL_PATTERN = /^__col__\d+__(.+)$/;
85798
+ const INDEX_PATTERN = /^__index__\d+__(.+)$/;
85799
+ const restoreColumnName = (colName) => {
85800
+ const colMatch = colName.match(COL_PATTERN);
85801
+ if (colMatch) {
85802
+ return colMatch[1];
85803
+ }
85804
+ const indexMatch = colName.match(INDEX_PATTERN);
85805
+ if (indexMatch) {
85806
+ return indexMatch[1];
85807
+ }
85808
+ return colName;
85809
+ };
85810
+ const processDataForDownload = (content) => {
85811
+ return content.map((row) => {
85812
+ const processedRow = {};
85813
+ Object.entries(row).forEach(([key, value]) => {
85814
+ if (key === "__index__") {
85815
+ return;
85816
+ }
85817
+ const restoredKey = restoreColumnName(key);
85818
+ processedRow[restoredKey] = value;
85819
+ });
85820
+ return processedRow;
85821
+ });
85822
+ };
86208
85823
  const createMatrixFromArrayOfObjects = (content) => {
85824
+ const processedContent = processDataForDownload(content);
86209
85825
  const headings = [];
86210
85826
  const indexes = {};
86211
- content.forEach((c) => {
85827
+ processedContent.forEach((c) => {
86212
85828
  Object.keys(c).forEach((k) => {
86213
85829
  if (!headings.includes(k)) {
86214
85830
  headings.push(k);
@@ -86218,7 +85834,7 @@ Inferred class string: "${iconClasses}."`
86218
85834
  });
86219
85835
  const headingsLength = headings.length;
86220
85836
  const matrix = [];
86221
- content.forEach((c) => {
85837
+ processedContent.forEach((c) => {
86222
85838
  const row = new Array(headingsLength);
86223
85839
  Object.entries(c).forEach(([k, v]) => {
86224
85840
  row[indexes[k]] = v;
@@ -86290,22 +85906,24 @@ Inferred class string: "${iconClasses}."`
86290
85906
  return null;
86291
85907
  };
86292
85908
  const DownloadVariable = async (ctx, actionImpl) => {
86293
- let value = getVariableValue(actionImpl.variable, true, {
85909
+ let value = await getTabularVariableValue(actionImpl.variable, {
86294
85910
  client: ctx.wsClient,
86295
85911
  extras: ctx.extras,
86296
85912
  search: ctx.location.search,
86297
85913
  snapshot: ctx.snapshot,
86298
85914
  taskContext: ctx.taskCtx
86299
85915
  });
86300
- if (value instanceof Promise) {
86301
- value = await value;
85916
+ if (value === null) {
85917
+ ctx.notificationCtx.pushNotification({
85918
+ key: "_downloadVariable",
85919
+ message: "Failed to fetch the variable value",
85920
+ status: Status.ERROR,
85921
+ title: "Error fetching variable value"
85922
+ });
85923
+ return;
86302
85924
  }
86303
- if (actionImpl.variable.__typename === "DataVariable" || actionImpl.variable.__typename === "DerivedDataVariable") {
86304
- for (const row of value) {
86305
- if ("__index__" in row) {
86306
- delete row.__index__;
86307
- }
86308
- }
85925
+ if (Array.isArray(value)) {
85926
+ value = processDataForDownload(value);
86309
85927
  }
86310
85928
  const fileName = actionImpl.file_name || "Data";
86311
85929
  const fileNameWithExt = `${fileName}.${actionImpl.type}`;
@@ -86611,7 +86229,7 @@ Inferred class string: "${iconClasses}."`
86611
86229
  return /* @__PURE__ */ React__namespace.createElement(DynamicComponent$1, { component: transformedRenderer });
86612
86230
  }, isEqual$5);
86613
86231
  function ForImpl(props) {
86614
- const items = useAnyVariable(props.items);
86232
+ const [items] = useVariable(props.items, { suspend: false });
86615
86233
  const markers = React__namespace.useMemo(() => getInjectionMarkers(props.renderer), [props.renderer]);
86616
86234
  const key = React__namespace.useMemo(() => props.key_accessor?.split(".") ?? null, [props.key_accessor]);
86617
86235
  const getItemKey = React__namespace.useCallback(
@@ -86694,6 +86312,7 @@ Inferred class string: "${iconClasses}."`
86694
86312
  exports.ResetVariables = ResetVariables;
86695
86313
  exports.RouterContent = RouterContent;
86696
86314
  exports.RowFallback = RowFallback;
86315
+ exports.ServerVariableSyncProvider = ServerVariableSyncProvider;
86697
86316
  exports.SideBarFrame = SideBarFrame;
86698
86317
  exports.TemplateRoot = TemplateRoot;
86699
86318
  exports.TopBarFrame = TopBarFrame;
@@ -86713,29 +86332,30 @@ Inferred class string: "${iconClasses}."`
86713
86332
  exports.clearCaches_TEST = clearCaches_TEST;
86714
86333
  exports.clearRegistries_TEST = clearRegistries_TEST;
86715
86334
  exports.combineFilters = combineFilters;
86716
- exports.dataRegistry = dataRegistry;
86717
86335
  exports.default = run;
86718
86336
  exports.depsRegistry = depsRegistry;
86719
86337
  exports.fetchDerivedVariable = fetchDerivedVariable;
86338
+ exports.fetchTabularServerVariable = fetchTabularServerVariable;
86720
86339
  exports.fetchTaskResult = fetchTaskResult;
86721
86340
  exports.getComponentRegistryKey = getComponentRegistryKey;
86722
86341
  exports.getDeps = getDeps;
86723
86342
  exports.getIcon = getIcon;
86724
86343
  exports.getOrRegisterDerivedVariable = getOrRegisterDerivedVariable;
86344
+ exports.getOrRegisterDerivedVariableResult = getOrRegisterDerivedVariableResult;
86725
86345
  exports.getOrRegisterDerivedVariableValue = getOrRegisterDerivedVariableValue;
86346
+ exports.getOrRegisterServerVariable = getOrRegisterServerVariable;
86726
86347
  exports.getRegistryKey = getRegistryKey;
86727
86348
  exports.getSessionToken = getSessionToken;
86349
+ exports.getTabularVariableValue = getTabularVariableValue;
86728
86350
  exports.getToken = getToken;
86729
86351
  exports.getTokenKey = getTokenKey;
86730
- exports.getVariableValue = getVariableValue;
86731
86352
  exports.handleAuthErrors = handleAuthErrors;
86732
86353
  exports.injectCss = injectCss;
86733
86354
  exports.isActionImpl = isActionImpl;
86734
86355
  exports.isAnnotatedAction = isAnnotatedAction;
86735
86356
  exports.isCondition = isCondition;
86736
86357
  exports.isConditionTrue = isConditionTrue;
86737
- exports.isDataVariable = isDataVariable;
86738
- exports.isDerivedDataVariable = isDerivedDataVariable;
86358
+ exports.isDataResponse = isDataResponse;
86739
86359
  exports.isDerivedVariable = isDerivedVariable;
86740
86360
  exports.isInvalidComponent = isInvalidComponent;
86741
86361
  exports.isJsComponent = isJsComponent;
@@ -86743,13 +86363,14 @@ Inferred class string: "${iconClasses}."`
86743
86363
  exports.isPyComponent = isPyComponent;
86744
86364
  exports.isRawString = isRawString;
86745
86365
  exports.isRegistered = isRegistered;
86746
- exports.isResolvedDataVariable = isResolvedDataVariable;
86747
- exports.isResolvedDerivedDataVariable = isResolvedDerivedDataVariable;
86748
86366
  exports.isResolvedDerivedVariable = isResolvedDerivedVariable;
86367
+ exports.isResolvedServerVariable = isResolvedServerVariable;
86749
86368
  exports.isResolvedSwitchVariable = isResolvedSwitchVariable;
86369
+ exports.isServerVariable = isServerVariable;
86370
+ exports.isSingleVariable = isSingleVariable;
86371
+ exports.isStateVariable = isStateVariable;
86750
86372
  exports.isSwitchVariable = isSwitchVariable;
86751
86373
  exports.isTaskResponse = isTaskResponse$1;
86752
- exports.isUrlVariable = isUrlVariable;
86753
86374
  exports.isVariable = isVariable;
86754
86375
  exports.normalizeRequest = normalizeRequest;
86755
86376
  exports.onTokenChange = onTokenChange;
@@ -86760,6 +86381,7 @@ Inferred class string: "${iconClasses}."`
86760
86381
  exports.resolveDerivedValue = resolveDerivedValue;
86761
86382
  exports.resolveNested = resolveNested;
86762
86383
  exports.resolveReferrer = resolveReferrer;
86384
+ exports.resolveServerVariable = resolveServerVariable;
86763
86385
  exports.resolveTheme = resolveTheme;
86764
86386
  exports.revokeSession = revokeSession;
86765
86387
  exports.selectorFamilyMembersRegistry = selectorFamilyMembersRegistry;
@@ -86771,17 +86393,17 @@ Inferred class string: "${iconClasses}."`
86771
86393
  exports.useAction = useAction;
86772
86394
  exports.useActionIsLoading = useActionIsLoading;
86773
86395
  exports.useActions = useActions;
86774
- exports.useAnyVariable = useAnyVariable;
86775
86396
  exports.useAuthConfig = useAuthConfig;
86776
86397
  exports.useComponentRegistry = useComponentRegistry;
86777
86398
  exports.useComponentStyles = useComponentStyles;
86778
86399
  exports.useComponents = useComponents;
86779
86400
  exports.useConditionOrVariable = useConditionOrVariable;
86780
86401
  exports.useConfig = useConfig;
86781
- exports.useDataVariable = useDataVariable;
86782
86402
  exports.useDeferLoadable = useDeferLoadable;
86783
86403
  exports.useDerivedVariable = useDerivedVariable;
86784
86404
  exports.useEventBus = useEventBus;
86405
+ exports.useFetchTabularDerivedVariable = useFetchTabularDerivedVariable;
86406
+ exports.useFetchTabularServerVariable = useFetchTabularServerVariable;
86785
86407
  exports.useInterval = useInterval;
86786
86408
  exports.usePrevious = usePrevious;
86787
86409
  exports.useRefreshSelector = useRefreshSelector;
@@ -86790,6 +86412,7 @@ Inferred class string: "${iconClasses}."`
86790
86412
  exports.useSession = useSession;
86791
86413
  exports.useSessionToken = useSessionToken;
86792
86414
  exports.useSwitchVariable = useSwitchVariable;
86415
+ exports.useTabularVariable = useTabularVariable;
86793
86416
  exports.useTaskContext = useTaskContext;
86794
86417
  exports.useTemplate = useTemplate;
86795
86418
  exports.useTriggerIndex = useTriggerIndex;
@@ -86797,7 +86420,6 @@ Inferred class string: "${iconClasses}."`
86797
86420
  exports.useUser = useUser;
86798
86421
  exports.useVariable = useVariable;
86799
86422
  exports.useVariableState = useVariableState;
86800
- exports.useVariableValue = useVariableValue;
86801
86423
  exports.useWindowTitle = useWindowTitle;
86802
86424
  exports.verifySessionToken = verifySessionToken;
86803
86425
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });