@workflow/web 5.3.1 → 5.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +11 -34
  2. package/build/client/assets/app-BHCSMHev.css +1 -0
  3. package/build/client/assets/{arrow-up-right-CNHh1bh2.js → arrow-up-right-DyaB_ak4.js} +1 -1
  4. package/build/client/assets/{entry.client-DDsh88VE.js → entry.client-xzxVCL3o.js} +1 -1
  5. package/build/client/assets/{highlighted-body-JLMTFACH-CWHg5f-6.js → highlighted-body-JLMTFACH-1yzOVKg0.js} +2 -2
  6. package/build/client/assets/{home-DZqYMSiD.js → home--wf0CrF6.js} +5 -3
  7. package/build/client/assets/{index-BS6T0Zjc.js → index-wl5l5E8H.js} +30 -25
  8. package/build/client/assets/manifest-7b81d8d4.js +1 -0
  9. package/build/client/assets/{mermaid-WFAXDIZX-BLO7Z8RE.js → mermaid-WFAXDIZX-CB__BxYb.js} +272 -2736
  10. package/build/client/assets/meta-9cjJ0pVb.js +6 -0
  11. package/build/client/assets/{root-wdKzRZGT.js → root-C1XwTNUK.js} +14 -8
  12. package/build/client/assets/root-C3ED6Dwc.css +1 -0
  13. package/build/client/assets/rpc-client-SbyXJdFV.js +2482 -0
  14. package/build/client/assets/{run-detail-DyXpnv9C.js → run-detail-2CnpdXm1.js} +426 -618
  15. package/build/client/assets/run-usage-C3aywyqa.js +33 -0
  16. package/build/client/assets/run-usage-DRV6lopZ.js +1261 -0
  17. package/build/client/assets/skeleton-DMLgjvZZ.js +94 -0
  18. package/build/client/assets/{url-state-DhOv2zv0.js → url-state-JAVaNZ_m.js} +79 -159
  19. package/build/client/assets/{zstd-browser-decoder-BNeg7hxG.js → zstd-browser-decoder-Z5736ep5.js} +2 -2
  20. package/build/server/assets/{app-CNGxG3wL.js → app-C4Vf0mu1.js} +2256 -470
  21. package/build/server/assets/{highlighted-body-JLMTFACH-Bj8JsfUl.js → highlighted-body-JLMTFACH-CF_5tt3-.js} +1 -1
  22. package/build/server/assets/{index-DGn_6xEN.js → index-BrYeW--s.js} +4 -4
  23. package/build/server/assets/{mermaid-WFAXDIZX-C_v93dNU.js → mermaid-WFAXDIZX-BHZz_uL6.js} +1 -1
  24. package/build/server/assets/{token-b1ZjKN2Q.js → token-B94O3LuJ.js} +1 -1
  25. package/build/server/assets/{token-5fcfNNDG.js → token-k0na1G9v.js} +2 -2
  26. package/build/server/assets/{token-util-BJhEZw83.js → token-util-DFlzY9Hw.js} +2 -2
  27. package/build/server/assets/{token-util-spPPOelu.js → token-util-DgTmPzWb.js} +1 -1
  28. package/build/server/assets/{wrapper-Cc-ChiPM.js → wrapper-BEqyNEir.js} +2 -2
  29. package/build/server/assets/{zstd-browser-decoder-y4X_FyMk.js → zstd-browser-decoder-LnaKiDUZ.js} +1 -1
  30. package/build/server/index.js +1 -1
  31. package/handler.d.ts +9 -0
  32. package/handler.js +16 -2
  33. package/host-guard.js +179 -0
  34. package/package.json +8 -7
  35. package/server.d.ts +15 -1
  36. package/server.js +14 -1
  37. package/build/client/assets/app-BE8uqS_d.css +0 -1
  38. package/build/client/assets/manifest-f2e93220.js +0 -1
  39. package/build/client/assets/root-BBptRWmF.css +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/zstd-browser-decoder-BNeg7hxG.js","assets/index-BS6T0Zjc.js","assets/highlighted-body-JLMTFACH-CWHg5f-6.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/zstd-browser-decoder-Z5736ep5.js","assets/index-wl5l5E8H.js","assets/highlighted-body-JLMTFACH-1yzOVKg0.js"])))=>i.map(i=>d[i]);
2
2
  var __defProp = Object.defineProperty;
3
3
  var __typeError = (msg) => {
4
4
  throw TypeError(msg);
@@ -9,9 +9,9 @@ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
11
11
  var _a2, _b, _c, _a_instances, e_fn, t_fn, n_fn, _d, _e2;
12
- import { r as reactExports, j as jsxRuntimeExports, E as React2, f as reactDomExports, R as ReactExports, H as ReactDOM, G as getDefaultExportFromCjs } from "./index-BS6T0Zjc.js";
12
+ import { r as reactExports, j as jsxRuntimeExports, H as React2, g as reactDomExports, R as ReactExports, J as ReactDOM, I as getDefaultExportFromCjs } from "./index-wl5l5E8H.js";
13
13
  var __defProp$h = Object.defineProperty;
14
- var __name$h = (target2, value) => __defProp$h(target2, "name", { value, configurable: true });
14
+ var __name$h = (target, value) => __defProp$h(target, "name", { value, configurable: true });
15
15
  var canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement);
16
16
  function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
17
17
  return /* @__PURE__ */ __name$h(function handleEvent(event) {
@@ -62,7 +62,7 @@ function isFrame(element2) {
62
62
  }
63
63
  __name$h(isFrame, "isFrame");
64
64
  var __defProp$g = Object.defineProperty;
65
- var __name$g = (target2, value) => __defProp$g(target2, "name", { value, configurable: true });
65
+ var __name$g = (target, value) => __defProp$g(target, "name", { value, configurable: true });
66
66
  function setRef$1(ref, value) {
67
67
  if (typeof ref === "function") {
68
68
  return ref(value);
@@ -101,7 +101,7 @@ function useComposedRefs(...refs) {
101
101
  }
102
102
  __name$g(useComposedRefs, "useComposedRefs");
103
103
  var __defProp$f = Object.defineProperty;
104
- var __name$f = (target2, value) => __defProp$f(target2, "name", { value, configurable: true });
104
+ var __name$f = (target, value) => __defProp$f(target, "name", { value, configurable: true });
105
105
  // @__NO_SIDE_EFFECTS__
106
106
  function createContext2(rootComponentName, defaultContext) {
107
107
  const Context = reactExports.createContext(defaultContext);
@@ -192,7 +192,7 @@ function composeContextScopes(...scopes) {
192
192
  }
193
193
  __name$f(composeContextScopes, "composeContextScopes");
194
194
  var __defProp$e = Object.defineProperty;
195
- var __name$e = (target2, value) => __defProp$e(target2, "name", { value, configurable: true });
195
+ var __name$e = (target, value) => __defProp$e(target, "name", { value, configurable: true });
196
196
  // @__NO_SIDE_EFFECTS__
197
197
  function createSlot(ownerName) {
198
198
  const Slot2 = reactExports.forwardRef((props, forwardedRef) => {
@@ -347,7 +347,7 @@ var createSlottableError = /* @__PURE__ */ __name$e((ownerName) => {
347
347
  }, "createSlottableError");
348
348
  var use = React2[" use ".trim().toString()];
349
349
  var __defProp$d = Object.defineProperty;
350
- var __name$d = (target2, value) => __defProp$d(target2, "name", { value, configurable: true });
350
+ var __name$d = (target, value) => __defProp$d(target, "name", { value, configurable: true });
351
351
  var NODES = [
352
352
  "a",
353
353
  "button",
@@ -380,14 +380,14 @@ var Primitive = NODES.reduce((primitive, node2) => {
380
380
  Node2.displayName = `Primitive.${node2}`;
381
381
  return { ...primitive, [node2]: Node2 };
382
382
  }, {});
383
- function dispatchDiscreteCustomEvent(target2, event) {
384
- if (target2) reactDomExports.flushSync(() => target2.dispatchEvent(event));
383
+ function dispatchDiscreteCustomEvent(target, event) {
384
+ if (target) reactDomExports.flushSync(() => target.dispatchEvent(event));
385
385
  }
386
386
  __name$d(dispatchDiscreteCustomEvent, "dispatchDiscreteCustomEvent");
387
387
  var useLayoutEffect2 = (globalThis == null ? void 0 : globalThis.document) ? reactExports.useLayoutEffect : () => {
388
388
  };
389
389
  var __defProp$c = Object.defineProperty;
390
- var __name$c = (target2, value) => __defProp$c(target2, "name", { value, configurable: true });
390
+ var __name$c = (target, value) => __defProp$c(target, "name", { value, configurable: true });
391
391
  var useReactInsertionEffect$1 = React2[" useInsertionEffect ".trim().toString()];
392
392
  function useCallbackRef(callback) {
393
393
  const callbackRef = reactExports.useRef(callback);
@@ -407,7 +407,7 @@ function useCallbackRef(callback) {
407
407
  }
408
408
  __name$c(useCallbackRef, "useCallbackRef");
409
409
  var __defProp$b = Object.defineProperty;
410
- var __name$b = (target2, value) => __defProp$b(target2, "name", { value, configurable: true });
410
+ var __name$b = (target, value) => __defProp$b(target, "name", { value, configurable: true });
411
411
  var CONTEXT_UPDATE = "dismissableLayer.update";
412
412
  var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
413
413
  var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
@@ -462,12 +462,12 @@ var DismissableLayer = /* @__PURE__ */ reactExports.forwardRef(
462
462
  isDeferredPointerDownOutsideRef,
463
463
  dismissableSurfaces: context.dismissableSurfaces,
464
464
  shouldHandlePointerDownOutside: reactExports.useCallback(
465
- (target2) => {
466
- if (!(target2 instanceof Node)) {
465
+ (target) => {
466
+ if (!(target instanceof Node)) {
467
467
  return false;
468
468
  }
469
469
  const isPointerDownOnBranch = [...context.branches].some(
470
- (branch) => branch.contains(target2)
470
+ (branch) => branch.contains(target)
471
471
  );
472
472
  return isPointerEventsEnabled && !isPointerDownOnBranch;
473
473
  },
@@ -479,8 +479,8 @@ var DismissableLayer = /* @__PURE__ */ reactExports.forwardRef(
479
479
  if (deferPointerDownOutside && isDeferredPointerDownOutsideRef.current) {
480
480
  return;
481
481
  }
482
- const target2 = event.target;
483
- const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target2));
482
+ const target = event.target;
483
+ const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
484
484
  if (isFocusInBranch) return;
485
485
  onFocusOutside == null ? void 0 : onFocusOutside(event);
486
486
  onInteractOutside == null ? void 0 : onInteractOutside(event);
@@ -601,8 +601,8 @@ function usePointerDownOutside(onPointerDownOutside, args) {
601
601
  if (!isPointerDownOutsideRef.current) {
602
602
  return;
603
603
  }
604
- const target2 = event.target;
605
- const isDismissableSurface = target2 instanceof Node && [...dismissableSurfaces].some((surface) => surface.contains(target2));
604
+ const target = event.target;
605
+ const isDismissableSurface = target instanceof Node && [...dismissableSurfaces].some((surface) => surface.contains(target));
606
606
  if (!isDismissableSurface) {
607
607
  interceptedOutsideInteractionEventsRef.current.set(event.type, true);
608
608
  }
@@ -725,18 +725,18 @@ function dispatchUpdate() {
725
725
  }
726
726
  __name$b(dispatchUpdate, "dispatchUpdate");
727
727
  function handleAndDispatchCustomEvent(name2, handler, detail, { discrete }) {
728
- const target2 = detail.originalEvent.target;
728
+ const target = detail.originalEvent.target;
729
729
  const event = new CustomEvent(name2, { bubbles: false, cancelable: true, detail });
730
- if (handler) target2.addEventListener(name2, handler, { once: true });
730
+ if (handler) target.addEventListener(name2, handler, { once: true });
731
731
  if (discrete) {
732
- dispatchDiscreteCustomEvent(target2, event);
732
+ dispatchDiscreteCustomEvent(target, event);
733
733
  } else {
734
- target2.dispatchEvent(event);
734
+ target.dispatchEvent(event);
735
735
  }
736
736
  }
737
737
  __name$b(handleAndDispatchCustomEvent, "handleAndDispatchCustomEvent");
738
738
  var __defProp$a = Object.defineProperty;
739
- var __name$a = (target2, value) => __defProp$a(target2, "name", { value, configurable: true });
739
+ var __name$a = (target, value) => __defProp$a(target, "name", { value, configurable: true });
740
740
  var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
741
741
  var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
742
742
  var EVENT_OPTIONS = { bubbles: false, cancelable: true };
@@ -760,11 +760,11 @@ var FocusScope = /* @__PURE__ */ reactExports.forwardRef(
760
760
  branchesRef.current = branches;
761
761
  });
762
762
  const isTargetInScope = reactExports.useCallback(
763
- (target2) => {
763
+ (target) => {
764
764
  var _a3;
765
- if (!target2) return false;
766
- if (container == null ? void 0 : container.contains(target2)) return true;
767
- return Boolean((_a3 = branchesRef.current) == null ? void 0 : _a3.some((branch) => branch.contains(target2)));
765
+ if (!target) return false;
766
+ if (container == null ? void 0 : container.contains(target)) return true;
767
+ return Boolean((_a3 = branchesRef.current) == null ? void 0 : _a3.some((branch) => branch.contains(target)));
768
768
  },
769
769
  [container]
770
770
  );
@@ -781,9 +781,9 @@ var FocusScope = /* @__PURE__ */ reactExports.forwardRef(
781
781
  if (trapped) {
782
782
  let handleFocusIn2 = function(event) {
783
783
  if (focusScope.paused || !container) return;
784
- const target2 = event.target;
785
- if (isTargetInScope(target2)) {
786
- lastFocusedElementRef.current = target2;
784
+ const target = event.target;
785
+ if (isTargetInScope(target)) {
786
+ lastFocusedElementRef.current = target;
787
787
  } else {
788
788
  focus(lastFocusedElementRef.current, { select: true });
789
789
  }
@@ -1006,7 +1006,7 @@ function removeLinks(items) {
1006
1006
  }
1007
1007
  __name$a(removeLinks, "removeLinks");
1008
1008
  var __defProp$9 = Object.defineProperty;
1009
- var __name$9 = (target2, value) => __defProp$9(target2, "name", { value, configurable: true });
1009
+ var __name$9 = (target, value) => __defProp$9(target, "name", { value, configurable: true });
1010
1010
  var useReactId = React2[" useId ".trim().toString()] || (() => void 0);
1011
1011
  var count = 0;
1012
1012
  function useId(deterministicId) {
@@ -2895,7 +2895,7 @@ const arrow = (options, deps) => ({
2895
2895
  options: [options, deps]
2896
2896
  });
2897
2897
  var __defProp$8 = Object.defineProperty;
2898
- var __name$8 = (target2, value) => __defProp$8(target2, "name", { value, configurable: true });
2898
+ var __name$8 = (target, value) => __defProp$8(target, "name", { value, configurable: true });
2899
2899
  var Arrow = /* @__PURE__ */ reactExports.forwardRef(
2900
2900
  /* @__PURE__ */ __name$8(function Arrow2(props, forwardedRef) {
2901
2901
  const { children: children2, width = 10, height = 5, ...arrowProps } = props;
@@ -2914,7 +2914,7 @@ var Arrow = /* @__PURE__ */ reactExports.forwardRef(
2914
2914
  }, "Arrow")
2915
2915
  );
2916
2916
  var __defProp$7 = Object.defineProperty;
2917
- var __name$7 = (target2, value) => __defProp$7(target2, "name", { value, configurable: true });
2917
+ var __name$7 = (target, value) => __defProp$7(target, "name", { value, configurable: true });
2918
2918
  function useSize(element2) {
2919
2919
  const [size2, setSize] = reactExports.useState(void 0);
2920
2920
  useLayoutEffect2(() => {
@@ -2958,7 +2958,7 @@ function useSize(element2) {
2958
2958
  }
2959
2959
  __name$7(useSize, "useSize");
2960
2960
  var __defProp$6 = Object.defineProperty;
2961
- var __name$6 = (target2, value) => __defProp$6(target2, "name", { value, configurable: true });
2961
+ var __name$6 = (target, value) => __defProp$6(target, "name", { value, configurable: true });
2962
2962
  var Sticky = {
2963
2963
  Partial: "partial"
2964
2964
  };
@@ -3295,7 +3295,7 @@ function getSideAndAlignFromPlacement(placement) {
3295
3295
  }
3296
3296
  __name$6(getSideAndAlignFromPlacement, "getSideAndAlignFromPlacement");
3297
3297
  var __defProp$5 = Object.defineProperty;
3298
- var __name$5 = (target2, value) => __defProp$5(target2, "name", { value, configurable: true });
3298
+ var __name$5 = (target, value) => __defProp$5(target, "name", { value, configurable: true });
3299
3299
  var Portal = /* @__PURE__ */ reactExports.forwardRef(
3300
3300
  /* @__PURE__ */ __name$5(function Portal2(props, forwardedRef) {
3301
3301
  var _a3;
@@ -3307,7 +3307,7 @@ var Portal = /* @__PURE__ */ reactExports.forwardRef(
3307
3307
  }, "Portal")
3308
3308
  );
3309
3309
  var __defProp$4 = Object.defineProperty;
3310
- var __name$4 = (target2, value) => __defProp$4(target2, "name", { value, configurable: true });
3310
+ var __name$4 = (target, value) => __defProp$4(target, "name", { value, configurable: true });
3311
3311
  function useStateMachine(initialState, machine) {
3312
3312
  return reactExports.useReducer((state, event) => {
3313
3313
  const nextState = machine[state][event];
@@ -3483,7 +3483,7 @@ function getElementRef(element2) {
3483
3483
  }
3484
3484
  __name$4(getElementRef, "getElementRef");
3485
3485
  var __defProp$3 = Object.defineProperty;
3486
- var __name$3 = (target2, value) => __defProp$3(target2, "name", { value, configurable: true });
3486
+ var __name$3 = (target, value) => __defProp$3(target, "name", { value, configurable: true });
3487
3487
  var useReactEffectEvent = React2[" useEffectEvent ".trim().toString()];
3488
3488
  var useReactInsertionEffect = React2[" useInsertionEffect ".trim().toString()];
3489
3489
  function useEffectEvent(callback) {
@@ -3509,7 +3509,7 @@ function useEffectEvent(callback) {
3509
3509
  }
3510
3510
  __name$3(useEffectEvent, "useEffectEvent");
3511
3511
  var __defProp$2 = Object.defineProperty;
3512
- var __name$2 = (target2, value) => __defProp$2(target2, "name", { value, configurable: true });
3512
+ var __name$2 = (target, value) => __defProp$2(target, "name", { value, configurable: true });
3513
3513
  var useInsertionEffect = React2[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
3514
3514
  function useControllableState({
3515
3515
  prop,
@@ -3613,7 +3613,7 @@ function useControllableStateReducer(reducer, userArgs, initialArg, init) {
3613
3613
  }
3614
3614
  __name$2(useControllableStateReducer, "useControllableStateReducer");
3615
3615
  var __defProp$1 = Object.defineProperty;
3616
- var __name$1 = (target2, value) => __defProp$1(target2, "name", { value, configurable: true });
3616
+ var __name$1 = (target, value) => __defProp$1(target, "name", { value, configurable: true });
3617
3617
  var VISUALLY_HIDDEN_STYLES = Object.freeze({
3618
3618
  // See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
3619
3619
  position: "absolute",
@@ -3640,7 +3640,7 @@ var VisuallyHidden = /* @__PURE__ */ reactExports.forwardRef(
3640
3640
  }, "VisuallyHidden")
3641
3641
  );
3642
3642
  var __defProp2 = Object.defineProperty;
3643
- var __name = (target2, value) => __defProp2(target2, "name", { value, configurable: true });
3643
+ var __name = (target, value) => __defProp2(target, "name", { value, configurable: true });
3644
3644
  var [createTooltipContext, createTooltipScope] = /* @__PURE__ */ createContextScope("Tooltip", [
3645
3645
  createPopperScope
3646
3646
  ]);
@@ -3898,9 +3898,9 @@ var TooltipContentHoverable = /* @__PURE__ */ reactExports.forwardRef(/* @__PURE
3898
3898
  reactExports.useEffect(() => {
3899
3899
  if (pointerGraceArea) {
3900
3900
  const handleTrackPointerGrace = /* @__PURE__ */ __name((event) => {
3901
- const target2 = event.target;
3901
+ const target = event.target;
3902
3902
  const pointerPosition = { x: event.clientX, y: event.clientY };
3903
- const hasEnteredTarget = (trigger == null ? void 0 : trigger.contains(target2)) || (content2 == null ? void 0 : content2.contains(target2));
3903
+ const hasEnteredTarget = (trigger == null ? void 0 : trigger.contains(target)) || (content2 == null ? void 0 : content2.contains(target));
3904
3904
  const isPointerOutsideGraceArea = !isPointInPolygon(pointerPosition, pointerGraceArea);
3905
3905
  if (hasEnteredTarget) {
3906
3906
  handleRemoveGraceArea();
@@ -11074,8 +11074,8 @@ function defineLazy(object2, key, getter) {
11074
11074
  configurable: true
11075
11075
  });
11076
11076
  }
11077
- function assignProp(target2, prop, value) {
11078
- Object.defineProperty(target2, prop, {
11077
+ function assignProp(target, prop, value) {
11078
+ Object.defineProperty(target, prop, {
11079
11079
  value,
11080
11080
  writable: true,
11081
11081
  enumerable: true,
@@ -11089,8 +11089,8 @@ function rawShape(def) {
11089
11089
  function sourceShape(schema) {
11090
11090
  return rawShape(schema._zod.def) ?? schema._zod.def.shape;
11091
11091
  }
11092
- function deferProp(target2, key, getter) {
11093
- Object.defineProperty(target2, key, {
11092
+ function deferProp(target, key, getter) {
11093
+ Object.defineProperty(target, key, {
11094
11094
  get() {
11095
11095
  const value = getter();
11096
11096
  assignProp(this, key, value);
@@ -11100,36 +11100,36 @@ function deferProp(target2, key, getter) {
11100
11100
  configurable: true
11101
11101
  });
11102
11102
  }
11103
- function putProp(target2, key, value) {
11104
- if (key in target2)
11105
- assignProp(target2, key, value);
11103
+ function putProp(target, key, value) {
11104
+ if (key in target)
11105
+ assignProp(target, key, value);
11106
11106
  else
11107
- target2[key] = value;
11107
+ target[key] = value;
11108
11108
  }
11109
- function mirrorShape(target2, source, keys2, wrap2) {
11109
+ function mirrorShape(target, source, keys2, wrap2) {
11110
11110
  const raw2 = sourceShape(source);
11111
11111
  for (const key of keys2) {
11112
11112
  const desc = Object.getOwnPropertyDescriptor(raw2, key);
11113
11113
  if (!desc.enumerable)
11114
11114
  continue;
11115
11115
  if (desc.get) {
11116
- deferProp(target2, key, () => {
11116
+ deferProp(target, key, () => {
11117
11117
  const value = source._zod.def.shape[key];
11118
11118
  return wrap2 ? wrap2(value, key) : value;
11119
11119
  });
11120
11120
  } else
11121
- putProp(target2, key, wrap2 ? wrap2(desc.value, key) : desc.value);
11121
+ putProp(target, key, wrap2 ? wrap2(desc.value, key) : desc.value);
11122
11122
  }
11123
11123
  }
11124
- function mirrorProps(target2, source) {
11124
+ function mirrorProps(target, source) {
11125
11125
  for (const key of Reflect.ownKeys(source)) {
11126
11126
  const desc = Object.getOwnPropertyDescriptor(source, key);
11127
11127
  if (!desc.enumerable)
11128
11128
  continue;
11129
11129
  if (desc.get)
11130
- deferProp(target2, key, () => source[key]);
11130
+ deferProp(target, key, () => source[key]);
11131
11131
  else
11132
- putProp(target2, key, desc.value);
11132
+ putProp(target, key, desc.value);
11133
11133
  }
11134
11134
  }
11135
11135
  function mergeDefs(...defs) {
@@ -11650,10 +11650,10 @@ function $constructor(name2, initializer2, proto2, params) {
11650
11650
  let up = own2;
11651
11651
  while (up && up !== ctorProto)
11652
11652
  up = Object.getPrototypeOf(up);
11653
- const target2 = up ?? own2;
11654
- if (!initialized.has(target2)) {
11655
- initialized.add(target2);
11656
- members(target2, protoMembers);
11653
+ const target = up ?? own2;
11654
+ if (!initialized.has(target)) {
11655
+ initialized.add(target);
11656
+ members(target, protoMembers);
11657
11657
  }
11658
11658
  }
11659
11659
  const proto3 = _2.prototype;
@@ -15271,26 +15271,26 @@ function _check(fn2, params) {
15271
15271
  ch._zod.check = fn2;
15272
15272
  return ch;
15273
15273
  }
15274
- function assignProps(target2, ...sources) {
15274
+ function assignProps(target, ...sources) {
15275
15275
  for (const source of sources) {
15276
15276
  for (const key of Reflect.ownKeys(source)) {
15277
15277
  if (Object.prototype.propertyIsEnumerable.call(source, key)) {
15278
- assignProp(target2, key, source[key]);
15278
+ assignProp(target, key, source[key]);
15279
15279
  }
15280
15280
  }
15281
15281
  }
15282
- return target2;
15282
+ return target;
15283
15283
  }
15284
15284
  function initializeContext(params) {
15285
- let target2 = (params == null ? void 0 : params.target) ?? "draft-2020-12";
15286
- if (target2 === "draft-4")
15287
- target2 = "draft-04";
15288
- if (target2 === "draft-7")
15289
- target2 = "draft-07";
15285
+ let target = (params == null ? void 0 : params.target) ?? "draft-2020-12";
15286
+ if (target === "draft-4")
15287
+ target = "draft-04";
15288
+ if (target === "draft-7")
15289
+ target = "draft-07";
15290
15290
  return {
15291
15291
  processors: params.processors ?? {},
15292
15292
  metadataRegistry: (params == null ? void 0 : params.metadata) ?? globalRegistry,
15293
- target: target2,
15293
+ target,
15294
15294
  unrepresentable: (params == null ? void 0 : params.unrepresentable) ?? "throw",
15295
15295
  override: (params == null ? void 0 : params.override) ?? (() => {
15296
15296
  }),
@@ -15797,8 +15797,8 @@ const createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
15797
15797
  return finalize(ctx, schema);
15798
15798
  };
15799
15799
  const createStandardJSONSchemaMethod = (schema, io2, processors = {}) => (params) => {
15800
- const { libraryOptions, target: target2 } = params ?? {};
15801
- const ctx = initializeContext({ ...libraryOptions ?? {}, target: target2, io: io2, processors });
15800
+ const { libraryOptions, target } = params ?? {};
15801
+ const ctx = initializeContext({ ...libraryOptions ?? {}, target, io: io2, processors });
15802
15802
  processSchema(schema, ctx);
15803
15803
  extractDefs(ctx, schema);
15804
15804
  return finalize(ctx, schema);
@@ -16412,8 +16412,8 @@ const parse$4 = /* @__PURE__ */ _parse(ZodRealError);
16412
16412
  const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
16413
16413
  const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
16414
16414
  const safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError);
16415
- const encode$1 = /* @__PURE__ */ _encode(ZodRealError);
16416
- const decode$2 = /* @__PURE__ */ _decode(ZodRealError);
16415
+ const encode = /* @__PURE__ */ _encode(ZodRealError);
16416
+ const decode$1 = /* @__PURE__ */ _decode(ZodRealError);
16417
16417
  const encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
16418
16418
  const decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError);
16419
16419
  const safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
@@ -16502,8 +16502,8 @@ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
16502
16502
  catch(params) {
16503
16503
  return _catch(this, params);
16504
16504
  },
16505
- pipe(target2) {
16506
- return pipe(this, target2);
16505
+ pipe(target) {
16506
+ return pipe(this, target);
16507
16507
  },
16508
16508
  readonly() {
16509
16509
  return readonly(this);
@@ -16568,10 +16568,10 @@ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
16568
16568
  return validateAsync$1(this, data, params);
16569
16569
  },
16570
16570
  encode: function _encode2(data, params) {
16571
- return encode$1(this, data, params, { callee: _encode2 });
16571
+ return encode(this, data, params, { callee: _encode2 });
16572
16572
  },
16573
16573
  decode: function _decode2(data, params) {
16574
- return decode$2(this, data, params, { callee: _decode2 });
16574
+ return decode$1(this, data, params, { callee: _decode2 });
16575
16575
  },
16576
16576
  encodeAsync: async function _encodeAsync2(data, params) {
16577
16577
  return await encodeAsync(this, data, params, { callee: _encodeAsync2 });
@@ -17484,11 +17484,11 @@ function validateAttributeBatchConstraints(changes, context = {}) {
17484
17484
  throw new AttributeValidationError(`Run attribute count would exceed limit ${ATTRIBUTE_MAX_PER_RUN} (post-merge ${postMergeCount})`);
17485
17485
  }
17486
17486
  }
17487
- const textEncoder$1 = new TextEncoder();
17487
+ const textEncoder = new TextEncoder();
17488
17488
  const AttributeKeySchema = string$2().min(1, { error: "Attribute key must not be empty" }).max(ATTRIBUTE_KEY_MAX_LENGTH, {
17489
17489
  error: `Attribute key exceeds limit ${ATTRIBUTE_KEY_MAX_LENGTH}`
17490
17490
  });
17491
- const AttributeValueSchema = string$2().refine((value) => textEncoder$1.encode(value).length <= ATTRIBUTE_VALUE_MAX_BYTES, {
17491
+ const AttributeValueSchema = string$2().refine((value) => textEncoder.encode(value).length <= ATTRIBUTE_VALUE_MAX_BYTES, {
17492
17492
  error: `Attribute value exceeds limit ${ATTRIBUTE_VALUE_MAX_BYTES} UTF-8 bytes`
17493
17493
  }).nullable();
17494
17494
  const AttributeChangeSchema = object({
@@ -19423,8 +19423,8 @@ const parse_operations = {
19423
19423
  createNullPrototypeObject: () => /* @__PURE__ */ Object.create(null),
19424
19424
  createSet: () => /* @__PURE__ */ new Set(),
19425
19425
  createMap: () => /* @__PURE__ */ new Map(),
19426
- set: (target2, key, value) => {
19427
- target2[key] = value;
19426
+ set: (target, key, value) => {
19427
+ target[key] = value;
19428
19428
  },
19429
19429
  addValue: (set, value) => {
19430
19430
  set.add(value);
@@ -21080,7 +21080,7 @@ class StateContext {
21080
21080
  if (this.sources.has(id))
21081
21081
  return;
21082
21082
  const path2 = [];
21083
- const read2 = /* @__PURE__ */ new Map();
21083
+ const read = /* @__PURE__ */ new Map();
21084
21084
  const idBytes = jsonLength(id);
21085
21085
  const walk = (v2, pathBytes) => {
21086
21086
  if (path2.length > MAX_PATH)
@@ -21095,12 +21095,12 @@ class StateContext {
21095
21095
  if (v2 === null || typeof v2 !== "object")
21096
21096
  return void 0;
21097
21097
  const depth = path2.length;
21098
- let atDepth = read2.get(v2);
21098
+ let atDepth = read.get(v2);
21099
21099
  if (atDepth == null ? void 0 : atDepth.has(depth))
21100
21100
  return atDepth.get(depth);
21101
21101
  if (atDepth === void 0) {
21102
21102
  atDepth = /* @__PURE__ */ new Map();
21103
- read2.set(v2, atDepth);
21103
+ read.set(v2, atDepth);
21104
21104
  }
21105
21105
  let node2;
21106
21106
  const visit2 = (key, child) => {
@@ -21419,8 +21419,8 @@ function decompressSyncIfAvailable(format, payload) {
21419
21419
  const zstd = globalSingleton("@workflow/core//zstd.decoder", 1, () => ({
21420
21420
  decoder: void 0
21421
21421
  }));
21422
- function registerZstdDecoder(decoder2) {
21423
- zstd.decoder = decoder2;
21422
+ function registerZstdDecoder(decoder) {
21423
+ zstd.decoder = decoder;
21424
21424
  }
21425
21425
  async function decompressAsync(format, payload) {
21426
21426
  if (format === SerializationFormat.ZSTD) {
@@ -22105,7 +22105,7 @@ async function hydrateResourceIOAsync(resource, key, extraRevivers) {
22105
22105
  return { hydrateDataWithKey: hydrateDataWithKey3, deriveRunPayloadKeys: deriveRunPayloadKeys3 };
22106
22106
  }, true ? void 0 : void 0);
22107
22107
  const { ensureZstdDecoderRegistered } = await __vitePreload(async () => {
22108
- const { ensureZstdDecoderRegistered: ensureZstdDecoderRegistered2 } = await import("./zstd-browser-decoder-BNeg7hxG.js");
22108
+ const { ensureZstdDecoderRegistered: ensureZstdDecoderRegistered2 } = await import("./zstd-browser-decoder-Z5736ep5.js");
22109
22109
  return { ensureZstdDecoderRegistered: ensureZstdDecoderRegistered2 };
22110
22110
  }, true ? __vite__mapDeps([0,1]) : void 0);
22111
22111
  ensureZstdDecoderRegistered();
@@ -25447,13 +25447,36 @@ function formatTimeDifference(diff) {
25447
25447
  }
25448
25448
  return result.join(", ");
25449
25449
  }
25450
+ function formatTimeAgo(date2, now) {
25451
+ const diff = now - date2;
25452
+ const formattedDiff = formatTimeDifference(diff);
25453
+ if (!formattedDiff)
25454
+ return "Just now";
25455
+ return diff < 0 ? `in ${formattedDiff}` : `${formattedDiff} ago`;
25456
+ }
25457
+ function formatShortTimeAgo(date2, now) {
25458
+ const diff = now - date2;
25459
+ const abs = Math.abs(diff);
25460
+ const days = Math.floor(abs / (1e3 * 60 * 60 * 24));
25461
+ const hours = Math.floor(abs / (1e3 * 60 * 60));
25462
+ const minutes = Math.floor(abs / (1e3 * 60));
25463
+ let value;
25464
+ if (days > 0) {
25465
+ value = `${days} day${days > 1 ? "s" : ""}`;
25466
+ } else if (hours > 0) {
25467
+ value = `${hours} hour${hours > 1 ? "s" : ""}`;
25468
+ } else if (minutes > 0) {
25469
+ value = `${minutes} minute${minutes > 1 ? "s" : ""}`;
25470
+ } else {
25471
+ return diff < 0 ? "In less than a minute" : "Just now";
25472
+ }
25473
+ return diff < 0 ? `In ${value}` : `${value} ago`;
25474
+ }
25450
25475
  function useTimeAgo(date2) {
25451
25476
  const [timeAgo, setTimeAgo] = reactExports.useState("");
25452
25477
  reactExports.useEffect(() => {
25453
25478
  const updateTimeAgo = () => {
25454
- const diff = Date.now() - date2;
25455
- const formattedDiff = formatTimeDifference(diff);
25456
- setTimeAgo(formattedDiff ? `${formattedDiff} ago` : "Just now");
25479
+ setTimeAgo(formatTimeAgo(date2, Date.now()));
25457
25480
  };
25458
25481
  updateTimeAgo();
25459
25482
  const timer = setInterval(updateTimeAgo, 1e3);
@@ -25469,19 +25492,7 @@ function useShortTimeAgo(date2) {
25469
25492
  return;
25470
25493
  }
25471
25494
  const updateShortTimeAgo = () => {
25472
- const diff = Date.now() - date2;
25473
- const days = Math.floor(diff / (1e3 * 60 * 60 * 24));
25474
- const hours = Math.floor(diff / (1e3 * 60 * 60));
25475
- const minutes = Math.floor(diff / (1e3 * 60));
25476
- if (days > 0) {
25477
- setShortTimeAgo(`${days} day${days > 1 ? "s" : ""} ago`);
25478
- } else if (hours > 0) {
25479
- setShortTimeAgo(`${hours} hour${hours > 1 ? "s" : ""} ago`);
25480
- } else if (minutes > 0) {
25481
- setShortTimeAgo(`${minutes} minute${minutes > 1 ? "s" : ""} ago`);
25482
- } else {
25483
- setShortTimeAgo("Just now");
25484
- }
25495
+ setShortTimeAgo(formatShortTimeAgo(date2, Date.now()));
25485
25496
  };
25486
25497
  updateShortTimeAgo();
25487
25498
  const timer = setInterval(updateShortTimeAgo, 6e4);
@@ -27901,8 +27912,8 @@ function element$5(state, node2) {
27901
27912
  node2
27902
27913
  );
27903
27914
  const pos = reference.sourceCodeLocation;
27904
- const startTag2 = pos && pos.startTag && position$4(pos.startTag);
27905
- const endTag2 = pos && pos.endTag && position$4(pos.endTag);
27915
+ const startTag2 = pos && pos.startTag && position$2(pos.startTag);
27916
+ const endTag2 = pos && pos.endTag && position$2(pos.endTag);
27906
27917
  const content2 = (
27907
27918
  /** @type {Root} */
27908
27919
  one$3(state, reference.content)
@@ -27925,7 +27936,7 @@ function patch$3(state, from, to2) {
27925
27936
  }
27926
27937
  }
27927
27938
  function createLocation(state, node2, location2) {
27928
- const result = position$4(location2);
27939
+ const result = position$2(location2);
27929
27940
  if (node2.type === "element") {
27930
27941
  const tail = node2.children[node2.children.length - 1];
27931
27942
  if (result && !location2.endTag && tail && tail.position && tail.position.end) {
@@ -27937,15 +27948,15 @@ function createLocation(state, node2, location2) {
27937
27948
  if (location2.attrs) {
27938
27949
  for (key in location2.attrs) {
27939
27950
  if (own$8.call(location2.attrs, key)) {
27940
- properties2[find$1(state.schema, key).property] = position$4(
27951
+ properties2[find$1(state.schema, key).property] = position$2(
27941
27952
  location2.attrs[key]
27942
27953
  );
27943
27954
  }
27944
27955
  }
27945
27956
  }
27946
27957
  ok(location2.startTag);
27947
- const opening = position$4(location2.startTag);
27948
- const closing = location2.endTag ? position$4(location2.endTag) : void 0;
27958
+ const opening = position$2(location2.startTag);
27959
+ const closing = location2.endTag ? position$2(location2.endTag) : void 0;
27949
27960
  const data = { opening };
27950
27961
  if (closing) data.closing = closing;
27951
27962
  data.properties = properties2;
@@ -27954,7 +27965,7 @@ function createLocation(state, node2, location2) {
27954
27965
  }
27955
27966
  return result;
27956
27967
  }
27957
- function position$4(loc) {
27968
+ function position$2(loc) {
27958
27969
  const start = point$3({
27959
27970
  line: loc.startLine,
27960
27971
  column: loc.startCol,
@@ -35289,8 +35300,8 @@ function appendCommentToDocument(p2, token) {
35289
35300
  function stopParsing(p2, token) {
35290
35301
  p2.stopped = true;
35291
35302
  if (token.location) {
35292
- const target2 = p2.fragmentContext ? 0 : 2;
35293
- for (let i = p2.openElements.stackTop; i >= target2; i--) {
35303
+ const target = p2.fragmentContext ? 0 : 2;
35304
+ for (let i = p2.openElements.stackTop; i >= target; i--) {
35294
35305
  p2._setEndLocation(p2.openElements.items[i], token);
35295
35306
  }
35296
35307
  if (!p2.fragmentContext && p2.openElements.stackTop >= 0) {
@@ -37119,7 +37130,7 @@ function point$2(type) {
37119
37130
  }
37120
37131
  }
37121
37132
  }
37122
- function position$3(node2) {
37133
+ function position$1(node2) {
37123
37134
  const start = pointStart(node2);
37124
37135
  const end = pointEnd(node2);
37125
37136
  if (start && end) {
@@ -37845,7 +37856,7 @@ function safeProtocol(state, key, value) {
37845
37856
  return false;
37846
37857
  }
37847
37858
  function patch$1(node2, unsafe) {
37848
- const cleanPosition = position$3(
37859
+ const cleanPosition = position$1(
37849
37860
  // @ts-expect-error: looks like a node.
37850
37861
  unsafe
37851
37862
  );
@@ -39395,9 +39406,9 @@ function decodeNumericCharacterReference(value, base) {
39395
39406
  }
39396
39407
  const characterEscapeOrReference = /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;
39397
39408
  function decodeString(value) {
39398
- return value.replace(characterEscapeOrReference, decode$1);
39409
+ return value.replace(characterEscapeOrReference, decode);
39399
39410
  }
39400
- function decode$1($0, $1, $2) {
39411
+ function decode($0, $1, $2) {
39401
39412
  if ($1) {
39402
39413
  return $1;
39403
39414
  }
@@ -39683,11 +39694,11 @@ function push(list2, items) {
39683
39694
  return items;
39684
39695
  }
39685
39696
  const hasOwnProperty = {}.hasOwnProperty;
39686
- function combineExtensions(extensions2) {
39697
+ function combineExtensions(extensions) {
39687
39698
  const all2 = {};
39688
39699
  let index2 = -1;
39689
- while (++index2 < extensions2.length) {
39690
- syntaxExtension(all2, extensions2[index2]);
39700
+ while (++index2 < extensions.length) {
39701
+ syntaxExtension(all2, extensions[index2]);
39691
39702
  }
39692
39703
  return all2;
39693
39704
  }
@@ -47984,10 +47995,10 @@ function stringifyPosition(value) {
47984
47995
  return "";
47985
47996
  }
47986
47997
  if ("position" in value || "type" in value) {
47987
- return position$2(value.position);
47998
+ return position(value.position);
47988
47999
  }
47989
48000
  if ("start" in value || "end" in value) {
47990
- return position$2(value);
48001
+ return position(value);
47991
48002
  }
47992
48003
  if ("line" in value || "column" in value) {
47993
48004
  return point$1(value);
@@ -47997,7 +48008,7 @@ function stringifyPosition(value) {
47997
48008
  function point$1(point2) {
47998
48009
  return index(point2 && point2.line) + ":" + index(point2 && point2.column);
47999
48010
  }
48000
- function position$2(pos) {
48011
+ function position(pos) {
48001
48012
  return point$1(pos && pos.start) + "-" + point$1(pos && pos.end);
48002
48013
  }
48003
48014
  function index(value) {
@@ -50079,10 +50090,10 @@ function point(d2) {
50079
50090
  offset: d2.offset
50080
50091
  };
50081
50092
  }
50082
- function configure(combined, extensions2) {
50093
+ function configure(combined, extensions) {
50083
50094
  let index2 = -1;
50084
- while (++index2 < extensions2.length) {
50085
- const value = extensions2[index2];
50095
+ while (++index2 < extensions.length) {
50096
+ const value = extensions[index2];
50086
50097
  if (Array.isArray(value)) {
50087
50098
  configure(combined, value);
50088
50099
  } else {
@@ -50822,7 +50833,7 @@ function createState(tree, options) {
50822
50833
  }
50823
50834
  }
50824
50835
  function patch(from, to2) {
50825
- if (from.position) to2.position = position$3(from);
50836
+ if (from.position) to2.position = position$1(from);
50826
50837
  }
50827
50838
  function applyData(from, to2) {
50828
50839
  let result = to2;
@@ -50943,16 +50954,16 @@ function requireExtend() {
50943
50954
  }
50944
50955
  return typeof key === "undefined" || hasOwn.call(obj, key);
50945
50956
  };
50946
- var setProperty = function setProperty2(target2, options) {
50957
+ var setProperty = function setProperty2(target, options) {
50947
50958
  if (defineProperty && options.name === "__proto__") {
50948
- defineProperty(target2, options.name, {
50959
+ defineProperty(target, options.name, {
50949
50960
  enumerable: true,
50950
50961
  configurable: true,
50951
50962
  value: options.newValue,
50952
50963
  writable: true
50953
50964
  });
50954
50965
  } else {
50955
- target2[options.name] = options.newValue;
50966
+ target[options.name] = options.newValue;
50956
50967
  }
50957
50968
  };
50958
50969
  var getProperty = function getProperty2(obj, name2) {
@@ -50966,42 +50977,42 @@ function requireExtend() {
50966
50977
  return obj[name2];
50967
50978
  };
50968
50979
  extend$1 = function extend2() {
50969
- var options, name2, src2, copy, copyIsArray, clone2;
50970
- var target2 = arguments[0];
50980
+ var options, name2, src, copy, copyIsArray, clone2;
50981
+ var target = arguments[0];
50971
50982
  var i = 1;
50972
50983
  var length = arguments.length;
50973
50984
  var deep = false;
50974
- if (typeof target2 === "boolean") {
50975
- deep = target2;
50976
- target2 = arguments[1] || {};
50985
+ if (typeof target === "boolean") {
50986
+ deep = target;
50987
+ target = arguments[1] || {};
50977
50988
  i = 2;
50978
50989
  }
50979
- if (target2 == null || typeof target2 !== "object" && typeof target2 !== "function") {
50980
- target2 = {};
50990
+ if (target == null || typeof target !== "object" && typeof target !== "function") {
50991
+ target = {};
50981
50992
  }
50982
50993
  for (; i < length; ++i) {
50983
50994
  options = arguments[i];
50984
50995
  if (options != null) {
50985
50996
  for (name2 in options) {
50986
- src2 = getProperty(target2, name2);
50997
+ src = getProperty(target, name2);
50987
50998
  copy = getProperty(options, name2);
50988
- if (target2 !== copy) {
50999
+ if (target !== copy) {
50989
51000
  if (deep && copy && (isPlainObject2(copy) || (copyIsArray = isArray(copy)))) {
50990
51001
  if (copyIsArray) {
50991
51002
  copyIsArray = false;
50992
- clone2 = src2 && isArray(src2) ? src2 : [];
51003
+ clone2 = src && isArray(src) ? src : [];
50993
51004
  } else {
50994
- clone2 = src2 && isPlainObject2(src2) ? src2 : {};
51005
+ clone2 = src && isPlainObject2(src) ? src : {};
50995
51006
  }
50996
- setProperty(target2, { name: name2, newValue: extend2(deep, clone2, copy) });
51007
+ setProperty(target, { name: name2, newValue: extend2(deep, clone2, copy) });
50997
51008
  } else if (typeof copy !== "undefined") {
50998
- setProperty(target2, { name: name2, newValue: copy });
51009
+ setProperty(target, { name: name2, newValue: copy });
50999
51010
  }
51000
51011
  }
51001
51012
  }
51002
51013
  }
51003
51014
  }
51004
- return target2;
51015
+ return target;
51005
51016
  };
51006
51017
  return extend$1;
51007
51018
  }
@@ -51786,8 +51797,8 @@ class VFile {
51786
51797
  if (typeof this.value === "string") {
51787
51798
  return this.value;
51788
51799
  }
51789
- const decoder2 = new TextDecoder(encoding || void 0);
51790
- return decoder2.decode(this.value);
51800
+ const decoder = new TextDecoder(encoding || void 0);
51801
+ return decoder.decode(this.value);
51791
51802
  }
51792
51803
  }
51793
51804
  function assertPart(part, name2) {
@@ -54070,7 +54081,7 @@ var Ts = (e) => {
54070
54081
  for (; t > 0 && e[t - 1] === `
54071
54082
  `; ) t--;
54072
54083
  return e.slice(0, t);
54073
- }, Ps = reactExports.lazy(() => __vitePreload(() => import("./highlighted-body-JLMTFACH-CWHg5f-6.js"), true ? __vite__mapDeps([2,1]) : void 0).then((e) => ({ default: e.HighlightedCodeBlockBody }))), At = ({ code: e, language: t, className: n, children: o, isIncomplete: r2 = false, startLine: s2, lineNumbers: a2, ...i }) => {
54084
+ }, Ps = reactExports.lazy(() => __vitePreload(() => import("./highlighted-body-JLMTFACH-1yzOVKg0.js"), true ? __vite__mapDeps([2,1]) : void 0).then((e) => ({ default: e.HighlightedCodeBlockBody }))), At = ({ code: e, language: t, className: n, children: o, isIncomplete: r2 = false, startLine: s2, lineNumbers: a2, ...i }) => {
54074
54085
  let l = w(), { codeBlockMaxHeight: c2 } = reactExports.useContext(R), d2 = reactExports.useMemo(() => Ts(e), [e]), p2 = reactExports.useMemo(() => ({ bg: "transparent", fg: "inherit", tokens: d2.split(`
54075
54086
  `).map((b2) => [{ content: b2, color: "inherit", bgColor: "transparent", htmlStyle: {}, offset: 0 }]) }), [d2]);
54076
54087
  return jsxRuntimeExports.jsx(Lt.Provider, { value: { code: e }, children: jsxRuntimeExports.jsxs(It, { dir: "ltr", isIncomplete: r2, language: t, children: [jsxRuntimeExports.jsx(Dt, { language: t }), o ? jsxRuntimeExports.jsx("div", { className: l("pointer-events-none absolute top-2 right-2 z-10 flex items-center"), children: jsxRuntimeExports.jsx("div", { className: l("pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur"), "data-streamdown": "code-block-actions", children: o }) }) : null, jsxRuntimeExports.jsx(reactExports.Suspense, { fallback: jsxRuntimeExports.jsx(In, { className: n, language: t, lineNumbers: a2, maxHeight: c2, result: p2, startLine: s2, ...i }), children: jsxRuntimeExports.jsx(Ps, { className: n, code: d2, isIncomplete: r2, language: t, lineNumbers: a2, maxHeight: c2, raw: p2, startLine: s2, ...i }) })] }) });
@@ -55800,16 +55811,16 @@ const Minimap = reactExports.memo(function Minimap2({ spans, root: root2, viewpo
55800
55811
  cw: rect.width - TIMELINE_PADDING_PX * 2
55801
55812
  };
55802
55813
  }, []);
55803
- const resolveDragState = reactExports.useCallback((target2, x2, cw) => {
55804
- if (target2.closest('[data-minimap-handle="left"]')) {
55814
+ const resolveDragState = reactExports.useCallback((target, x2, cw) => {
55815
+ if (target.closest('[data-minimap-handle="left"]')) {
55805
55816
  return { mode: "resize-left" };
55806
55817
  }
55807
- if (target2.closest('[data-minimap-handle="right"]')) {
55818
+ if (target.closest('[data-minimap-handle="right"]')) {
55808
55819
  return { mode: "resize-right" };
55809
55820
  }
55810
55821
  const { start, end } = viewportRef.current;
55811
55822
  const isFullExtent = start - rootStartMs < rootDurationMs * 1e-3 && rootEndMs - end < rootDurationMs * 1e-3;
55812
- if (target2.closest("[data-minimap-brush]") && !isFullExtent) {
55823
+ if (target.closest("[data-minimap-brush]") && !isFullExtent) {
55813
55824
  return { mode: "pan", grabOffsetMs: xToTime(x2, cw) - start };
55814
55825
  }
55815
55826
  return { mode: "select", originX: x2, originMs: xToTime(x2, cw) };
@@ -55955,2611 +55966,136 @@ const Minimap = reactExports.memo(function Minimap2({ spans, root: root2, viewpo
55955
55966
  (drag == null ? void 0 : drag.mode) === "pan" ? "cursor-grabbing" : "cursor-grab"
55956
55967
  ), style: brushStyle, children: [jsxRuntimeExports.jsx("div", { "data-minimap-handle": "left", className: "absolute inset-y-0 -left-1 flex w-2.5 cursor-ew-resize items-center justify-center", children: jsxRuntimeExports.jsx("span", { className: cn$2("h-3.5 w-[3px] rounded-full bg-gray-600 opacity-0 transition-opacity group-hover/minimap-brush:opacity-100 group-focus-visible/minimap-brush:opacity-100", drag && "opacity-100") }) }), jsxRuntimeExports.jsx("div", { "data-minimap-handle": "right", className: "absolute inset-y-0 -right-1 flex w-2.5 cursor-ew-resize items-center justify-center", children: jsxRuntimeExports.jsx("span", { className: cn$2("h-3.5 w-[3px] rounded-full bg-gray-600 opacity-0 transition-opacity group-hover/minimap-brush:opacity-100 group-focus-visible/minimap-brush:opacity-100", drag && "opacity-100") }) })] })] });
55957
55968
  });
55958
- const ServerConfigContext = reactExports.createContext(
55959
- null
55960
- );
55961
- function ServerConfigProvider({
55962
- children: children2,
55963
- serverConfig
55964
- }) {
55965
- const value = {
55966
- serverConfig
55967
- };
55968
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ServerConfigContext.Provider, { value, children: children2 });
55969
- }
55970
- function useServerConfig() {
55971
- const context = reactExports.useContext(ServerConfigContext);
55972
- if (!context) {
55973
- throw new Error(
55974
- "useServerConfig must be used within a ServerConfigProvider"
55975
- );
55976
- }
55977
- return context;
55978
- }
55979
- let decoder;
55980
- try {
55981
- decoder = new TextDecoder();
55982
- } catch (error2) {
55983
- }
55984
- let src;
55985
- let srcEnd;
55986
- let position$1 = 0;
55987
- const LEGACY_RECORD_INLINE_ID = 105;
55988
- const RECORD_DEFINITIONS_ID = 57342;
55989
- const RECORD_INLINE_ID = 57343;
55990
- const BUNDLED_STRINGS_ID = 57337;
55991
- const PACKED_REFERENCE_TAG_ID = 6;
55992
- let maxArraySize = 11281e4;
55993
- let maxMapSize = 1681e4;
55994
- let maxObjectSize = 1671e4;
55995
- let objectSizeLimit = maxObjectSize;
55996
- let currentDecoder = {};
55997
- let currentStructures;
55998
- let srcString;
55999
- let srcStringStart = 0;
56000
- let srcStringEnd = 0;
56001
- let bundledStrings$1;
56002
- let referenceMap;
56003
- let currentExtensions = [];
56004
- let currentExtensionRanges = [];
56005
- let packedValues;
56006
- let dataView;
56007
- let restoreMapsAsObject;
56008
- let defaultOptions = {
56009
- useRecords: false,
56010
- mapsAsObjects: true
56011
- };
56012
- let sequentialMode = false;
56013
- let inlineObjectReadThreshold = 2;
56014
- try {
56015
- new Function("");
56016
- } catch (error2) {
56017
- inlineObjectReadThreshold = Infinity;
56018
- }
56019
- class Decoder {
56020
- constructor(options) {
56021
- if (options) {
56022
- if ((options.keyMap || options._keyMap) && !options.useRecords) {
56023
- options.useRecords = false;
56024
- options.mapsAsObjects = true;
56025
- }
56026
- if (options.useRecords === false && options.mapsAsObjects === void 0)
56027
- options.mapsAsObjects = true;
56028
- if (options.getStructures)
56029
- options.getShared = options.getStructures;
56030
- if (options.getShared && !options.structures)
56031
- (options.structures = []).uninitialized = true;
56032
- if (options.keyMap) {
56033
- this.mapKey = /* @__PURE__ */ new Map();
56034
- for (let [k2, v2] of Object.entries(options.keyMap)) this.mapKey.set(v2, k2);
56035
- }
56036
- }
56037
- Object.assign(this, options);
56038
- }
56039
- /*
56040
- decodeKey(key) {
56041
- return this.keyMap
56042
- ? Object.keys(this.keyMap)[Object.values(this.keyMap).indexOf(key)] || key
56043
- : key
56044
- }
56045
- */
56046
- decodeKey(key) {
56047
- return this.keyMap ? this.mapKey.get(key) || key : key;
56048
- }
56049
- encodeKey(key) {
56050
- return this.keyMap && this.keyMap.hasOwnProperty(key) ? this.keyMap[key] : key;
56051
- }
56052
- encodeKeys(rec) {
56053
- if (!this._keyMap) return rec;
56054
- let map2 = /* @__PURE__ */ new Map();
56055
- for (let [k2, v2] of Object.entries(rec)) map2.set(this._keyMap.hasOwnProperty(k2) ? this._keyMap[k2] : k2, v2);
56056
- return map2;
56057
- }
56058
- decodeKeys(map2) {
56059
- if (!this._keyMap || map2.constructor.name != "Map") return map2;
56060
- if (!this._mapKey) {
56061
- this._mapKey = /* @__PURE__ */ new Map();
56062
- for (let [k2, v2] of Object.entries(this._keyMap)) this._mapKey.set(v2, k2);
56063
- }
56064
- let res = {};
56065
- map2.forEach((v2, k2) => res[safeKey(this._mapKey.has(k2) ? this._mapKey.get(k2) : k2)] = v2);
56066
- return res;
56067
- }
56068
- mapDecode(source, end) {
56069
- let res = this.decode(source);
56070
- if (this._keyMap) {
56071
- switch (res.constructor.name) {
56072
- case "Array":
56073
- return res.map((r2) => this.decodeKeys(r2));
56074
- }
56075
- }
56076
- return res;
56077
- }
56078
- decode(source, end) {
56079
- if (src) {
56080
- return saveState(() => {
56081
- clearSource();
56082
- return this ? this.decode(source, end) : Decoder.prototype.decode.call(defaultOptions, source, end);
56083
- });
56084
- }
56085
- srcEnd = end > -1 && end < source.length ? end : source.length;
56086
- position$1 = 0;
56087
- srcStringEnd = 0;
56088
- srcString = null;
56089
- bundledStrings$1 = null;
56090
- src = source;
56091
- try {
56092
- dataView = source.dataView || (source.dataView = new DataView(source.buffer, source.byteOffset, source.byteLength));
56093
- } catch (error2) {
56094
- src = null;
56095
- if (source instanceof Uint8Array)
56096
- throw error2;
56097
- throw new Error("Source must be a Uint8Array or Buffer but was a " + (source && typeof source == "object" ? source.constructor.name : typeof source));
56098
- }
56099
- if (this instanceof Decoder) {
56100
- currentDecoder = this;
56101
- packedValues = this.sharedValues && (this.pack ? new Array(this.maxPrivatePackedValues || 16).concat(this.sharedValues) : this.sharedValues);
56102
- if (this.structures) {
56103
- currentStructures = this.structures;
56104
- return checkedRead();
56105
- } else if (!currentStructures || currentStructures.length > 0) {
56106
- currentStructures = [];
56107
- }
56108
- } else {
56109
- currentDecoder = defaultOptions;
56110
- if (!currentStructures || currentStructures.length > 0)
56111
- currentStructures = [];
56112
- packedValues = null;
56113
- }
56114
- return checkedRead();
56115
- }
56116
- decodeMultiple(source, forEach) {
56117
- if (src) {
56118
- return saveState(() => {
56119
- clearSource();
56120
- return this ? this.decodeMultiple(source, forEach) : defaultDecoder.decodeMultiple(source, forEach);
56121
- });
56122
- }
56123
- let values, lastPosition = 0;
56124
- try {
56125
- let size2 = source.length;
56126
- sequentialMode = true;
56127
- let value = this ? this.decode(source, size2) : defaultDecoder.decode(source, size2);
56128
- if (forEach) {
56129
- let end = position$1;
56130
- if (forEach(value) === false) {
56131
- return;
56132
- }
56133
- while (end < size2) {
56134
- lastPosition = end;
56135
- value = checkedRead();
56136
- end = position$1;
56137
- if (forEach(value) === false) {
56138
- return;
56139
- }
56140
- }
56141
- } else {
56142
- values = [value];
56143
- while (position$1 < size2) {
56144
- lastPosition = position$1;
56145
- values.push(checkedRead());
56146
- }
56147
- return values;
56148
- }
56149
- } catch (error2) {
56150
- if (error2 && (typeof error2 == "object" || typeof error2 == "function")) {
56151
- error2.lastPosition = lastPosition;
56152
- error2.values = values;
56153
- }
56154
- throw error2;
56155
- } finally {
56156
- sequentialMode = false;
56157
- clearSource();
56158
- }
56159
- }
56160
- }
56161
- const nestedDecodeErrors = /* @__PURE__ */ new WeakSet();
56162
- let arrayAllocationBudget;
56163
- function checkedRead() {
56164
- try {
56165
- arrayAllocationBudget = srcEnd - position$1;
56166
- let result = read();
56167
- if (bundledStrings$1) {
56168
- if (position$1 >= bundledStrings$1.postBundlePosition)
56169
- throw new Error("Unexpected bundle position");
56170
- position$1 = bundledStrings$1.postBundlePosition;
56171
- bundledStrings$1 = null;
56172
- }
56173
- if (position$1 == srcEnd) {
56174
- currentStructures = null;
56175
- src = null;
56176
- if (referenceMap)
56177
- referenceMap = null;
56178
- } else if (position$1 > srcEnd) {
56179
- let error2 = new Error("Unexpected end of CBOR data");
56180
- error2.incomplete = true;
56181
- throw error2;
56182
- } else if (!sequentialMode) {
56183
- throw new Error("Data read, but end of buffer not reached");
56184
- }
56185
- return result;
56186
- } catch (error2) {
56187
- clearSource();
56188
- if (nestedDecodeErrors.has(error2)) {
56189
- if (error2.incomplete)
56190
- error2.incomplete = false;
56191
- } else if (error2 instanceof RangeError && position$1 + 8 > srcEnd || error2 && typeof error2.message == "string" && error2.message.startsWith("Unexpected end of buffer")) {
56192
- error2.incomplete = true;
56193
- }
56194
- throw error2;
56195
- }
56196
- }
56197
- function readBreak() {
56198
- if (position$1 < srcEnd && src[position$1] === 255) {
56199
- position$1++;
56200
- return true;
56201
- }
56202
- return false;
56203
- }
56204
- function endOfCBORError(neededEnd) {
56205
- let error2 = new Error("Unexpected end of CBOR data");
56206
- error2.incomplete = true;
56207
- if (neededEnd)
56208
- error2.neededEnd = neededEnd;
56209
- return error2;
56210
- }
56211
- function read() {
56212
- if (!(position$1 < srcEnd)) throw endOfCBORError();
56213
- let token = src[position$1++];
56214
- let majorType = token >> 5;
56215
- token = token & 31;
56216
- if (token > 23) {
56217
- switch (token) {
56218
- case 24:
56219
- if (position$1 >= srcEnd) throw endOfCBORError();
56220
- token = src[position$1++];
56221
- break;
56222
- case 25:
56223
- if (majorType == 7) {
56224
- return getFloat16();
56225
- }
56226
- token = dataView.getUint16(position$1);
56227
- position$1 += 2;
56228
- break;
56229
- case 26:
56230
- if (majorType == 7) {
56231
- let value = dataView.getFloat32(position$1);
56232
- if (currentDecoder.useFloat32 > 2) {
56233
- let multiplier = mult10[(src[position$1] & 127) << 1 | src[position$1 + 1] >> 7];
56234
- position$1 += 4;
56235
- return (multiplier * value + (value > 0 ? 0.5 : -0.5) >> 0) / multiplier;
56236
- }
56237
- position$1 += 4;
56238
- return value;
56239
- }
56240
- token = dataView.getUint32(position$1);
56241
- position$1 += 4;
56242
- if (majorType === 1) return -1 - token;
56243
- break;
56244
- case 27:
56245
- if (majorType == 7) {
56246
- let value = dataView.getFloat64(position$1);
56247
- position$1 += 8;
56248
- return value;
56249
- }
56250
- if (majorType > 1) {
56251
- if (dataView.getUint32(position$1) > 0)
56252
- throw new Error("JavaScript does not support arrays, maps, or strings with length over 4294967295");
56253
- token = dataView.getUint32(position$1 + 4);
56254
- } else if (currentDecoder.int64AsNumber) {
56255
- token = dataView.getUint32(position$1) * 4294967296;
56256
- token += dataView.getUint32(position$1 + 4);
56257
- position$1 += 8;
56258
- if (majorType === 1) return -1 - token;
56259
- break;
56260
- } else token = dataView.getBigUint64(position$1);
56261
- position$1 += 8;
56262
- break;
56263
- case 31:
56264
- switch (majorType) {
56265
- case 2:
56266
- // byte string
56267
- case 3:
56268
- throw new Error("Indefinite length not supported for byte or text strings");
56269
- case 4:
56270
- let array2 = [];
56271
- let i = 0;
56272
- while (!readBreak()) {
56273
- if (i >= maxArraySize) throw new Error(`Array length exceeds ${maxArraySize}`);
56274
- array2[i++] = read();
56275
- }
56276
- return majorType == 4 ? array2 : majorType == 3 ? array2.join("") : Buffer.concat(array2);
56277
- case 5:
56278
- let key;
56279
- if (currentDecoder.mapsAsObjects) {
56280
- let object2 = {};
56281
- let i2 = 0;
56282
- if (currentDecoder.keyMap) {
56283
- while (!readBreak()) {
56284
- key = read();
56285
- if (i2++ >= objectSizeLimit) throw new Error(`Property count exceeds ${objectSizeLimit}`);
56286
- object2[safeKey(currentDecoder.decodeKey(key))] = read();
56287
- }
56288
- } else {
56289
- while (!readBreak()) {
56290
- key = read();
56291
- if (i2++ >= objectSizeLimit) throw new Error(`Property count exceeds ${objectSizeLimit}`);
56292
- object2[safeKey(key)] = read();
56293
- }
56294
- }
56295
- return object2;
56296
- } else {
56297
- if (restoreMapsAsObject) {
56298
- currentDecoder.mapsAsObjects = true;
56299
- restoreMapsAsObject = false;
56300
- }
56301
- let map2 = /* @__PURE__ */ new Map();
56302
- if (currentDecoder.keyMap) {
56303
- let i2 = 0;
56304
- while (!readBreak()) {
56305
- key = read();
56306
- if (i2++ >= maxMapSize) {
56307
- throw new Error(`Map size exceeds ${maxMapSize}`);
56308
- }
56309
- map2.set(currentDecoder.decodeKey(key), read());
56310
- }
56311
- } else {
56312
- let i2 = 0;
56313
- while (!readBreak()) {
56314
- key = read();
56315
- if (i2++ >= maxMapSize) {
56316
- throw new Error(`Map size exceeds ${maxMapSize}`);
56317
- }
56318
- map2.set(key, read());
56319
- }
56320
- }
56321
- return map2;
56322
- }
56323
- case 7:
56324
- throw new Error("Unexpected break stop code outside of an indefinite-length item");
56325
- default:
56326
- throw new Error("Invalid major type for indefinite length " + majorType);
56327
- }
56328
- default:
56329
- throw new Error("Unknown token " + token);
56330
- }
56331
- }
56332
- switch (majorType) {
56333
- case 0:
56334
- return token;
56335
- case 1:
56336
- return ~token;
56337
- case 2:
56338
- if (token > srcEnd - position$1) throw endOfCBORError(position$1 + token);
56339
- return readBin(token);
56340
- case 3:
56341
- if (srcStringEnd >= position$1) {
56342
- return srcString.slice(position$1 - srcStringStart, (position$1 += token) - srcStringStart);
56343
- }
56344
- if (token > srcEnd - position$1) throw endOfCBORError(position$1 + token);
56345
- if (srcStringEnd == 0 && srcEnd < 140 && token < 32) {
56346
- let string2 = token < 16 ? shortStringInJS(token) : longStringInJS(token);
56347
- if (string2 != null)
56348
- return string2;
56349
- }
56350
- return readFixedString(token);
56351
- case 4:
56352
- if (token > maxArraySize) throw new Error(`Array length exceeds ${maxArraySize}`);
56353
- if (token > srcEnd - position$1 || (arrayAllocationBudget -= token) < 0) throw endOfCBORError(position$1 + token);
56354
- let array2 = new Array(token);
56355
- for (let i = 0; i < token; i++) array2[i] = read();
56356
- return array2;
56357
- case 5:
56358
- if (currentDecoder.mapsAsObjects) {
56359
- if (token > objectSizeLimit) throw new Error(`Property count exceeds ${objectSizeLimit}`);
56360
- if (token > (srcEnd - position$1) / 2) throw endOfCBORError(position$1 + 2 * token);
56361
- let object2 = {};
56362
- if (currentDecoder.keyMap) for (let i = 0; i < token; i++) object2[safeKey(currentDecoder.decodeKey(read()))] = read();
56363
- else for (let i = 0; i < token; i++) object2[safeKey(read())] = read();
56364
- return object2;
56365
- } else {
56366
- if (restoreMapsAsObject) {
56367
- currentDecoder.mapsAsObjects = true;
56368
- restoreMapsAsObject = false;
56369
- }
56370
- if (token > maxMapSize) throw new Error(`Map size exceeds ${maxMapSize}`);
56371
- if (token > (srcEnd - position$1) / 2) throw endOfCBORError(position$1 + 2 * token);
56372
- let map2 = /* @__PURE__ */ new Map();
56373
- if (currentDecoder.keyMap) for (let i = 0; i < token; i++) map2.set(currentDecoder.decodeKey(read()), read());
56374
- else for (let i = 0; i < token; i++) map2.set(read(), read());
56375
- return map2;
56376
- }
56377
- case 6:
56378
- if (token >= BUNDLED_STRINGS_ID) {
56379
- let structure = currentStructures[token & 8191];
56380
- if (structure) {
56381
- if (!structure.read) structure.read = createStructureReader(structure);
56382
- return structure.read();
56383
- }
56384
- if (token < 65536) {
56385
- if (token == RECORD_INLINE_ID) {
56386
- let length = readJustLength();
56387
- let id = read();
56388
- let structure2 = read();
56389
- recordDefinition(id, structure2);
56390
- let object2 = {};
56391
- if (currentDecoder.keyMap) for (let i = 2; i < length; i++) {
56392
- let key = currentDecoder.decodeKey(structure2[i - 2]);
56393
- object2[safeKey(key)] = read();
56394
- }
56395
- else for (let i = 2; i < length; i++) {
56396
- let key = structure2[i - 2];
56397
- object2[safeKey(key)] = read();
56398
- }
56399
- return object2;
56400
- } else if (token == RECORD_DEFINITIONS_ID) {
56401
- let length = readJustLength();
56402
- let id = read();
56403
- for (let i = 2; i < length; i++) {
56404
- recordDefinition(id++, read());
56405
- }
56406
- return read();
56407
- } else if (token == BUNDLED_STRINGS_ID) {
56408
- return readBundleExt();
56409
- }
56410
- if (currentDecoder.getShared) {
56411
- loadShared();
56412
- structure = currentStructures[token & 8191];
56413
- if (structure) {
56414
- if (!structure.read)
56415
- structure.read = createStructureReader(structure);
56416
- return structure.read();
56417
- }
56418
- }
56419
- }
56420
- }
56421
- let extension2 = currentExtensions[token];
56422
- if (extension2) {
56423
- if (extension2.handlesRead)
56424
- return extension2(read);
56425
- else
56426
- return extension2(read());
56427
- } else {
56428
- let input = read();
56429
- for (let i = 0; i < currentExtensionRanges.length; i++) {
56430
- let value = currentExtensionRanges[i](token, input);
56431
- if (value !== void 0)
56432
- return value;
56433
- }
56434
- return new Tag(input, token);
56435
- }
56436
- case 7:
56437
- switch (token) {
56438
- case 20:
56439
- return false;
56440
- case 21:
56441
- return true;
56442
- case 22:
56443
- return null;
56444
- case 23:
56445
- return;
56446
- // undefined
56447
- case 31:
56448
- default:
56449
- let packedValue = (packedValues || getPackedValues())[token];
56450
- if (packedValue !== void 0)
56451
- return packedValue;
56452
- throw new Error("Unknown token " + token);
56453
- }
56454
- default:
56455
- if (isNaN(token)) throw endOfCBORError();
56456
- throw new Error("Unknown CBOR token " + token);
56457
- }
56458
- }
56459
- const validName = /^[a-zA-Z_$][a-zA-Z\d_$]*$/;
56460
- function createStructureReader(structure) {
56461
- if (!structure) throw new Error("Structure is required in record definition");
56462
- function readObject() {
56463
- let length = src[position$1++];
56464
- length = length & 31;
56465
- if (length > 23) {
56466
- switch (length) {
56467
- case 24:
56468
- length = src[position$1++];
56469
- break;
56470
- case 25:
56471
- length = dataView.getUint16(position$1);
56472
- position$1 += 2;
56473
- break;
56474
- case 26:
56475
- length = dataView.getUint32(position$1);
56476
- position$1 += 4;
56477
- break;
56478
- default:
56479
- throw new Error("Expected array header, but got " + src[position$1 - 1]);
56480
- }
56481
- }
56482
- let compiledReader = this.compiledReader;
56483
- while (compiledReader) {
56484
- if (compiledReader.propertyCount === length)
56485
- return compiledReader(read);
56486
- compiledReader = compiledReader.next;
56487
- }
56488
- if (this.slowReads++ >= inlineObjectReadThreshold) {
56489
- let array2 = this.length == length ? this : this.slice(0, length);
56490
- compiledReader = currentDecoder.keyMap ? new Function("r", "return {" + array2.map((k2) => currentDecoder.decodeKey(k2)).map((k2) => validName.test(k2) ? safeKey(k2) + ":r()" : "[" + JSON.stringify(k2) + "]:r()").join(",") + "}") : new Function("r", "return {" + array2.map((key) => validName.test(key) ? safeKey(key) + ":r()" : "[" + JSON.stringify(key) + "]:r()").join(",") + "}");
56491
- if (this.compiledReader)
56492
- compiledReader.next = this.compiledReader;
56493
- compiledReader.propertyCount = length;
56494
- this.compiledReader = compiledReader;
56495
- return compiledReader(read);
56496
- }
56497
- let object2 = {};
56498
- if (currentDecoder.keyMap) for (let i = 0; i < length; i++) object2[safeKey(currentDecoder.decodeKey(this[i]))] = read();
56499
- else for (let i = 0; i < length; i++) {
56500
- object2[safeKey(this[i])] = read();
56501
- }
56502
- return object2;
56503
- }
56504
- structure.slowReads = 0;
56505
- return readObject;
56506
- }
56507
- function safeKey(key) {
56508
- if (typeof key === "string") return key === "__proto__" ? "__proto_" : key;
56509
- if (typeof key === "number" || typeof key === "boolean" || typeof key === "bigint") return key.toString();
56510
- if (key == null) return key + "";
56511
- throw new Error("Invalid property name type " + typeof key);
56512
- }
56513
- let readFixedString = readStringJS;
56514
- function readStringJS(length) {
56515
- let result;
56516
- if (length < 16) {
56517
- if (result = shortStringInJS(length))
56518
- return result;
56519
- }
56520
- if (length > 64 && decoder)
56521
- return decoder.decode(src.subarray(position$1, position$1 += length));
56522
- const end = position$1 + length;
56523
- const units = [];
56524
- result = "";
56525
- while (position$1 < end) {
56526
- const byte1 = src[position$1++];
56527
- if ((byte1 & 128) === 0) {
56528
- units.push(byte1);
56529
- } else if ((byte1 & 224) === 192) {
56530
- if (byte1 < 194 || position$1 >= end || (src[position$1] & 192) !== 128) {
56531
- units.push(65533);
56532
- } else {
56533
- const byte2 = src[position$1++] & 63;
56534
- units.push((byte1 & 31) << 6 | byte2);
56535
- }
56536
- } else if ((byte1 & 240) === 224) {
56537
- const byte2 = position$1 < end ? src[position$1] : 0;
56538
- if (position$1 >= end || (byte2 & 192) !== 128 || byte1 === 224 && byte2 < 160 || byte1 === 237 && byte2 >= 160) {
56539
- units.push(65533);
56540
- } else {
56541
- position$1++;
56542
- if (position$1 >= end || (src[position$1] & 192) !== 128) {
56543
- units.push(65533);
56544
- } else {
56545
- const byte3 = src[position$1++] & 63;
56546
- units.push((byte1 & 31) << 12 | (byte2 & 63) << 6 | byte3);
56547
- }
56548
- }
56549
- } else if ((byte1 & 248) === 240) {
56550
- const byte2 = position$1 < end ? src[position$1] : 0;
56551
- if (byte1 > 244 || position$1 >= end || (byte2 & 192) !== 128 || byte1 === 240 && byte2 < 144 || byte1 === 244 && byte2 >= 144) {
56552
- units.push(65533);
56553
- } else {
56554
- position$1++;
56555
- if (position$1 >= end || (src[position$1] & 192) !== 128) {
56556
- units.push(65533);
56557
- } else {
56558
- const byte3 = src[position$1++] & 63;
56559
- if (position$1 >= end || (src[position$1] & 192) !== 128) {
56560
- units.push(65533);
56561
- } else {
56562
- const byte4 = src[position$1++] & 63;
56563
- let unit = (byte1 & 7) << 18 | (byte2 & 63) << 12 | byte3 << 6 | byte4;
56564
- unit -= 65536;
56565
- units.push(unit >>> 10 & 1023 | 55296);
56566
- units.push(56320 | unit & 1023);
56567
- }
56568
- }
56569
- }
56570
- } else {
56571
- units.push(65533);
56572
- }
56573
- if (units.length >= 4096) {
56574
- result += fromCharCode.apply(String, units);
56575
- units.length = 0;
56576
- }
56577
- }
56578
- if (units.length > 0) {
56579
- result += fromCharCode.apply(String, units);
56580
- }
56581
- return result;
56582
- }
56583
- let fromCharCode = String.fromCharCode;
56584
- function longStringInJS(length) {
56585
- let start = position$1;
56586
- let bytes = new Array(length);
56587
- for (let i = 0; i < length; i++) {
56588
- const byte = src[position$1++];
56589
- if ((byte & 128) > 0) {
56590
- position$1 = start;
56591
- return;
56592
- }
56593
- bytes[i] = byte;
56594
- }
56595
- return fromCharCode.apply(String, bytes);
56596
- }
56597
- function shortStringInJS(length) {
56598
- if (length < 4) {
56599
- if (length < 2) {
56600
- if (length === 0)
56601
- return "";
56602
- else {
56603
- let a2 = src[position$1++];
56604
- if ((a2 & 128) > 1) {
56605
- position$1 -= 1;
56606
- return;
56607
- }
56608
- return fromCharCode(a2);
56609
- }
56610
- } else {
56611
- let a2 = src[position$1++];
56612
- let b2 = src[position$1++];
56613
- if ((a2 & 128) > 0 || (b2 & 128) > 0) {
56614
- position$1 -= 2;
56615
- return;
56616
- }
56617
- if (length < 3)
56618
- return fromCharCode(a2, b2);
56619
- let c2 = src[position$1++];
56620
- if ((c2 & 128) > 0) {
56621
- position$1 -= 3;
56622
- return;
56623
- }
56624
- return fromCharCode(a2, b2, c2);
56625
- }
56626
- } else {
56627
- let a2 = src[position$1++];
56628
- let b2 = src[position$1++];
56629
- let c2 = src[position$1++];
56630
- let d2 = src[position$1++];
56631
- if ((a2 & 128) > 0 || (b2 & 128) > 0 || (c2 & 128) > 0 || (d2 & 128) > 0) {
56632
- position$1 -= 4;
56633
- return;
56634
- }
56635
- if (length < 6) {
56636
- if (length === 4)
56637
- return fromCharCode(a2, b2, c2, d2);
56638
- else {
56639
- let e = src[position$1++];
56640
- if ((e & 128) > 0) {
56641
- position$1 -= 5;
56642
- return;
56643
- }
56644
- return fromCharCode(a2, b2, c2, d2, e);
56645
- }
56646
- } else if (length < 8) {
56647
- let e = src[position$1++];
56648
- let f2 = src[position$1++];
56649
- if ((e & 128) > 0 || (f2 & 128) > 0) {
56650
- position$1 -= 6;
56651
- return;
56652
- }
56653
- if (length < 7)
56654
- return fromCharCode(a2, b2, c2, d2, e, f2);
56655
- let g2 = src[position$1++];
56656
- if ((g2 & 128) > 0) {
56657
- position$1 -= 7;
56658
- return;
56659
- }
56660
- return fromCharCode(a2, b2, c2, d2, e, f2, g2);
56661
- } else {
56662
- let e = src[position$1++];
56663
- let f2 = src[position$1++];
56664
- let g2 = src[position$1++];
56665
- let h2 = src[position$1++];
56666
- if ((e & 128) > 0 || (f2 & 128) > 0 || (g2 & 128) > 0 || (h2 & 128) > 0) {
56667
- position$1 -= 8;
56668
- return;
56669
- }
56670
- if (length < 10) {
56671
- if (length === 8)
56672
- return fromCharCode(a2, b2, c2, d2, e, f2, g2, h2);
56673
- else {
56674
- let i = src[position$1++];
56675
- if ((i & 128) > 0) {
56676
- position$1 -= 9;
56677
- return;
56678
- }
56679
- return fromCharCode(a2, b2, c2, d2, e, f2, g2, h2, i);
56680
- }
56681
- } else if (length < 12) {
56682
- let i = src[position$1++];
56683
- let j2 = src[position$1++];
56684
- if ((i & 128) > 0 || (j2 & 128) > 0) {
56685
- position$1 -= 10;
56686
- return;
56687
- }
56688
- if (length < 11)
56689
- return fromCharCode(a2, b2, c2, d2, e, f2, g2, h2, i, j2);
56690
- let k2 = src[position$1++];
56691
- if ((k2 & 128) > 0) {
56692
- position$1 -= 11;
56693
- return;
56694
- }
56695
- return fromCharCode(a2, b2, c2, d2, e, f2, g2, h2, i, j2, k2);
56696
- } else {
56697
- let i = src[position$1++];
56698
- let j2 = src[position$1++];
56699
- let k2 = src[position$1++];
56700
- let l = src[position$1++];
56701
- if ((i & 128) > 0 || (j2 & 128) > 0 || (k2 & 128) > 0 || (l & 128) > 0) {
56702
- position$1 -= 12;
56703
- return;
56704
- }
56705
- if (length < 14) {
56706
- if (length === 12)
56707
- return fromCharCode(a2, b2, c2, d2, e, f2, g2, h2, i, j2, k2, l);
56708
- else {
56709
- let m2 = src[position$1++];
56710
- if ((m2 & 128) > 0) {
56711
- position$1 -= 13;
56712
- return;
56713
- }
56714
- return fromCharCode(a2, b2, c2, d2, e, f2, g2, h2, i, j2, k2, l, m2);
56715
- }
56716
- } else {
56717
- let m2 = src[position$1++];
56718
- let n = src[position$1++];
56719
- if ((m2 & 128) > 0 || (n & 128) > 0) {
56720
- position$1 -= 14;
56721
- return;
56722
- }
56723
- if (length < 15)
56724
- return fromCharCode(a2, b2, c2, d2, e, f2, g2, h2, i, j2, k2, l, m2, n);
56725
- let o = src[position$1++];
56726
- if ((o & 128) > 0) {
56727
- position$1 -= 15;
56728
- return;
56729
- }
56730
- return fromCharCode(a2, b2, c2, d2, e, f2, g2, h2, i, j2, k2, l, m2, n, o);
56731
- }
56732
- }
56733
- }
56734
- }
56735
- }
56736
- function readBin(length) {
56737
- return currentDecoder.copyBuffers ? (
56738
- // specifically use the copying slice (not the node one)
56739
- Uint8Array.prototype.slice.call(src, position$1, position$1 += length)
56740
- ) : src.subarray(position$1, position$1 += length);
56741
- }
56742
- let f32Array = new Float32Array(1);
56743
- let u8Array = new Uint8Array(f32Array.buffer, 0, 4);
56744
- function getFloat16() {
56745
- let byte0 = src[position$1++];
56746
- let byte1 = src[position$1++];
56747
- let exponent = (byte0 & 127) >> 2;
56748
- if (exponent === 31) {
56749
- if (byte1 || byte0 & 3)
56750
- return NaN;
56751
- return byte0 & 128 ? -Infinity : Infinity;
56752
- }
56753
- if (exponent === 0) {
56754
- let abs = ((byte0 & 3) << 8 | byte1) / (1 << 24);
56755
- return byte0 & 128 ? -abs : abs;
56756
- }
56757
- u8Array[3] = byte0 & 128 | // sign bit
56758
- (exponent >> 1) + 56;
56759
- u8Array[2] = (byte0 & 7) << 5 | // last exponent bit and first two mantissa bits
56760
- byte1 >> 3;
56761
- u8Array[1] = byte1 << 5;
56762
- u8Array[0] = 0;
56763
- return f32Array[0];
56764
- }
56765
- new Array(4096);
56766
- class Tag {
56767
- constructor(value, tag) {
56768
- this.value = value;
56769
- this.tag = tag;
56770
- }
56771
- }
56772
- currentExtensions[0] = (dateString) => {
56773
- return new Date(dateString);
56774
- };
56775
- currentExtensions[1] = (epochSec) => {
56776
- return new Date(Math.round(epochSec * 1e3));
56777
- };
56778
- currentExtensions[2] = (buffer2) => {
56779
- let value = BigInt(0);
56780
- for (let i = 0, l = buffer2.byteLength; i < l; i++) {
56781
- value = BigInt(buffer2[i]) + (value << BigInt(8));
56782
- }
56783
- return value;
56784
- };
56785
- currentExtensions[3] = (buffer2) => {
56786
- return BigInt(-1) - currentExtensions[2](buffer2);
56787
- };
56788
- currentExtensions[4] = (fraction) => {
56789
- return +(fraction[1] + "e" + fraction[0]);
56790
- };
56791
- currentExtensions[5] = (fraction) => {
56792
- return fraction[1] * Math.exp(fraction[0] * Math.log(2));
56793
- };
56794
- const recordDefinition = (id, structure) => {
56795
- id = id - 57344;
56796
- let existingStructure = currentStructures[id];
56797
- if (existingStructure && existingStructure.isShared) {
56798
- (currentStructures.restoreStructures || (currentStructures.restoreStructures = []))[id] = existingStructure;
56799
- }
56800
- currentStructures[id] = structure;
56801
- structure.read = createStructureReader(structure);
56802
- };
56803
- currentExtensions[LEGACY_RECORD_INLINE_ID] = (data) => {
56804
- let length = data.length;
56805
- let structure = data[1];
56806
- recordDefinition(data[0], structure);
56807
- let object2 = {};
56808
- for (let i = 2; i < length; i++) {
56809
- let key = structure[i - 2];
56810
- object2[safeKey(key)] = data[i];
56811
- }
56812
- return object2;
56813
- };
56814
- const legacyRecordDefinition = currentExtensions[LEGACY_RECORD_INLINE_ID];
56815
- currentExtensions[14] = (value) => {
56816
- if (bundledStrings$1)
56817
- return bundledStrings$1[0].slice(bundledStrings$1.position0, bundledStrings$1.position0 += value);
56818
- return new Tag(value, 14);
56819
- };
56820
- currentExtensions[15] = (value) => {
56821
- if (bundledStrings$1)
56822
- return bundledStrings$1[1].slice(bundledStrings$1.position1, bundledStrings$1.position1 += value);
56823
- return new Tag(value, 15);
56824
- };
56825
- let glbl = { Error, RegExp };
56826
- currentExtensions[27] = (data) => {
56827
- return (glbl[data[0]] || Error)(data[1], data[2]);
56828
- };
56829
- const packedTable = (read2) => {
56830
- if (!(position$1 < srcEnd)) throw endOfCBORError();
56831
- if (src[position$1++] != 132)
56832
- throw new Error("Packed values structure must be followed by a 4 element array");
56833
- let newPackedValues = read2();
56834
- if (!Array.isArray(newPackedValues) || !newPackedValues.length)
56835
- throw new Error("Packed values structure must be followed by a 4 element array");
56836
- packedValues = packedValues ? newPackedValues.concat(packedValues.slice(newPackedValues.length)) : newPackedValues;
56837
- packedValues.prefixes = read2();
56838
- packedValues.suffixes = read2();
56839
- return read2();
56840
- };
56841
- packedTable.handlesRead = true;
56842
- currentExtensions[51] = packedTable;
56843
- currentExtensions[PACKED_REFERENCE_TAG_ID] = (data) => {
56844
- if (!packedValues) {
56845
- if (currentDecoder.getShared)
56846
- loadShared();
56847
- else
56848
- return new Tag(data, PACKED_REFERENCE_TAG_ID);
56849
- }
56850
- if (typeof data == "number")
56851
- return packedValues[16 + (data >= 0 ? 2 * data : -2 * data - 1)];
56852
- throw new Error("No support for non-integer packed references yet");
56853
- };
56854
- currentExtensions[28] = (read2) => {
56855
- if (!referenceMap) {
56856
- referenceMap = /* @__PURE__ */ new Map();
56857
- referenceMap.id = 0;
56858
- }
56859
- let id = referenceMap.id++;
56860
- let startingPosition = position$1;
56861
- let token = src[position$1];
56862
- let target2;
56863
- if (token >> 5 == 4)
56864
- target2 = [];
56865
- else
56866
- target2 = {};
56867
- let refEntry = { target: target2 };
56868
- referenceMap.set(id, refEntry);
56869
- let targetProperties = read2();
56870
- if (refEntry.used) {
56871
- if (Object.getPrototypeOf(target2) !== Object.getPrototypeOf(targetProperties)) {
56872
- position$1 = startingPosition;
56873
- target2 = targetProperties;
56874
- referenceMap.set(id, { target: target2 });
56875
- targetProperties = read2();
56876
- }
56877
- return Object.assign(target2, targetProperties);
56878
- }
56879
- refEntry.target = targetProperties;
56880
- return targetProperties;
56881
- };
56882
- currentExtensions[28].handlesRead = true;
56883
- currentExtensions[29] = (id) => {
56884
- let refEntry = referenceMap.get(id);
56885
- refEntry.used = true;
56886
- return refEntry.target;
56887
- };
56888
- currentExtensions[258] = (array2) => new Set(array2);
56889
- (currentExtensions[259] = (read2) => {
56890
- let decoder2 = currentDecoder;
56891
- if (decoder2.mapsAsObjects) {
56892
- decoder2.mapsAsObjects = false;
56893
- restoreMapsAsObject = true;
56894
- try {
56895
- return read2();
56896
- } finally {
56897
- if (restoreMapsAsObject) {
56898
- decoder2.mapsAsObjects = true;
56899
- restoreMapsAsObject = false;
56900
- }
56901
- }
56902
- }
56903
- return read2();
56904
- }).handlesRead = true;
56905
- function combine(a2, b2) {
56906
- if (typeof a2 === "string")
56907
- return a2 + b2;
56908
- if (a2 instanceof Array)
56909
- return a2.concat(b2);
56910
- return Object.assign({}, a2, b2);
56911
- }
56912
- function getPackedValues() {
56913
- if (!packedValues) {
56914
- if (currentDecoder.getShared)
56915
- loadShared();
56916
- else
56917
- throw new Error("No packed values available");
56918
- }
56919
- return packedValues;
56920
- }
56921
- const SHARED_DATA_TAG_ID = 1399353956;
56922
- currentExtensionRanges.push((tag, input) => {
56923
- if (tag >= 225 && tag <= 255)
56924
- return combine(getPackedValues().prefixes[tag - 224], input);
56925
- if (tag >= 28704 && tag <= 32767)
56926
- return combine(getPackedValues().prefixes[tag - 28672], input);
56927
- if (tag >= 1879052288 && tag <= 2147483647)
56928
- return combine(getPackedValues().prefixes[tag - 1879048192], input);
56929
- if (tag >= 216 && tag <= 223)
56930
- return combine(input, getPackedValues().suffixes[tag - 216]);
56931
- if (tag >= 27647 && tag <= 28671)
56932
- return combine(input, getPackedValues().suffixes[tag - 27639]);
56933
- if (tag >= 1811940352 && tag <= 1879048191)
56934
- return combine(input, getPackedValues().suffixes[tag - 1811939328]);
56935
- if (tag == SHARED_DATA_TAG_ID) {
56936
- return {
56937
- packedValues,
56938
- structures: currentStructures.slice(0),
56939
- version: input
56940
- };
56941
- }
56942
- if (tag == 55799)
56943
- return input;
56944
- });
56945
- const isLittleEndianMachine$1 = new Uint8Array(new Uint16Array([1]).buffer)[0] == 1;
56946
- const typedArrays = [
56947
- Uint8Array,
56948
- Uint8ClampedArray,
56949
- Uint16Array,
56950
- Uint32Array,
56951
- typeof BigUint64Array == "undefined" ? { name: "BigUint64Array" } : BigUint64Array,
56952
- Int8Array,
56953
- Int16Array,
56954
- Int32Array,
56955
- typeof BigInt64Array == "undefined" ? { name: "BigInt64Array" } : BigInt64Array,
56956
- Float32Array,
56957
- Float64Array
56958
- ];
56959
- const typedArrayTags = [64, 68, 69, 70, 71, 72, 77, 78, 79, 85, 86];
56960
- for (let i = 0; i < typedArrays.length; i++) {
56961
- registerTypedArray(typedArrays[i], typedArrayTags[i]);
56962
- }
56963
- function registerTypedArray(TypedArray, tag) {
56964
- let dvMethod = "get" + TypedArray.name.slice(0, -5);
56965
- let bytesPerElement;
56966
- if (typeof TypedArray === "function")
56967
- bytesPerElement = TypedArray.BYTES_PER_ELEMENT;
56968
- else
56969
- TypedArray = null;
56970
- for (let littleEndian = 0; littleEndian < 2; littleEndian++) {
56971
- if (!littleEndian && bytesPerElement == 1)
56972
- continue;
56973
- let sizeShift = bytesPerElement == 2 ? 1 : bytesPerElement == 4 ? 2 : bytesPerElement == 8 ? 3 : 0;
56974
- currentExtensions[littleEndian ? tag : tag - 4] = bytesPerElement == 1 || littleEndian == isLittleEndianMachine$1 ? (buffer2) => {
56975
- if (!TypedArray)
56976
- throw new Error("Could not find typed array for code " + tag);
56977
- if (!currentDecoder.copyBuffers) {
56978
- if (bytesPerElement === 1 || bytesPerElement === 2 && !(buffer2.byteOffset & 1) || bytesPerElement === 4 && !(buffer2.byteOffset & 3) || bytesPerElement === 8 && !(buffer2.byteOffset & 7))
56979
- return new TypedArray(buffer2.buffer, buffer2.byteOffset, buffer2.byteLength >> sizeShift);
56980
- }
56981
- return new TypedArray(Uint8Array.prototype.slice.call(buffer2, 0).buffer);
56982
- } : (buffer2) => {
56983
- if (!TypedArray)
56984
- throw new Error("Could not find typed array for code " + tag);
56985
- let dv = new DataView(buffer2.buffer, buffer2.byteOffset, buffer2.byteLength);
56986
- let elements = buffer2.length >> sizeShift;
56987
- let ta2 = new TypedArray(elements);
56988
- let method = dv[dvMethod];
56989
- for (let i = 0; i < elements; i++) {
56990
- ta2[i] = method.call(dv, i << sizeShift, littleEndian);
56991
- }
56992
- return ta2;
56993
- };
56994
- }
56995
- }
56996
- function readBundleExt() {
56997
- let length = readJustLength();
56998
- let bundlePosition = position$1 + read();
56999
- for (let i = 2; i < length; i++) {
57000
- let bundleLength = readJustLength();
57001
- position$1 += bundleLength;
57002
- }
57003
- let dataPosition = position$1;
57004
- position$1 = bundlePosition;
57005
- bundledStrings$1 = [readStringJS(readJustLength()), readStringJS(readJustLength())];
57006
- bundledStrings$1.position0 = 0;
57007
- bundledStrings$1.position1 = 0;
57008
- bundledStrings$1.postBundlePosition = position$1;
57009
- position$1 = dataPosition;
57010
- return read();
57011
- }
57012
- function readJustLength() {
57013
- if (!(position$1 < srcEnd)) throw endOfCBORError();
57014
- let token = src[position$1++] & 31;
57015
- if (token > 23) {
57016
- switch (token) {
57017
- case 24:
57018
- if (position$1 >= srcEnd) throw endOfCBORError();
57019
- token = src[position$1++];
57020
- break;
57021
- case 25:
57022
- if (position$1 + 2 > srcEnd) throw endOfCBORError();
57023
- token = dataView.getUint16(position$1);
57024
- position$1 += 2;
57025
- break;
57026
- case 26:
57027
- if (position$1 + 4 > srcEnd) throw endOfCBORError();
57028
- token = dataView.getUint32(position$1);
57029
- position$1 += 4;
57030
- break;
57031
- }
57032
- }
57033
- return token;
57034
- }
57035
- function loadShared() {
57036
- if (currentDecoder.getShared) {
57037
- let sharedData = saveState(() => {
57038
- src = null;
57039
- return currentDecoder.getShared();
57040
- }) || {};
57041
- let updatedStructures = sharedData.structures || [];
57042
- currentDecoder.sharedVersion = sharedData.version;
57043
- packedValues = currentDecoder.sharedValues = sharedData.packedValues;
57044
- if (currentStructures === true)
57045
- currentDecoder.structures = currentStructures = updatedStructures;
57046
- else
57047
- currentStructures.splice.apply(currentStructures, [0, updatedStructures.length].concat(updatedStructures));
57048
- }
57049
- }
57050
- function saveState(callback) {
57051
- let savedFragmentEnd = fragmentEnd;
57052
- let savedFragmentReader = fragmentReadString;
57053
- let savedReadFixedString = readFixedString;
57054
- let savedSrcEnd = srcEnd;
57055
- let savedPosition = position$1;
57056
- let savedSrcStringStart = srcStringStart;
57057
- let savedSrcStringEnd = srcStringEnd;
57058
- let savedSrcString = srcString;
57059
- let savedReferenceMap = referenceMap;
57060
- let savedBundledStrings = bundledStrings$1;
57061
- let savedPackedValues = packedValues;
57062
- let savedSrc = new Uint8Array(src.slice(0, srcEnd));
57063
- let savedStructures = currentStructures;
57064
- let savedDecoder = currentDecoder;
57065
- let savedSequentialMode = sequentialMode;
57066
- let savedRestoreMapsAsObject = restoreMapsAsObject;
57067
- let savedArrayAllocationBudget = arrayAllocationBudget;
57068
- fragmentEnd = 0;
57069
- if (fragmentReadString) readFixedString = fragmentReadString;
57070
- fragmentReadString = null;
57071
- restoreMapsAsObject = false;
57072
- try {
57073
- return callback();
57074
- } catch (error2) {
57075
- if (error2 && (typeof error2 == "object" || typeof error2 == "function"))
57076
- nestedDecodeErrors.add(error2);
57077
- throw error2;
57078
- } finally {
57079
- fragmentEnd = savedFragmentEnd;
57080
- fragmentReadString = savedFragmentReader;
57081
- readFixedString = savedReadFixedString;
57082
- srcEnd = savedSrcEnd;
57083
- position$1 = savedPosition;
57084
- srcStringStart = savedSrcStringStart;
57085
- srcStringEnd = savedSrcStringEnd;
57086
- srcString = savedSrcString;
57087
- referenceMap = savedReferenceMap;
57088
- bundledStrings$1 = savedBundledStrings;
57089
- packedValues = savedPackedValues;
57090
- src = savedSrc;
57091
- sequentialMode = savedSequentialMode;
57092
- currentStructures = savedStructures;
57093
- currentDecoder = savedDecoder;
57094
- restoreMapsAsObject = savedRestoreMapsAsObject;
57095
- arrayAllocationBudget = savedArrayAllocationBudget;
57096
- dataView = new DataView(src.buffer, src.byteOffset, src.byteLength);
57097
- }
57098
- }
57099
- function clearSource() {
57100
- src = null;
57101
- referenceMap = null;
57102
- currentStructures = null;
57103
- }
57104
- let fragmentEnd = 0;
57105
- let fragmentReadString;
57106
- /* @__PURE__ */ new Map([[LEGACY_RECORD_INLINE_ID, legacyRecordDefinition], [259, currentExtensions[259]]]);
57107
- const mult10 = new Array(147);
57108
- for (let i = 0; i < 256; i++) {
57109
- mult10[i] = +("1e" + Math.floor(45.15 - i * 0.30103));
57110
- }
57111
- let defaultDecoder = new Decoder({ useRecords: false });
57112
- const decode = defaultDecoder.decode;
57113
- defaultDecoder.decodeMultiple;
57114
- let textEncoder;
57115
- try {
57116
- textEncoder = new TextEncoder();
57117
- } catch (error2) {
57118
- }
57119
- let extensions, extensionClasses;
57120
- const Buffer$1 = typeof globalThis === "object" && globalThis.Buffer;
57121
- const hasNodeBuffer = typeof Buffer$1 !== "undefined";
57122
- const ByteArrayAllocate = hasNodeBuffer ? Buffer$1.allocUnsafeSlow : Uint8Array;
57123
- const ByteArray = hasNodeBuffer ? Buffer$1 : Uint8Array;
57124
- const MAX_STRUCTURES = 256;
57125
- const MAX_BUFFER_SIZE = hasNodeBuffer ? 4294967296 : 2144337920;
57126
- let throwOnIterable;
57127
- let target;
57128
- let targetView;
57129
- let position = 0;
57130
- let safeEnd;
57131
- let bundledStrings = null;
57132
- const MAX_BUNDLE_SIZE = 61440;
57133
- const hasNonLatin = /[\u0080-\uFFFF]/;
57134
- const RECORD_SYMBOL = Symbol("record-id");
57135
- class Encoder extends Decoder {
57136
- constructor(options) {
57137
- super(options);
57138
- this.offset = 0;
57139
- let start;
57140
- let sharedStructures;
57141
- let hasSharedUpdate;
57142
- let structures;
57143
- let referenceMap2;
57144
- options = options || {};
57145
- let encodeUtf8 = ByteArray.prototype.utf8Write ? function(string2, position2) {
57146
- return target.utf8Write(string2, position2, target.byteLength - position2);
57147
- } : textEncoder && textEncoder.encodeInto ? function(string2, position2) {
57148
- return textEncoder.encodeInto(string2, target.subarray(position2)).written;
57149
- } : false;
57150
- let encoder = this;
57151
- let hasSharedStructures = options.structures || options.saveStructures;
57152
- let maxSharedStructures = options.maxSharedStructures;
57153
- if (maxSharedStructures == null)
57154
- maxSharedStructures = hasSharedStructures ? 128 : 0;
57155
- if (maxSharedStructures > 8190)
57156
- throw new Error("Maximum maxSharedStructure is 8190");
57157
- let isSequential = options.sequential;
57158
- if (isSequential) {
57159
- maxSharedStructures = 0;
57160
- }
57161
- if (!this.structures)
57162
- this.structures = [];
57163
- if (this.saveStructures)
57164
- this.saveShared = this.saveStructures;
57165
- let samplingPackedValues, packedObjectMap2, sharedValues = options.sharedValues;
57166
- let sharedPackedObjectMap2;
57167
- if (sharedValues) {
57168
- sharedPackedObjectMap2 = /* @__PURE__ */ Object.create(null);
57169
- for (let i = 0, l = sharedValues.length; i < l; i++) {
57170
- sharedPackedObjectMap2[sharedValues[i]] = i;
57171
- }
57172
- }
57173
- let recordIdsToRemove = [];
57174
- let transitionsCount = 0;
57175
- let serializationsSinceTransitionRebuild = 0;
57176
- this.mapEncode = function(value, encodeOptions) {
57177
- if (this._keyMap && !this._mapped) {
57178
- switch (value.constructor.name) {
57179
- case "Array":
57180
- value = value.map((r2) => this.encodeKeys(r2));
57181
- break;
57182
- }
57183
- }
57184
- return this.encode(value, encodeOptions);
57185
- };
57186
- this.encode = function(value, encodeOptions) {
57187
- if (!target) {
57188
- target = new ByteArrayAllocate(8192);
57189
- targetView = new DataView(target.buffer, 0, 8192);
57190
- position = 0;
57191
- }
57192
- safeEnd = target.length - 10;
57193
- if (safeEnd - position < 2048) {
57194
- target = new ByteArrayAllocate(target.length);
57195
- targetView = new DataView(target.buffer, 0, target.length);
57196
- safeEnd = target.length - 10;
57197
- position = 0;
57198
- } else if (encodeOptions === REUSE_BUFFER_MODE)
57199
- position = position + 7 & 2147483640;
57200
- start = position;
57201
- if (encoder.useSelfDescribedHeader) {
57202
- targetView.setUint32(position, 3654940416);
57203
- position += 3;
57204
- }
57205
- referenceMap2 = encoder.structuredClone ? /* @__PURE__ */ new Map() : null;
57206
- if (encoder.bundleStrings && typeof value !== "string") {
57207
- bundledStrings = [];
57208
- bundledStrings.size = Infinity;
57209
- } else
57210
- bundledStrings = null;
57211
- sharedStructures = encoder.structures;
57212
- if (sharedStructures) {
57213
- if (sharedStructures.uninitialized) {
57214
- let sharedData = encoder.getShared() || {};
57215
- encoder.structures = sharedStructures = sharedData.structures || [];
57216
- encoder.sharedVersion = sharedData.version;
57217
- let sharedValues2 = encoder.sharedValues = sharedData.packedValues;
57218
- if (sharedValues2) {
57219
- sharedPackedObjectMap2 = {};
57220
- for (let i = 0, l = sharedValues2.length; i < l; i++)
57221
- sharedPackedObjectMap2[sharedValues2[i]] = i;
57222
- }
57223
- }
57224
- let sharedStructuresLength = sharedStructures.length;
57225
- if (sharedStructuresLength > maxSharedStructures && !isSequential)
57226
- sharedStructuresLength = maxSharedStructures;
57227
- if (!sharedStructures.transitions) {
57228
- sharedStructures.transitions = /* @__PURE__ */ Object.create(null);
57229
- for (let i = 0; i < sharedStructuresLength; i++) {
57230
- let keys2 = sharedStructures[i];
57231
- if (!keys2)
57232
- continue;
57233
- let nextTransition, transition = sharedStructures.transitions;
57234
- for (let j2 = 0, l = keys2.length; j2 < l; j2++) {
57235
- if (transition[RECORD_SYMBOL] === void 0)
57236
- transition[RECORD_SYMBOL] = i;
57237
- let key = keys2[j2];
57238
- nextTransition = transition[key];
57239
- if (!nextTransition) {
57240
- nextTransition = transition[key] = /* @__PURE__ */ Object.create(null);
57241
- }
57242
- transition = nextTransition;
57243
- }
57244
- transition[RECORD_SYMBOL] = i | 1048576;
57245
- }
57246
- }
57247
- if (!isSequential)
57248
- sharedStructures.nextId = sharedStructuresLength;
57249
- }
57250
- if (hasSharedUpdate)
57251
- hasSharedUpdate = false;
57252
- structures = sharedStructures || [];
57253
- packedObjectMap2 = sharedPackedObjectMap2;
57254
- if (options.pack) {
57255
- let packedValues2 = /* @__PURE__ */ new Map();
57256
- packedValues2.values = [];
57257
- packedValues2.encoder = encoder;
57258
- packedValues2.maxValues = options.maxPrivatePackedValues || (sharedPackedObjectMap2 ? 16 : Infinity);
57259
- packedValues2.objectMap = sharedPackedObjectMap2 || false;
57260
- packedValues2.samplingPackedValues = samplingPackedValues;
57261
- findRepetitiveStrings(value, packedValues2);
57262
- if (packedValues2.values.length > 0) {
57263
- target[position++] = 216;
57264
- target[position++] = 51;
57265
- writeArrayHeader(4);
57266
- let valuesArray = packedValues2.values;
57267
- encode2(valuesArray);
57268
- writeArrayHeader(0);
57269
- writeArrayHeader(0);
57270
- packedObjectMap2 = Object.create(sharedPackedObjectMap2 || null);
57271
- for (let i = 0, l = valuesArray.length; i < l; i++) {
57272
- packedObjectMap2[valuesArray[i]] = i;
57273
- }
57274
- }
57275
- }
57276
- throwOnIterable = encodeOptions & THROW_ON_ITERABLE;
57277
- try {
57278
- if (throwOnIterable)
57279
- return;
57280
- encode2(value);
57281
- if (bundledStrings && bundledStrings.position) {
57282
- writeBundles(start, encode2);
57283
- }
57284
- encoder.offset = position;
57285
- if (referenceMap2 && referenceMap2.idsToInsert) {
57286
- position += referenceMap2.idsToInsert.length * 2;
57287
- if (position > safeEnd)
57288
- makeRoom(position);
57289
- encoder.offset = position;
57290
- let serialized = insertIds(target.subarray(start, position), referenceMap2.idsToInsert);
57291
- referenceMap2 = null;
57292
- return serialized;
57293
- }
57294
- if (encodeOptions & REUSE_BUFFER_MODE) {
57295
- target.start = start;
57296
- target.end = position;
57297
- return target;
57298
- }
57299
- return target.subarray(start, position);
57300
- } finally {
57301
- if (sharedStructures) {
57302
- if (serializationsSinceTransitionRebuild < 10)
57303
- serializationsSinceTransitionRebuild++;
57304
- if (sharedStructures.length > maxSharedStructures)
57305
- sharedStructures.length = maxSharedStructures;
57306
- if (transitionsCount > 1e4) {
57307
- sharedStructures.transitions = null;
57308
- serializationsSinceTransitionRebuild = 0;
57309
- transitionsCount = 0;
57310
- if (recordIdsToRemove.length > 0)
57311
- recordIdsToRemove = [];
57312
- } else if (recordIdsToRemove.length > 0 && !isSequential) {
57313
- for (let i = 0, l = recordIdsToRemove.length; i < l; i++) {
57314
- recordIdsToRemove[i][RECORD_SYMBOL] = void 0;
57315
- }
57316
- recordIdsToRemove = [];
57317
- }
57318
- }
57319
- if (hasSharedUpdate && encoder.saveShared) {
57320
- if (encoder.structures.length > maxSharedStructures) {
57321
- encoder.structures = encoder.structures.slice(0, maxSharedStructures);
57322
- }
57323
- let returnBuffer = target.subarray(start, position);
57324
- if (encoder.updateSharedData() === false)
57325
- return encoder.encode(value);
57326
- return returnBuffer;
57327
- }
57328
- if (encodeOptions & RESET_BUFFER_MODE)
57329
- position = start;
57330
- }
57331
- };
57332
- this.findCommonStringsToPack = () => {
57333
- samplingPackedValues = /* @__PURE__ */ new Map();
57334
- if (!sharedPackedObjectMap2)
57335
- sharedPackedObjectMap2 = /* @__PURE__ */ Object.create(null);
57336
- return (options2) => {
57337
- let threshold = options2 && options2.threshold || 4;
57338
- let position2 = this.pack ? options2.maxPrivatePackedValues || 16 : 0;
57339
- if (!sharedValues)
57340
- sharedValues = this.sharedValues = [];
57341
- for (let [key, status] of samplingPackedValues) {
57342
- if (status.count > threshold) {
57343
- sharedPackedObjectMap2[key] = position2++;
57344
- sharedValues.push(key);
57345
- hasSharedUpdate = true;
57346
- }
57347
- }
57348
- while (this.saveShared && this.updateSharedData() === false) {
57349
- }
57350
- samplingPackedValues = null;
57351
- };
57352
- };
57353
- const encode2 = (value) => {
57354
- if (position > safeEnd)
57355
- target = makeRoom(position);
57356
- var type = typeof value;
57357
- var length;
57358
- if (type === "string") {
57359
- if (packedObjectMap2) {
57360
- let packedPosition = packedObjectMap2[value];
57361
- if (packedPosition >= 0) {
57362
- if (packedPosition < 16)
57363
- target[position++] = packedPosition + 224;
57364
- else {
57365
- target[position++] = 198;
57366
- if (packedPosition & 1)
57367
- encode2(15 - packedPosition >> 1);
57368
- else
57369
- encode2(packedPosition - 16 >> 1);
57370
- }
57371
- return;
57372
- } else if (samplingPackedValues && !options.pack) {
57373
- let status = samplingPackedValues.get(value);
57374
- if (status)
57375
- status.count++;
57376
- else
57377
- samplingPackedValues.set(value, {
57378
- count: 1
57379
- });
57380
- }
57381
- }
57382
- let strLength = value.length;
57383
- if (bundledStrings && strLength >= 4 && strLength < 1024) {
57384
- if ((bundledStrings.size += strLength) > MAX_BUNDLE_SIZE) {
57385
- let extStart;
57386
- let maxBytes2 = (bundledStrings[0] ? bundledStrings[0].length * 3 + bundledStrings[1].length : 0) + 10;
57387
- if (position + maxBytes2 > safeEnd)
57388
- target = makeRoom(position + maxBytes2);
57389
- target[position++] = 217;
57390
- target[position++] = 223;
57391
- target[position++] = 249;
57392
- target[position++] = bundledStrings.position ? 132 : 130;
57393
- target[position++] = 26;
57394
- extStart = position - start;
57395
- position += 4;
57396
- if (bundledStrings.position) {
57397
- writeBundles(start, encode2);
57398
- }
57399
- bundledStrings = ["", ""];
57400
- bundledStrings.size = 0;
57401
- bundledStrings.position = extStart;
57402
- }
57403
- let twoByte = hasNonLatin.test(value);
57404
- bundledStrings[twoByte ? 0 : 1] += value;
57405
- target[position++] = twoByte ? 206 : 207;
57406
- encode2(strLength);
57407
- return;
57408
- }
57409
- let headerSize;
57410
- if (strLength < 32) {
57411
- headerSize = 1;
57412
- } else if (strLength < 256) {
57413
- headerSize = 2;
57414
- } else if (strLength < 65536) {
57415
- headerSize = 3;
57416
- } else {
57417
- headerSize = 5;
57418
- }
57419
- let maxBytes = strLength * 3;
57420
- if (position + maxBytes > safeEnd)
57421
- target = makeRoom(position + maxBytes);
57422
- if (strLength < 64 || !encodeUtf8) {
57423
- let i, c1, c2, strPosition = position + headerSize;
57424
- for (i = 0; i < strLength; i++) {
57425
- c1 = value.charCodeAt(i);
57426
- if (c1 < 128) {
57427
- target[strPosition++] = c1;
57428
- } else if (c1 < 2048) {
57429
- target[strPosition++] = c1 >> 6 | 192;
57430
- target[strPosition++] = c1 & 63 | 128;
57431
- } else if ((c1 & 64512) === 55296 && ((c2 = value.charCodeAt(i + 1)) & 64512) === 56320) {
57432
- c1 = 65536 + ((c1 & 1023) << 10) + (c2 & 1023);
57433
- i++;
57434
- target[strPosition++] = c1 >> 18 | 240;
57435
- target[strPosition++] = c1 >> 12 & 63 | 128;
57436
- target[strPosition++] = c1 >> 6 & 63 | 128;
57437
- target[strPosition++] = c1 & 63 | 128;
57438
- } else {
57439
- target[strPosition++] = c1 >> 12 | 224;
57440
- target[strPosition++] = c1 >> 6 & 63 | 128;
57441
- target[strPosition++] = c1 & 63 | 128;
57442
- }
57443
- }
57444
- length = strPosition - position - headerSize;
57445
- } else {
57446
- length = encodeUtf8(value, position + headerSize, maxBytes);
57447
- }
57448
- if (length < 24) {
57449
- target[position++] = 96 | length;
57450
- } else if (length < 256) {
57451
- if (headerSize < 2) {
57452
- target.copyWithin(position + 2, position + 1, position + 1 + length);
57453
- }
57454
- target[position++] = 120;
57455
- target[position++] = length;
57456
- } else if (length < 65536) {
57457
- if (headerSize < 3) {
57458
- target.copyWithin(position + 3, position + 2, position + 2 + length);
57459
- }
57460
- target[position++] = 121;
57461
- target[position++] = length >> 8;
57462
- target[position++] = length & 255;
57463
- } else {
57464
- if (headerSize < 5) {
57465
- target.copyWithin(position + 5, position + 3, position + 3 + length);
57466
- }
57467
- target[position++] = 122;
57468
- targetView.setUint32(position, length);
57469
- position += 4;
57470
- }
57471
- position += length;
57472
- } else if (type === "number") {
57473
- if (!this.alwaysUseFloat && value >>> 0 === value) {
57474
- if (value < 24) {
57475
- target[position++] = value;
57476
- } else if (value < 256) {
57477
- target[position++] = 24;
57478
- target[position++] = value;
57479
- } else if (value < 65536) {
57480
- target[position++] = 25;
57481
- target[position++] = value >> 8;
57482
- target[position++] = value & 255;
57483
- } else {
57484
- target[position++] = 26;
57485
- targetView.setUint32(position, value);
57486
- position += 4;
57487
- }
57488
- } else if (!this.alwaysUseFloat && value >> 0 === value) {
57489
- if (value >= -24) {
57490
- target[position++] = 31 - value;
57491
- } else if (value >= -256) {
57492
- target[position++] = 56;
57493
- target[position++] = ~value;
57494
- } else if (value >= -65536) {
57495
- target[position++] = 57;
57496
- targetView.setUint16(position, ~value);
57497
- position += 2;
57498
- } else {
57499
- target[position++] = 58;
57500
- targetView.setUint32(position, ~value);
57501
- position += 4;
57502
- }
57503
- } else if (!this.alwaysUseFloat && value < 0 && value >= -4294967296 && Math.floor(value) === value) {
57504
- target[position++] = 58;
57505
- targetView.setUint32(position, -1 - value);
57506
- position += 4;
57507
- } else {
57508
- let useFloat32;
57509
- if ((useFloat32 = this.useFloat32) > 0 && value < 4294967296 && value >= -2147483648) {
57510
- target[position++] = 250;
57511
- targetView.setFloat32(position, value);
57512
- let xShifted;
57513
- if (useFloat32 < 4 || // this checks for rounding of numbers that were encoded in 32-bit float to nearest significant decimal digit that could be preserved
57514
- (xShifted = value * mult10[(target[position] & 127) << 1 | target[position + 1] >> 7]) >> 0 === xShifted) {
57515
- position += 4;
57516
- return;
57517
- } else
57518
- position--;
57519
- }
57520
- target[position++] = 251;
57521
- targetView.setFloat64(position, value);
57522
- position += 8;
57523
- }
57524
- } else if (type === "object") {
57525
- if (!value)
57526
- target[position++] = 246;
57527
- else {
57528
- if (referenceMap2) {
57529
- let referee = referenceMap2.get(value);
57530
- if (referee) {
57531
- target[position++] = 216;
57532
- target[position++] = 29;
57533
- target[position++] = 25;
57534
- if (!referee.references) {
57535
- let idsToInsert = referenceMap2.idsToInsert || (referenceMap2.idsToInsert = []);
57536
- referee.references = [];
57537
- idsToInsert.push(referee);
57538
- }
57539
- referee.references.push(position - start);
57540
- position += 2;
57541
- return;
57542
- } else
57543
- referenceMap2.set(value, { offset: position - start });
57544
- }
57545
- let constructor = value.constructor;
57546
- if (constructor === Object) {
57547
- if (this.skipFunction === true) {
57548
- value = Object.fromEntries([...Object.keys(value).filter((x2) => typeof value[x2] !== "function").map((x2) => [x2, value[x2]])]);
57549
- }
57550
- writeObject(value);
57551
- } else if (constructor === Array) {
57552
- length = value.length;
57553
- if (length < 24) {
57554
- target[position++] = 128 | length;
57555
- } else {
57556
- writeArrayHeader(length);
57557
- }
57558
- for (let i = 0; i < length; i++) {
57559
- encode2(value[i]);
57560
- }
57561
- } else if (constructor === Map) {
57562
- if (this.mapsAsObjects ? this.useTag259ForMaps !== false : this.useTag259ForMaps) {
57563
- target[position++] = 217;
57564
- target[position++] = 1;
57565
- target[position++] = 3;
57566
- }
57567
- length = value.size;
57568
- if (length < 24) {
57569
- target[position++] = 160 | length;
57570
- } else if (length < 256) {
57571
- target[position++] = 184;
57572
- target[position++] = length;
57573
- } else if (length < 65536) {
57574
- target[position++] = 185;
57575
- target[position++] = length >> 8;
57576
- target[position++] = length & 255;
57577
- } else {
57578
- target[position++] = 186;
57579
- targetView.setUint32(position, length);
57580
- position += 4;
57581
- }
57582
- if (encoder.keyMap) {
57583
- for (let [key, entryValue] of value) {
57584
- encode2(encoder.encodeKey(key));
57585
- encode2(entryValue);
57586
- }
57587
- } else {
57588
- for (let [key, entryValue] of value) {
57589
- encode2(key);
57590
- encode2(entryValue);
57591
- }
57592
- }
57593
- } else {
57594
- for (let i = 0, l = extensions.length; i < l; i++) {
57595
- let extensionClass = extensionClasses[i];
57596
- if (value instanceof extensionClass) {
57597
- let extension2 = extensions[i];
57598
- let tag = extension2.tag;
57599
- if (tag == void 0)
57600
- tag = extension2.getTag && extension2.getTag.call(this, value);
57601
- if (tag < 24) {
57602
- target[position++] = 192 | tag;
57603
- } else if (tag < 256) {
57604
- target[position++] = 216;
57605
- target[position++] = tag;
57606
- } else if (tag < 65536) {
57607
- target[position++] = 217;
57608
- target[position++] = tag >> 8;
57609
- target[position++] = tag & 255;
57610
- } else if (tag > -1) {
57611
- target[position++] = 218;
57612
- targetView.setUint32(position, tag);
57613
- position += 4;
57614
- }
57615
- extension2.encode.call(this, value, encode2, makeRoom);
57616
- return;
57617
- }
57618
- }
57619
- if (value[Symbol.iterator]) {
57620
- if (throwOnIterable) {
57621
- let error2 = new Error("Iterable should be serialized as iterator");
57622
- error2.iteratorNotHandled = true;
57623
- throw error2;
57624
- }
57625
- target[position++] = 159;
57626
- for (let entry of value) {
57627
- encode2(entry);
57628
- }
57629
- target[position++] = 255;
57630
- return;
57631
- }
57632
- if (value[Symbol.asyncIterator] || isBlob(value)) {
57633
- let error2 = new Error("Iterable/blob should be serialized as iterator");
57634
- error2.iteratorNotHandled = true;
57635
- throw error2;
57636
- }
57637
- if (this.useToJSON && value.toJSON) {
57638
- const json = value.toJSON();
57639
- if (json !== value)
57640
- return encode2(json);
57641
- }
57642
- if (constructor === DataView) {
57643
- writeBuffer(new Uint8Array(value.buffer, value.byteOffset, value.byteLength), makeRoom);
57644
- return;
57645
- }
57646
- writeObject(value);
57647
- }
57648
- }
57649
- } else if (type === "boolean") {
57650
- target[position++] = value ? 245 : 244;
57651
- } else if (type === "bigint") {
57652
- if (value < BigInt(1) << BigInt(64) && value >= 0) {
57653
- target[position++] = 27;
57654
- targetView.setBigUint64(position, value);
57655
- } else if (value > -(BigInt(1) << BigInt(64)) && value < 0) {
57656
- target[position++] = 59;
57657
- targetView.setBigUint64(position, -value - BigInt(1));
57658
- } else {
57659
- if (this.largeBigIntToFloat) {
57660
- target[position++] = 251;
57661
- targetView.setFloat64(position, Number(value));
57662
- } else {
57663
- if (value >= BigInt(0))
57664
- target[position++] = 194;
57665
- else {
57666
- target[position++] = 195;
57667
- value = BigInt(-1) - value;
57668
- }
57669
- let bytes = [];
57670
- while (value) {
57671
- bytes.push(Number(value & BigInt(255)));
57672
- value >>= BigInt(8);
57673
- }
57674
- writeBuffer(new Uint8Array(bytes.reverse()), makeRoom);
57675
- return;
57676
- }
57677
- }
57678
- position += 8;
57679
- } else if (type === "undefined") {
57680
- target[position++] = 247;
57681
- } else {
57682
- throw new Error("Unknown type: " + type);
57683
- }
57684
- };
57685
- const writeObject = this.useRecords === false ? this.variableMapSize ? (object2) => {
57686
- let keys2 = Object.keys(object2);
57687
- let vals = Object.values(object2);
57688
- let length = keys2.length;
57689
- if (length < 24) {
57690
- target[position++] = 160 | length;
57691
- } else if (length < 256) {
57692
- target[position++] = 184;
57693
- target[position++] = length;
57694
- } else if (length < 65536) {
57695
- target[position++] = 185;
57696
- target[position++] = length >> 8;
57697
- target[position++] = length & 255;
57698
- } else {
57699
- target[position++] = 186;
57700
- targetView.setUint32(position, length);
57701
- position += 4;
57702
- }
57703
- if (encoder.keyMap) {
57704
- for (let i = 0; i < length; i++) {
57705
- encode2(encoder.encodeKey(keys2[i]));
57706
- encode2(vals[i]);
57707
- }
57708
- } else {
57709
- for (let i = 0; i < length; i++) {
57710
- encode2(keys2[i]);
57711
- encode2(vals[i]);
57712
- }
57713
- }
57714
- } : (object2) => {
57715
- target[position++] = 185;
57716
- let objectOffset = position - start;
57717
- position += 2;
57718
- let size2 = 0;
57719
- if (encoder.keyMap) {
57720
- for (let key in object2) if (typeof object2.hasOwnProperty !== "function" || object2.hasOwnProperty(key)) {
57721
- encode2(encoder.encodeKey(key));
57722
- encode2(object2[key]);
57723
- size2++;
57724
- }
57725
- } else {
57726
- for (let key in object2) if (typeof object2.hasOwnProperty !== "function" || object2.hasOwnProperty(key)) {
57727
- encode2(key);
57728
- encode2(object2[key]);
57729
- size2++;
57730
- }
57731
- }
57732
- if (size2 < 65536) {
57733
- target[objectOffset++ + start] = size2 >> 8;
57734
- target[objectOffset + start] = size2 & 255;
57735
- } else {
57736
- if (position + 2 > safeEnd)
57737
- makeRoom(position + 2);
57738
- let headerPosition = objectOffset + start;
57739
- target.copyWithin(headerPosition + 4, headerPosition + 2, position);
57740
- position += 2;
57741
- target[headerPosition - 1] = 186;
57742
- targetView.setUint32(headerPosition, size2);
57743
- }
57744
- } : (object2, skipValues) => {
57745
- let nextTransition, transition = structures.transitions || (structures.transitions = /* @__PURE__ */ Object.create(null));
57746
- let newTransitions = 0;
57747
- let length = 0;
57748
- let parentRecordId;
57749
- let keys2;
57750
- if (this.keyMap) {
57751
- keys2 = Object.keys(object2).map((k2) => this.encodeKey(k2));
57752
- length = keys2.length;
57753
- for (let i = 0; i < length; i++) {
57754
- let key = keys2[i];
57755
- nextTransition = transition[key];
57756
- if (!nextTransition) {
57757
- nextTransition = transition[key] = /* @__PURE__ */ Object.create(null);
57758
- newTransitions++;
57759
- }
57760
- transition = nextTransition;
57761
- }
57762
- } else {
57763
- for (let key in object2) if (typeof object2.hasOwnProperty !== "function" || object2.hasOwnProperty(key)) {
57764
- nextTransition = transition[key];
57765
- if (!nextTransition) {
57766
- if (transition[RECORD_SYMBOL] & 1048576) {
57767
- parentRecordId = transition[RECORD_SYMBOL] & 65535;
57768
- }
57769
- nextTransition = transition[key] = /* @__PURE__ */ Object.create(null);
57770
- newTransitions++;
57771
- }
57772
- transition = nextTransition;
57773
- length++;
57774
- }
57775
- }
57776
- let recordId = transition[RECORD_SYMBOL];
57777
- if (recordId !== void 0) {
57778
- recordId &= 65535;
57779
- target[position++] = 217;
57780
- target[position++] = recordId >> 8 | 224;
57781
- target[position++] = recordId & 255;
57782
- } else {
57783
- if (!keys2)
57784
- keys2 = transition.__keys__ || (transition.__keys__ = Object.keys(object2));
57785
- if (parentRecordId === void 0) {
57786
- recordId = structures.nextId++;
57787
- if (!recordId) {
57788
- recordId = 0;
57789
- structures.nextId = 1;
57790
- }
57791
- if (recordId >= MAX_STRUCTURES) {
57792
- structures.nextId = (recordId = maxSharedStructures) + 1;
57793
- }
57794
- } else {
57795
- recordId = parentRecordId;
57796
- }
57797
- structures[recordId] = keys2;
57798
- if (recordId < maxSharedStructures) {
57799
- target[position++] = 217;
57800
- target[position++] = recordId >> 8 | 224;
57801
- target[position++] = recordId & 255;
57802
- transition = structures.transitions;
57803
- for (let i = 0; i < length; i++) {
57804
- if (transition[RECORD_SYMBOL] === void 0 || transition[RECORD_SYMBOL] & 1048576)
57805
- transition[RECORD_SYMBOL] = recordId;
57806
- transition = transition[keys2[i]];
57807
- }
57808
- transition[RECORD_SYMBOL] = recordId | 1048576;
57809
- hasSharedUpdate = true;
57810
- } else {
57811
- transition[RECORD_SYMBOL] = recordId;
57812
- targetView.setUint32(position, 3655335680);
57813
- position += 3;
57814
- if (newTransitions)
57815
- transitionsCount += serializationsSinceTransitionRebuild * newTransitions;
57816
- if (recordIdsToRemove.length >= MAX_STRUCTURES - maxSharedStructures)
57817
- recordIdsToRemove.shift()[RECORD_SYMBOL] = void 0;
57818
- recordIdsToRemove.push(transition);
57819
- writeArrayHeader(length + 2);
57820
- encode2(57344 + recordId);
57821
- encode2(keys2);
57822
- if (skipValues) return;
57823
- for (let key in object2)
57824
- if (typeof object2.hasOwnProperty !== "function" || object2.hasOwnProperty(key))
57825
- encode2(object2[key]);
57826
- return;
57827
- }
57828
- }
57829
- if (length < 24) {
57830
- target[position++] = 128 | length;
57831
- } else {
57832
- writeArrayHeader(length);
57833
- }
57834
- if (skipValues) return;
57835
- for (let key in object2)
57836
- if (typeof object2.hasOwnProperty !== "function" || object2.hasOwnProperty(key))
57837
- encode2(object2[key]);
57838
- };
57839
- const makeRoom = (end) => {
57840
- let newSize;
57841
- if (end > 16777216) {
57842
- if (end - start > MAX_BUFFER_SIZE)
57843
- throw new Error("Encoded buffer would be larger than maximum buffer size");
57844
- newSize = Math.min(
57845
- MAX_BUFFER_SIZE,
57846
- Math.round(Math.max((end - start) * (end > 67108864 ? 1.25 : 2), 4194304) / 4096) * 4096
57847
- );
57848
- } else
57849
- newSize = (Math.max(end - start << 2, target.length - 1) >> 12) + 1 << 12;
57850
- let newBuffer = new ByteArrayAllocate(newSize);
57851
- targetView = new DataView(newBuffer.buffer, 0, newSize);
57852
- if (target.copy)
57853
- target.copy(newBuffer, 0, start, end);
57854
- else
57855
- newBuffer.set(target.slice(start, end));
57856
- position -= start;
57857
- start = 0;
57858
- safeEnd = newBuffer.length - 10;
57859
- return target = newBuffer;
57860
- };
57861
- let chunkThreshold = 100;
57862
- let continuedChunkThreshold = 1e3;
57863
- this.encodeAsIterable = function(value, options2) {
57864
- return startEncoding(value, options2, encodeObjectAsIterable);
57865
- };
57866
- this.encodeAsAsyncIterable = function(value, options2) {
57867
- return startEncoding(value, options2, encodeObjectAsAsyncIterable);
57868
- };
57869
- function* encodeObjectAsIterable(object2, iterateProperties, finalIterable) {
57870
- let constructor = object2.constructor;
57871
- if (constructor === Object) {
57872
- let useRecords = encoder.useRecords !== false;
57873
- if (useRecords)
57874
- writeObject(object2, true);
57875
- else
57876
- writeEntityLength(Object.keys(object2).length, 160);
57877
- for (let key in object2) {
57878
- let value = object2[key];
57879
- if (!useRecords) encode2(key);
57880
- if (value && typeof value === "object") {
57881
- if (iterateProperties[key])
57882
- yield* encodeObjectAsIterable(value, iterateProperties[key]);
57883
- else
57884
- yield* tryEncode(value, iterateProperties, key);
57885
- } else encode2(value);
57886
- }
57887
- } else if (constructor === Array) {
57888
- let length = object2.length;
57889
- writeArrayHeader(length);
57890
- for (let i = 0; i < length; i++) {
57891
- let value = object2[i];
57892
- if (value && (typeof value === "object" || position - start > chunkThreshold)) {
57893
- if (iterateProperties.element)
57894
- yield* encodeObjectAsIterable(value, iterateProperties.element);
57895
- else
57896
- yield* tryEncode(value, iterateProperties, "element");
57897
- } else encode2(value);
57898
- }
57899
- } else if (object2[Symbol.iterator] && !object2.buffer) {
57900
- target[position++] = 159;
57901
- for (let value of object2) {
57902
- if (value && (typeof value === "object" || position - start > chunkThreshold)) {
57903
- if (iterateProperties.element)
57904
- yield* encodeObjectAsIterable(value, iterateProperties.element);
57905
- else
57906
- yield* tryEncode(value, iterateProperties, "element");
57907
- } else encode2(value);
57908
- }
57909
- target[position++] = 255;
57910
- } else if (isBlob(object2)) {
57911
- writeEntityLength(object2.size, 64);
57912
- yield target.subarray(start, position);
57913
- yield object2;
57914
- restartEncoding();
57915
- } else if (object2[Symbol.asyncIterator]) {
57916
- target[position++] = 159;
57917
- yield target.subarray(start, position);
57918
- yield object2;
57919
- restartEncoding();
57920
- target[position++] = 255;
57921
- } else {
57922
- encode2(object2);
57923
- }
57924
- if (finalIterable && position > start) yield target.subarray(start, position);
57925
- else if (position - start > chunkThreshold) {
57926
- yield target.subarray(start, position);
57927
- restartEncoding();
57928
- }
57929
- }
57930
- function* tryEncode(value, iterateProperties, key) {
57931
- let restart = position - start;
57932
- try {
57933
- encode2(value);
57934
- if (position - start > chunkThreshold) {
57935
- yield target.subarray(start, position);
57936
- restartEncoding();
57937
- }
57938
- } catch (error2) {
57939
- if (error2.iteratorNotHandled) {
57940
- iterateProperties[key] = {};
57941
- position = start + restart;
57942
- yield* encodeObjectAsIterable.call(this, value, iterateProperties[key]);
57943
- } else throw error2;
57944
- }
57945
- }
57946
- function restartEncoding() {
57947
- chunkThreshold = continuedChunkThreshold;
57948
- encoder.encode(null, THROW_ON_ITERABLE);
57949
- }
57950
- function startEncoding(value, options2, encodeIterable) {
57951
- if (options2 && options2.chunkThreshold)
57952
- chunkThreshold = continuedChunkThreshold = options2.chunkThreshold;
57953
- else
57954
- chunkThreshold = 100;
57955
- if (value && typeof value === "object") {
57956
- encoder.encode(null, THROW_ON_ITERABLE);
57957
- return encodeIterable(value, encoder.iterateProperties || (encoder.iterateProperties = {}), true);
57958
- }
57959
- return [encoder.encode(value)];
57960
- }
57961
- async function* encodeObjectAsAsyncIterable(value, iterateProperties) {
57962
- for (let encodedValue of encodeObjectAsIterable(value, iterateProperties, true)) {
57963
- let constructor = encodedValue.constructor;
57964
- if (constructor === ByteArray || constructor === Uint8Array)
57965
- yield encodedValue;
57966
- else if (isBlob(encodedValue)) {
57967
- let reader = encodedValue.stream().getReader();
57968
- let next2;
57969
- while (!(next2 = await reader.read()).done) {
57970
- yield next2.value;
57971
- }
57972
- } else if (encodedValue[Symbol.asyncIterator]) {
57973
- for await (let asyncValue of encodedValue) {
57974
- restartEncoding();
57975
- if (asyncValue)
57976
- yield* encodeObjectAsAsyncIterable(asyncValue, iterateProperties.async || (iterateProperties.async = {}));
57977
- else yield encoder.encode(asyncValue);
57978
- }
57979
- } else {
57980
- yield encodedValue;
57981
- }
57982
- }
57983
- }
57984
- }
57985
- useBuffer(buffer2) {
57986
- target = buffer2;
57987
- targetView = new DataView(target.buffer, target.byteOffset, target.byteLength);
57988
- position = 0;
57989
- }
57990
- clearSharedData() {
57991
- if (this.structures)
57992
- this.structures = [];
57993
- if (this.sharedValues)
57994
- this.sharedValues = void 0;
57995
- }
57996
- updateSharedData() {
57997
- let lastVersion = this.sharedVersion || 0;
57998
- this.sharedVersion = lastVersion + 1;
57999
- let structuresCopy = this.structures.slice(0);
58000
- let sharedData = new SharedData(structuresCopy, this.sharedValues, this.sharedVersion);
58001
- let saveResults = this.saveShared(
58002
- sharedData,
58003
- (existingShared) => (existingShared && existingShared.version || 0) == lastVersion
58004
- );
58005
- if (saveResults === false) {
58006
- sharedData = this.getShared() || {};
58007
- this.structures = sharedData.structures || [];
58008
- this.sharedValues = sharedData.packedValues;
58009
- this.sharedVersion = sharedData.version;
58010
- this.structures.nextId = this.structures.length;
58011
- } else {
58012
- structuresCopy.forEach((structure, i) => this.structures[i] = structure);
58013
- }
58014
- return saveResults;
58015
- }
58016
- }
58017
- function writeEntityLength(length, majorValue) {
58018
- if (length < 24)
58019
- target[position++] = majorValue | length;
58020
- else if (length < 256) {
58021
- target[position++] = majorValue | 24;
58022
- target[position++] = length;
58023
- } else if (length < 65536) {
58024
- target[position++] = majorValue | 25;
58025
- target[position++] = length >> 8;
58026
- target[position++] = length & 255;
58027
- } else {
58028
- target[position++] = majorValue | 26;
58029
- targetView.setUint32(position, length);
58030
- position += 4;
58031
- }
58032
- }
58033
- class SharedData {
58034
- constructor(structures, values, version2) {
58035
- this.structures = structures;
58036
- this.packedValues = values;
58037
- this.version = version2;
58038
- }
58039
- }
58040
- function writeArrayHeader(length) {
58041
- if (length < 24)
58042
- target[position++] = 128 | length;
58043
- else if (length < 256) {
58044
- target[position++] = 152;
58045
- target[position++] = length;
58046
- } else if (length < 65536) {
58047
- target[position++] = 153;
58048
- target[position++] = length >> 8;
58049
- target[position++] = length & 255;
58050
- } else {
58051
- target[position++] = 154;
58052
- targetView.setUint32(position, length);
58053
- position += 4;
58054
- }
58055
- }
58056
- const BlobConstructor = typeof Blob === "undefined" ? function() {
58057
- } : Blob;
58058
- function isBlob(object2) {
58059
- if (object2 instanceof BlobConstructor)
58060
- return true;
58061
- let tag = object2[Symbol.toStringTag];
58062
- return tag === "Blob" || tag === "File";
58063
- }
58064
- function findRepetitiveStrings(value, packedValues2) {
58065
- switch (typeof value) {
58066
- case "string":
58067
- if (value.length > 3) {
58068
- if (packedValues2.objectMap[value] > -1 || packedValues2.values.length >= packedValues2.maxValues)
58069
- return;
58070
- let packedStatus = packedValues2.get(value);
58071
- if (packedStatus) {
58072
- if (++packedStatus.count == 2) {
58073
- packedValues2.values.push(value);
58074
- }
58075
- } else {
58076
- packedValues2.set(value, {
58077
- count: 1
58078
- });
58079
- if (packedValues2.samplingPackedValues) {
58080
- let status = packedValues2.samplingPackedValues.get(value);
58081
- if (status)
58082
- status.count++;
58083
- else
58084
- packedValues2.samplingPackedValues.set(value, {
58085
- count: 1
58086
- });
58087
- }
58088
- }
58089
- }
58090
- break;
58091
- case "object":
58092
- if (value) {
58093
- if (value instanceof Array) {
58094
- for (let i = 0, l = value.length; i < l; i++) {
58095
- findRepetitiveStrings(value[i], packedValues2);
58096
- }
58097
- } else {
58098
- let includeKeys = !packedValues2.encoder.useRecords;
58099
- for (var key in value) {
58100
- if (value.hasOwnProperty(key)) {
58101
- if (includeKeys)
58102
- findRepetitiveStrings(key, packedValues2);
58103
- findRepetitiveStrings(value[key], packedValues2);
58104
- }
58105
- }
58106
- }
58107
- }
58108
- break;
58109
- case "function":
58110
- console.log(value);
58111
- }
58112
- }
58113
- const isLittleEndianMachine = new Uint8Array(new Uint16Array([1]).buffer)[0] == 1;
58114
- extensionClasses = [
58115
- Date,
58116
- Set,
58117
- Error,
58118
- RegExp,
58119
- Tag,
58120
- ArrayBuffer,
58121
- Uint8Array,
58122
- Uint8ClampedArray,
58123
- Uint16Array,
58124
- Uint32Array,
58125
- typeof BigUint64Array == "undefined" ? function() {
58126
- } : BigUint64Array,
58127
- Int8Array,
58128
- Int16Array,
58129
- Int32Array,
58130
- typeof BigInt64Array == "undefined" ? function() {
58131
- } : BigInt64Array,
58132
- Float32Array,
58133
- Float64Array,
58134
- SharedData
58135
- ];
58136
- extensions = [
58137
- {
58138
- // Date
58139
- tag: 1,
58140
- encode(date2, encode2) {
58141
- let seconds = date2.getTime() / 1e3;
58142
- if ((this.useTimestamp32 || date2.getMilliseconds() === 0) && seconds >= 0 && seconds < 4294967296) {
58143
- target[position++] = 26;
58144
- targetView.setUint32(position, seconds);
58145
- position += 4;
58146
- } else {
58147
- target[position++] = 251;
58148
- targetView.setFloat64(position, seconds);
58149
- position += 8;
58150
- }
58151
- }
58152
- },
58153
- {
58154
- // Set
58155
- tag: 258,
58156
- // https://github.com/input-output-hk/cbor-sets-spec/blob/master/CBOR_SETS.md
58157
- encode(set, encode2) {
58158
- let array2 = Array.from(set);
58159
- encode2(array2);
58160
- }
58161
- },
58162
- {
58163
- // Error
58164
- tag: 27,
58165
- // http://cbor.schmorp.de/generic-object
58166
- encode(error2, encode2) {
58167
- encode2([error2.name, error2.message]);
58168
- }
58169
- },
58170
- {
58171
- // RegExp
58172
- tag: 27,
58173
- // http://cbor.schmorp.de/generic-object
58174
- encode(regex, encode2) {
58175
- encode2(["RegExp", regex.source, regex.flags]);
58176
- }
58177
- },
58178
- {
58179
- // Tag
58180
- getTag(tag) {
58181
- return tag.tag;
58182
- },
58183
- encode(tag, encode2) {
58184
- encode2(tag.value);
58185
- }
58186
- },
58187
- {
58188
- // ArrayBuffer
58189
- encode(arrayBuffer, encode2, makeRoom) {
58190
- writeBuffer(arrayBuffer, makeRoom);
58191
- }
58192
- },
58193
- {
58194
- // Uint8Array
58195
- getTag(typedArray2) {
58196
- if (typedArray2.constructor === Uint8Array) {
58197
- if (this.tagUint8Array || hasNodeBuffer && this.tagUint8Array !== false)
58198
- return 64;
58199
- }
58200
- },
58201
- encode(typedArray2, encode2, makeRoom) {
58202
- writeBuffer(typedArray2, makeRoom);
58203
- }
58204
- },
58205
- typedArrayEncoder(68, 1),
58206
- typedArrayEncoder(69, 2),
58207
- typedArrayEncoder(70, 4),
58208
- typedArrayEncoder(71, 8),
58209
- typedArrayEncoder(72, 1),
58210
- typedArrayEncoder(77, 2),
58211
- typedArrayEncoder(78, 4),
58212
- typedArrayEncoder(79, 8),
58213
- typedArrayEncoder(85, 4),
58214
- typedArrayEncoder(86, 8),
58215
- {
58216
- encode(sharedData, encode2) {
58217
- let packedValues2 = sharedData.packedValues || [];
58218
- let sharedStructures = sharedData.structures || [];
58219
- if (packedValues2.values.length > 0) {
58220
- target[position++] = 216;
58221
- target[position++] = 51;
58222
- writeArrayHeader(4);
58223
- let valuesArray = packedValues2.values;
58224
- encode2(valuesArray);
58225
- writeArrayHeader(0);
58226
- writeArrayHeader(0);
58227
- packedObjectMap = Object.create(sharedPackedObjectMap || null);
58228
- for (let i = 0, l = valuesArray.length; i < l; i++) {
58229
- packedObjectMap[valuesArray[i]] = i;
58230
- }
58231
- }
58232
- if (sharedStructures) {
58233
- targetView.setUint32(position, 3655335424);
58234
- position += 3;
58235
- let definitions = sharedStructures.slice(0);
58236
- definitions.unshift(57344);
58237
- definitions.push(new Tag(sharedData.version, 1399353956));
58238
- encode2(definitions);
58239
- } else
58240
- encode2(new Tag(sharedData.version, 1399353956));
58241
- }
58242
- }
58243
- ];
58244
- function typedArrayEncoder(tag, size2) {
58245
- if (!isLittleEndianMachine && size2 > 1)
58246
- tag -= 4;
58247
- return {
58248
- tag,
58249
- encode: function writeExtBuffer(typedArray2, encode2) {
58250
- let length = typedArray2.byteLength;
58251
- let offset2 = typedArray2.byteOffset || 0;
58252
- let buffer2 = typedArray2.buffer || typedArray2;
58253
- encode2(hasNodeBuffer ? Buffer$1.from(buffer2, offset2, length) : new Uint8Array(buffer2, offset2, length));
58254
- }
58255
- };
58256
- }
58257
- function writeBuffer(buffer2, makeRoom) {
58258
- let length = buffer2.byteLength;
58259
- if (length < 24) {
58260
- target[position++] = 64 + length;
58261
- } else if (length < 256) {
58262
- target[position++] = 88;
58263
- target[position++] = length;
58264
- } else if (length < 65536) {
58265
- target[position++] = 89;
58266
- target[position++] = length >> 8;
58267
- target[position++] = length & 255;
58268
- } else {
58269
- target[position++] = 90;
58270
- targetView.setUint32(position, length);
58271
- position += 4;
58272
- }
58273
- if (position + length >= target.length) {
58274
- makeRoom(position + length);
58275
- }
58276
- target.set(buffer2.buffer ? buffer2 : new Uint8Array(buffer2), position);
58277
- position += length;
58278
- }
58279
- function insertIds(serialized, idsToInsert) {
58280
- let nextId;
58281
- let distanceToMove = idsToInsert.length * 2;
58282
- let lastEnd = serialized.length - distanceToMove;
58283
- idsToInsert.sort((a2, b2) => a2.offset > b2.offset ? 1 : -1);
58284
- for (let id = 0; id < idsToInsert.length; id++) {
58285
- let referee = idsToInsert[id];
58286
- referee.id = id;
58287
- for (let position2 of referee.references) {
58288
- serialized[position2++] = id >> 8;
58289
- serialized[position2] = id & 255;
58290
- }
58291
- }
58292
- while (nextId = idsToInsert.pop()) {
58293
- let offset2 = nextId.offset;
58294
- serialized.copyWithin(offset2 + distanceToMove, offset2, lastEnd);
58295
- distanceToMove -= 2;
58296
- let position2 = offset2 + distanceToMove;
58297
- serialized[position2++] = 216;
58298
- serialized[position2++] = 28;
58299
- lastEnd = offset2;
58300
- }
58301
- return serialized;
58302
- }
58303
- function writeBundles(start, encode2) {
58304
- targetView.setUint32(bundledStrings.position + start, position - bundledStrings.position - start + 1);
58305
- let writeStrings = bundledStrings;
58306
- bundledStrings = null;
58307
- encode2(writeStrings[0]);
58308
- encode2(writeStrings[1]);
58309
- }
58310
- let defaultEncoder = new Encoder({ useRecords: false });
58311
- const encode = defaultEncoder.encode;
58312
- defaultEncoder.encodeAsIterable;
58313
- defaultEncoder.encodeAsAsyncIterable;
58314
- const REUSE_BUFFER_MODE = 512;
58315
- const RESET_BUFFER_MODE = 1024;
58316
- const THROW_ON_ITERABLE = 2048;
58317
- function apiBase() {
58318
- if (typeof window === "undefined") return "";
58319
- return window.__WORKFLOW_BASENAME__ ?? "";
58320
- }
58321
- async function rpc(method, params) {
58322
- var _a3;
58323
- const res = await fetch(`${apiBase()}/api/rpc`, {
58324
- method: "POST",
58325
- headers: {
58326
- "Content-Type": "application/cbor",
58327
- Accept: "application/cbor"
58328
- },
58329
- body: new Uint8Array(encode({ method, params: params ?? {} }))
58330
- });
58331
- if (!res.ok) {
58332
- try {
58333
- const buffer22 = await res.arrayBuffer();
58334
- const errorBody = decode(new Uint8Array(buffer22));
58335
- if ((_a3 = errorBody == null ? void 0 : errorBody.error) == null ? void 0 : _a3.message) {
58336
- throw new Error(errorBody.error.message);
58337
- }
58338
- } catch (decodeErr) {
58339
- if (decodeErr instanceof Error && decodeErr.message !== `RPC call ${method} failed`) {
58340
- throw decodeErr;
58341
- }
58342
- }
58343
- throw new Error(
58344
- `RPC call ${method} failed: ${res.status} ${res.statusText}`
58345
- );
58346
- }
58347
- const buffer2 = await res.arrayBuffer();
58348
- return decode(new Uint8Array(buffer2));
58349
- }
58350
- async function fetchRuns(worldEnv, params) {
58351
- return rpc("fetchRuns", { worldEnv, params });
58352
- }
58353
- async function fetchRun(worldEnv, runId, resolveData = "all") {
58354
- return rpc("fetchRun", { worldEnv, runId, resolveData });
58355
- }
58356
- async function fetchStep(worldEnv, runId, stepId, resolveData = "all") {
58357
- return rpc("fetchStep", { worldEnv, runId, stepId, resolveData });
58358
- }
58359
- async function fetchEvents(worldEnv, runId, params) {
58360
- return rpc("fetchEvents", { worldEnv, runId, params });
58361
- }
58362
- async function fetchEvent(worldEnv, runId, eventId, resolveData = "all") {
58363
- return rpc("fetchEvent", { worldEnv, runId, eventId, resolveData });
58364
- }
58365
- async function fetchEventsByCorrelationId(worldEnv, correlationId, params) {
58366
- return rpc("fetchEventsByCorrelationId", {
58367
- worldEnv,
58368
- correlationId,
58369
- params
58370
- });
58371
- }
58372
- async function fetchHooks(worldEnv, params) {
58373
- return rpc("fetchHooks", { worldEnv, params });
58374
- }
58375
- async function fetchHookToken(worldEnv, runId, hookId) {
58376
- return rpc("fetchHookToken", { worldEnv, runId, hookId });
58377
- }
58378
- async function fetchHook(worldEnv, hookId, resolveData = "all") {
58379
- return rpc("fetchHook", { worldEnv, hookId, resolveData });
58380
- }
58381
- async function cancelRun(worldEnv, runId) {
58382
- return rpc("cancelRun", { worldEnv, runId });
58383
- }
58384
- async function bulkCancelRuns(worldEnv, runIds) {
58385
- return rpc("bulkCancelRuns", { worldEnv, runIds });
58386
- }
58387
- async function recreateRun(worldEnv, runId, deploymentId) {
58388
- return rpc("recreateRun", { worldEnv, runId, deploymentId });
58389
- }
58390
- async function reenqueueRun(worldEnv, runId) {
58391
- return rpc("reenqueueRun", { worldEnv, runId });
58392
- }
58393
- async function wakeUpRun(worldEnv, runId, options) {
58394
- return rpc("wakeUpRun", { worldEnv, runId, options });
58395
- }
58396
- async function resumeHook(worldEnv, token, payload) {
58397
- return rpc("resumeHook", { worldEnv, token, payload });
58398
- }
58399
- async function fetchStreams(worldEnv, runId) {
58400
- return rpc("fetchStreams", { worldEnv, runId });
58401
- }
58402
- async function fetchWorkflowsManifest(worldEnv) {
58403
- return rpc("fetchWorkflowsManifest", { worldEnv });
58404
- }
58405
- async function runHealthCheck(worldEnv, options) {
58406
- return rpc("runHealthCheck", { worldEnv, options });
58407
- }
58408
- async function getEncryptionKeyForRun(worldEnv, runId) {
58409
- return rpc("getEncryptionKeyForRun", { worldEnv, runId });
58410
- }
58411
55969
  const mermaidWFAXDIZX = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
58412
55970
  __proto__: null,
58413
55971
  Mermaid: co
58414
55972
  }, Symbol.toStringTag, { value: "Module" }));
58415
55973
  export {
58416
- isStepEventType as $,
58417
- Presence as A,
55974
+ isWaitEventType as $,
55975
+ composeEventHandlers as A,
58418
55976
  Button as B,
58419
- Check as C,
58420
- DismissableLayer as D,
58421
- PopperContent as E,
55977
+ ChevronRight as C,
55978
+ Portal as D,
55979
+ Presence as E,
58422
55980
  FocusScope as F,
58423
- useCallbackRef as G,
58424
- createSlot as H,
55981
+ DismissableLayer as G,
55982
+ PopperContent as H,
58425
55983
  In as I,
58426
- ChevronDown as J,
58427
- useSize as K,
58428
- BULK_CANCEL_MAX_RUN_IDS as L,
58429
- fetchRun as M,
58430
- cva as N,
58431
- fetchWorkflowsManifest as O,
55984
+ useCallbackRef as J,
55985
+ createSlot as K,
55986
+ ChevronDown as L,
55987
+ useSize as M,
55988
+ BULK_CANCEL_MAX_RUN_IDS as N,
55989
+ cva as O,
58432
55990
  Primitive as P,
58433
55991
  isSlotEventId as Q,
58434
55992
  R,
58435
- ServerConfigProvider as S,
55993
+ Spinner as S,
58436
55994
  Tooltip as T,
58437
55995
  classifyEntityEvent as U,
58438
55996
  VISUALLY_HIDDEN_STYLES as V,
58439
55997
  Wc as W,
58440
55998
  TERMINAL_EVENT_CLASSES as X,
58441
55999
  isSealedNoopEvent as Y,
58442
- formatDurationPrecise as Z,
56000
+ isStepEventType as Z,
58443
56001
  __vitePreload as _,
58444
- TooltipTrigger as a,
58445
- fetchStep as a$,
58446
- isWaitEventType as a0,
58447
- isHookLifecycleEventType as a1,
58448
- isEncryptedMarker as a2,
58449
- isTerminalStepEventType as a3,
58450
- isRunCreationEvent as a4,
58451
- CopyButton as a5,
58452
- CopyableDataBlock as a6,
58453
- CollapsibleRoot as a7,
58454
- CollapsibleTrigger as a8,
58455
- CollapsibleContent as a9,
58456
- hasEncryptedFields as aA,
58457
- useSidebarDataOptional as aB,
58458
- isTerminalWorkflowRunStatus as aC,
58459
- useActiveSpan as aD,
58460
- useSidebarData as aE,
58461
- ActiveSpanProvider as aF,
58462
- useReducedMotion as aG,
58463
- searchSpans as aH,
58464
- computeRootBounds as aI,
58465
- computeTimeMarkers as aJ,
58466
- clampViewportToRoot as aK,
58467
- getHighResInMs as aL,
58468
- scrollRowIntoView as aM,
58469
- TIMELINE_PADDING_PX as aN,
58470
- Minimap as aO,
58471
- Timeline as aP,
58472
- TimelineHeader as aQ,
58473
- wheelZoomScaleFactor as aR,
58474
- wheelDeltaToPixels as aS,
58475
- SidebarDataProvider as aT,
58476
- hydrateResourceIOAsync as aU,
58477
- createStateResolver as aV,
58478
- deriveRunPayloadKeys as aW,
58479
- decodePayloadWithKey as aX,
58480
- stateSourceId as aY,
58481
- getWebRevivers as aZ,
58482
- fetchHook as a_,
58483
- RESERVED_ATTRIBUTE_KEY_PREFIX as aa,
58484
- IconButton as ab,
58485
- Lock as ac,
58486
- getEventDataRefFields as ad,
58487
- Collapsible as ae,
58488
- Skeleton as af,
58489
- DecryptClickContext as ag,
58490
- DataInspector as ah,
58491
- serializeForClipboard as ai,
58492
- useRowWindow as aj,
58493
- isSpanDimmedBySearch as ak,
58494
- ROW_HEIGHT_PX as al,
58495
- getSpanDurationMs as am,
58496
- isSpanErrored as an,
58497
- isSpanCancelled as ao,
58498
- TooltipProvider as ap,
58499
- TimestampTooltip as aq,
58500
- ContextCardProvider as ar,
58501
- es$1 as as,
58502
- Ui as at,
58503
- RunClickContext as au,
58504
- StreamClickContext as av,
58505
- isExpiredMarker as aw,
58506
- isDoStreamStep as ax,
58507
- extractConversation as ay,
58508
- EncryptedDataBlock as az,
58509
- TooltipContent as b,
58510
- hydrateResourceIO as b0,
58511
- fetchStreams as b1,
58512
- apiBase as b2,
58513
- fetchEvent as b3,
58514
- fetchEventsByCorrelationId as b4,
58515
- buttonVariants as b5,
58516
- Slot as b6,
58517
- isEncryptedData as b7,
58518
- hydrateData as b8,
58519
- decrypt as b9,
58520
- getStreamImageType as ba,
58521
- SerializationFormat as bb,
58522
- getEncryptionKeyForRun as bc,
58523
- StreamViewerSkeleton as bd,
58524
- StreamViewer as be,
58525
- startHookId as bf,
58526
- dispatchDiscreteCustomEvent as bg,
58527
- useFocusScopeBranch as bh,
58528
- useFocusScopeBranchRegistry as bi,
58529
- FocusScopeBranchProvider as bj,
58530
- VERCEL_403_ERROR_MESSAGE as bk,
58531
- fetchRuns as bl,
58532
- bulkCancelRuns as bm,
58533
- reenqueueRun as bn,
58534
- wakeUpRun as bo,
58535
- resumeHook as bp,
58536
- fetchHookToken as bq,
58537
- cancelRun as br,
58538
- recreateRun as bs,
58539
- formatDuration as bt,
58540
- useDismissableLayerSurface as bu,
56002
+ cn$2 as a,
56003
+ StreamViewerSkeleton as a$,
56004
+ isHookLifecycleEventType as a0,
56005
+ isEncryptedMarker as a1,
56006
+ isTerminalStepEventType as a2,
56007
+ isRunCreationEvent as a3,
56008
+ CopyButton as a4,
56009
+ CopyableDataBlock as a5,
56010
+ CollapsibleRoot as a6,
56011
+ CollapsibleTrigger as a7,
56012
+ CollapsibleContent as a8,
56013
+ RESERVED_ATTRIBUTE_KEY_PREFIX as a9,
56014
+ searchSpans as aA,
56015
+ computeRootBounds as aB,
56016
+ computeTimeMarkers as aC,
56017
+ clampViewportToRoot as aD,
56018
+ getHighResInMs as aE,
56019
+ scrollRowIntoView as aF,
56020
+ TIMELINE_PADDING_PX as aG,
56021
+ Minimap as aH,
56022
+ Timeline as aI,
56023
+ TimelineHeader as aJ,
56024
+ wheelZoomScaleFactor as aK,
56025
+ wheelDeltaToPixels as aL,
56026
+ SidebarDataProvider as aM,
56027
+ hydrateResourceIOAsync as aN,
56028
+ createStateResolver as aO,
56029
+ deriveRunPayloadKeys as aP,
56030
+ decodePayloadWithKey as aQ,
56031
+ stateSourceId as aR,
56032
+ getWebRevivers as aS,
56033
+ hydrateResourceIO as aT,
56034
+ buttonVariants as aU,
56035
+ Slot as aV,
56036
+ isEncryptedData as aW,
56037
+ hydrateData as aX,
56038
+ decrypt as aY,
56039
+ getStreamImageType as aZ,
56040
+ SerializationFormat as a_,
56041
+ IconButton as aa,
56042
+ Lock as ab,
56043
+ getEventDataRefFields as ac,
56044
+ Collapsible as ad,
56045
+ Skeleton as ae,
56046
+ DecryptClickContext as af,
56047
+ DataInspector as ag,
56048
+ serializeForClipboard as ah,
56049
+ TooltipProvider as ai,
56050
+ TimestampTooltip as aj,
56051
+ ContextCardProvider as ak,
56052
+ es$1 as al,
56053
+ Ui as am,
56054
+ RunClickContext as an,
56055
+ StreamClickContext as ao,
56056
+ isExpiredMarker as ap,
56057
+ isDoStreamStep as aq,
56058
+ extractConversation as ar,
56059
+ EncryptedDataBlock as as,
56060
+ hasEncryptedFields as at,
56061
+ useSidebarDataOptional as au,
56062
+ isTerminalWorkflowRunStatus as av,
56063
+ useActiveSpan as aw,
56064
+ useSidebarData as ax,
56065
+ ActiveSpanProvider as ay,
56066
+ useReducedMotion as az,
56067
+ ROW_HEIGHT_PX as b,
56068
+ StreamViewer as b0,
56069
+ startHookId as b1,
56070
+ dispatchDiscreteCustomEvent as b2,
56071
+ useFocusScopeBranch as b3,
56072
+ useFocusScopeBranchRegistry as b4,
56073
+ FocusScopeBranchProvider as b5,
56074
+ VERCEL_403_ERROR_MESSAGE as b6,
56075
+ formatDuration as b7,
56076
+ useDismissableLayerSurface as b8,
58541
56077
  createLucideIcon as c,
58542
- runHealthCheck as d,
58543
- cn$2 as e,
58544
- Toaster as f,
58545
- TooltipProvider$1 as g,
58546
- useToast as h,
58547
- fetchHooks as i,
58548
- Spinner as j,
58549
- Copy as k,
58550
- ChevronRight as l,
58551
- fetchEvents as m,
58552
- useComposedRefs as n,
58553
- useLayoutEffect2 as o,
58554
- useControllableState as p,
58555
- useId as q,
56078
+ TooltipTrigger as d,
56079
+ TooltipContent as e,
56080
+ isSpanErrored as f,
56081
+ getSpanDurationMs as g,
56082
+ isSpanCancelled as h,
56083
+ isSpanDimmedBySearch as i,
56084
+ formatDurationPrecise as j,
56085
+ Toaster as k,
56086
+ TooltipProvider$1 as l,
56087
+ useToast as m,
56088
+ Check as n,
56089
+ Copy as o,
56090
+ useComposedRefs as p,
56091
+ useLayoutEffect2 as q,
58556
56092
  registerZstdDecoder as r,
58557
- Popper as s,
56093
+ useControllableState as s,
58558
56094
  toast as t,
58559
- useServerConfig as u,
58560
- createPopperScope as v,
58561
- createContextScope as w,
58562
- PopperAnchor as x,
58563
- composeEventHandlers as y,
58564
- Portal as z
56095
+ useRowWindow as u,
56096
+ useId as v,
56097
+ Popper as w,
56098
+ createPopperScope as x,
56099
+ createContextScope as y,
56100
+ PopperAnchor as z
58565
56101
  };