likec4 1.33.0 → 1.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ import React__default, { useState, Fragment, createContext, useContext, useRef,
4
4
  import { createRoot } from "react-dom/client";
5
5
  import * as ReactDOM from "react-dom";
6
6
  import ReactDOM__default, { createPortal, flushSync } from "react-dom";
7
- import { ComponentName, useHashHistory, withOverviewGraph, krokiPumlSvgUrl, isDevelopment, krokiD2SvgUrl, basepath } from "./const.js";
7
+ import { pageTitle, ComponentName, useHashHistory, withOverviewGraph, krokiPumlSvgUrl, isDevelopment, krokiD2SvgUrl, basepath } from "./const.js";
8
8
  import { projects, isSingleProject } from "likec4:projects";
9
9
  import { $likec4model, $likec4data, IconRenderer as IconRenderer$1, projectId } from "likec4:single-project";
10
10
  import { isTagColorSpecified, invariant as invariant$2, hasAtLeast, nonexhaustive, isStepEdgeId, extractStep, nameFromFqn, nonNullable, defaultTheme, ElementShapes, toArray, RichText, ifind, DefaultMap, ancestorsFqn, isAncestor, sortParentsFirst, ifilter, Queue, whereOperatorAsPredicate, GroupElementKind, delay as delay$1, BBox, getParallelStepsPrefix, isDeploymentView, compareNatural as compareNatural$1, isDescendantOf } from "@likec4/core";
@@ -2873,6 +2873,7 @@ function extractStyleProps(others) {
2873
2873
  pe,
2874
2874
  ps,
2875
2875
  bd,
2876
+ bdrs,
2876
2877
  bg,
2877
2878
  c: c2,
2878
2879
  opacity,
@@ -2960,6 +2961,7 @@ function extractStyleProps(others) {
2960
2961
  inset: inset2,
2961
2962
  display,
2962
2963
  flex,
2964
+ bdrs,
2963
2965
  hiddenFrom,
2964
2966
  visibleFrom,
2965
2967
  lightHidden,
@@ -6888,9 +6890,24 @@ function usePopover(options) {
6888
6890
  strategy: options.strategy,
6889
6891
  placement: options.preventPositionChangeWhenVisible ? options.positionRef.current : options.position,
6890
6892
  middleware: getPopoverMiddlewares(options, () => floating, env),
6891
- whileElementsMounted: autoUpdate
6893
+ // Only use whileElementsMounted when elements are conditionally rendered (not keepMounted)
6894
+ // When keepMounted=true, elements are hidden with CSS and we need manual autoUpdate control
6895
+ whileElementsMounted: options.keepMounted ? void 0 : autoUpdate
6892
6896
  });
6893
- return useDidUpdate(() => {
6897
+ return useEffect(() => {
6898
+ if (!(!options.keepMounted || !floating.refs.reference.current || !floating.refs.floating.current) && _opened)
6899
+ return autoUpdate(
6900
+ floating.refs.reference.current,
6901
+ floating.refs.floating.current,
6902
+ floating.update
6903
+ );
6904
+ }, [
6905
+ options.keepMounted,
6906
+ _opened,
6907
+ floating.refs.reference,
6908
+ floating.refs.floating,
6909
+ floating.update
6910
+ ]), useDidUpdate(() => {
6894
6911
  options.onPositionChange?.(floating.placement), options.positionRef.current = floating.placement;
6895
6912
  }, [floating.placement]), useDidUpdate(() => {
6896
6913
  _opened !== previouslyOpened.current && (_opened ? options.onOpen?.() : options.onClose?.()), previouslyOpened.current = _opened;
@@ -7016,7 +7033,8 @@ function Popover(_props) {
7016
7033
  setDropdownVisible,
7017
7034
  positionRef,
7018
7035
  disabled,
7019
- preventPositionChangeWhenVisible
7036
+ preventPositionChangeWhenVisible,
7037
+ keepMounted
7020
7038
  });
7021
7039
  useClickOutside(
7022
7040
  () => {
@@ -15665,6 +15683,20 @@ class BaseRootRoute extends BaseRoute {
15665
15683
  super(options);
15666
15684
  }
15667
15685
  }
15686
+ function stripSearchParams(input2) {
15687
+ return ({ search, next }) => {
15688
+ if (input2 === !0)
15689
+ return {};
15690
+ const result = next(search);
15691
+ return Array.isArray(input2) ? input2.forEach((key2) => {
15692
+ delete result[key2];
15693
+ }) : Object.entries(input2).forEach(
15694
+ ([key2, value]) => {
15695
+ deepEqual$1(result[key2], value) && delete result[key2];
15696
+ }
15697
+ ), result;
15698
+ };
15699
+ }
15668
15700
  function CatchBoundary(props2) {
15669
15701
  const errorComponent = props2.errorComponent ?? ErrorComponent;
15670
15702
  return /* @__PURE__ */ jsx(
@@ -16797,8 +16829,7 @@ function Fallback$1({ error, resetErrorBoundary }) {
16797
16829
  {
16798
16830
  onClick: () => {
16799
16831
  resetErrorBoundary(), router.navigate({
16800
- to: "/",
16801
- search: !0
16832
+ to: "/"
16802
16833
  });
16803
16834
  },
16804
16835
  variant: "light",
@@ -17177,10 +17208,9 @@ function NotFound() {
17177
17208
  }
17178
17209
  const asTheme = (v) => {
17179
17210
  if (typeof v != "string")
17180
- return;
17211
+ return "auto";
17181
17212
  const vlower = v.toLowerCase();
17182
- if (vlower === "light" || vlower === "dark")
17183
- return vlower;
17213
+ return vlower === "light" || vlower === "dark" ? vlower : "auto";
17184
17214
  }, asPadding = (v) => {
17185
17215
  switch (!0) {
17186
17216
  case typeof v == "number":
@@ -17188,17 +17218,38 @@ const asTheme = (v) => {
17188
17218
  case typeof v == "string":
17189
17219
  return Math.round(parseFloat(v));
17190
17220
  }
17221
+ return 20;
17191
17222
  }, Route$m = createRootRouteWithContext()({
17192
- // component: RootComponent,
17223
+ component: RootComponent,
17193
17224
  validateSearch: (search) => ({
17194
17225
  padding: asPadding(search.padding),
17195
17226
  theme: asTheme(search.theme)
17196
- })
17197
- }), Route$l = createFileRoute("/projects")({
17227
+ }),
17228
+ search: {
17229
+ middlewares: [
17230
+ stripSearchParams({
17231
+ padding: 20,
17232
+ theme: "auto"
17233
+ })
17234
+ ]
17235
+ }
17236
+ });
17237
+ function RootComponent() {
17238
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
17239
+ /* @__PURE__ */ jsx(Outlet, {}),
17240
+ /* @__PURE__ */ jsx(ThemeSync, {})
17241
+ ] });
17242
+ }
17243
+ const ThemeSync = () => {
17244
+ const { theme: theme2 } = Route$m.useSearch(), mantineColorScheme = useMantineColorScheme();
17245
+ return useEffect(() => {
17246
+ theme2 && theme2 !== mantineColorScheme.colorScheme && mantineColorScheme.setColorScheme(theme2);
17247
+ }, [theme2]), null;
17248
+ }, Route$l = createFileRoute("/projects")({
17198
17249
  component: RouteComponent$3
17199
17250
  });
17200
17251
  function RouteComponent$3() {
17201
- return useDocumentTitle("LikeC4 Projects"), /* @__PURE__ */ jsx(Container, { size: "xs", py: "lg", children: /* @__PURE__ */ jsxs(Stack, { children: [
17252
+ return useDocumentTitle(`Projects - ${pageTitle}`), /* @__PURE__ */ jsx(Container, { size: "xs", py: "lg", children: /* @__PURE__ */ jsxs(Stack, { children: [
17202
17253
  /* @__PURE__ */ jsx(Text, { fz: "lg", children: "Select a project" }),
17203
17254
  projects.map((v) => /* @__PURE__ */ jsx(
17204
17255
  Button,
@@ -28938,7 +28989,7 @@ function useCustomCompareEffect(callback, deps, comparator = basicDepsComparator
28938
28989
  function useDebouncedEffect(callback, deps, delay2, maxWait = 0) {
28939
28990
  useEffect(useDebouncedCallback(callback, deps, delay2, maxWait), deps);
28940
28991
  }
28941
- const { valueOf, toString: toString$1 } = Object.prototype, isEqual = (a2, b2) => {
28992
+ const { valueOf, toString } = Object.prototype, isEqual = (a2, b2) => {
28942
28993
  const visited = /* @__PURE__ */ new WeakMap(), inner2 = (a3, b3) => {
28943
28994
  if (a3 === b3)
28944
28995
  return !0;
@@ -28987,7 +29038,7 @@ const { valueOf, toString: toString$1 } = Object.prototype, isEqual = (a2, b2) =
28987
29038
  }
28988
29039
  if (a3.valueOf !== valueOf && typeof a3.valueOf == "function" && typeof b3.valueOf == "function")
28989
29040
  return a3.valueOf() === b3.valueOf();
28990
- if (a3.toString !== toString$1 && typeof a3.toString == "function" && typeof b3.toString == "function")
29041
+ if (a3.toString !== toString && typeof a3.toString == "function" && typeof b3.toString == "function")
28991
29042
  return a3.toString() === b3.toString();
28992
29043
  const aKeys = Object.keys(a3);
28993
29044
  let key2;
@@ -31372,7 +31423,7 @@ const cssTransparentBg = css({
31372
31423
  const square = useStore$1(selectDimensions);
31373
31424
  return useUpdateEffect(onViewportResize, [square]), null;
31374
31425
  };
31375
- var xstateReact_cjs = {}, xstate_cjs = {}, xstateActors_cjs = {}, raiseCbaedcda_cjs = {}, xstateDev_cjs = {}, hasRequiredXstateDev_cjs;
31426
+ var xstateReact_cjs = {}, xstate_cjs = {}, xstateActors_cjs = {}, raise5872b9e8_cjs = {}, xstateDev_cjs = {}, hasRequiredXstateDev_cjs;
31376
31427
  function requireXstateDev_cjs() {
31377
31428
  if (hasRequiredXstateDev_cjs) return xstateDev_cjs;
31378
31429
  hasRequiredXstateDev_cjs = 1, Object.defineProperty(xstateDev_cjs, "__esModule", { value: !0 });
@@ -31405,10 +31456,10 @@ function requireXstateDev_cjs() {
31405
31456
  };
31406
31457
  return xstateDev_cjs.devToolsAdapter = devToolsAdapter, xstateDev_cjs.getGlobal = getGlobal, xstateDev_cjs.registerService = registerService, xstateDev_cjs;
31407
31458
  }
31408
- var hasRequiredRaiseCbaedcda_cjs;
31409
- function requireRaiseCbaedcda_cjs() {
31410
- if (hasRequiredRaiseCbaedcda_cjs) return raiseCbaedcda_cjs;
31411
- hasRequiredRaiseCbaedcda_cjs = 1;
31459
+ var hasRequiredRaise5872b9e8_cjs;
31460
+ function requireRaise5872b9e8_cjs() {
31461
+ if (hasRequiredRaise5872b9e8_cjs) return raise5872b9e8_cjs;
31462
+ hasRequiredRaise5872b9e8_cjs = 1;
31412
31463
  var dev_dist_xstateDev = requireXstateDev_cjs();
31413
31464
  class Mailbox {
31414
31465
  constructor(_process) {
@@ -33081,13 +33132,13 @@ ${err.message}`);
33081
33132
  }
33082
33133
  return raise3.type = "xstate.raise", raise3.event = eventOrExpr, raise3.id = options?.id, raise3.delay = options?.delay, raise3.resolve = resolveRaise, raise3.execute = executeRaise, raise3;
33083
33134
  }
33084
- return raiseCbaedcda_cjs.$$ACTOR_TYPE = $$ACTOR_TYPE, raiseCbaedcda_cjs.Actor = Actor, raiseCbaedcda_cjs.NULL_EVENT = NULL_EVENT, raiseCbaedcda_cjs.ProcessingStatus = ProcessingStatus, raiseCbaedcda_cjs.STATE_DELIMITER = STATE_DELIMITER, raiseCbaedcda_cjs.XSTATE_ERROR = XSTATE_ERROR, raiseCbaedcda_cjs.XSTATE_STOP = XSTATE_STOP, raiseCbaedcda_cjs.and = and, raiseCbaedcda_cjs.cancel = cancel, raiseCbaedcda_cjs.cloneMachineSnapshot = cloneMachineSnapshot, raiseCbaedcda_cjs.createActor = createActor, raiseCbaedcda_cjs.createErrorActorEvent = createErrorActorEvent, raiseCbaedcda_cjs.createInitEvent = createInitEvent, raiseCbaedcda_cjs.createInvokeId = createInvokeId, raiseCbaedcda_cjs.createMachineSnapshot = createMachineSnapshot, raiseCbaedcda_cjs.evaluateGuard = evaluateGuard, raiseCbaedcda_cjs.formatInitialTransition = formatInitialTransition, raiseCbaedcda_cjs.formatTransition = formatTransition, raiseCbaedcda_cjs.formatTransitions = formatTransitions, raiseCbaedcda_cjs.getAllOwnEventDescriptors = getAllOwnEventDescriptors, raiseCbaedcda_cjs.getAllStateNodes = getAllStateNodes, raiseCbaedcda_cjs.getCandidates = getCandidates, raiseCbaedcda_cjs.getDelayedTransitions = getDelayedTransitions, raiseCbaedcda_cjs.getInitialStateNodes = getInitialStateNodes, raiseCbaedcda_cjs.getPersistedSnapshot = getPersistedSnapshot, raiseCbaedcda_cjs.getStateNodeByPath = getStateNodeByPath, raiseCbaedcda_cjs.getStateNodes = getStateNodes, raiseCbaedcda_cjs.interpret = interpret, raiseCbaedcda_cjs.isInFinalState = isInFinalState, raiseCbaedcda_cjs.isMachineSnapshot = isMachineSnapshot, raiseCbaedcda_cjs.isStateId = isStateId, raiseCbaedcda_cjs.macrostep = macrostep, raiseCbaedcda_cjs.mapValues = mapValues, raiseCbaedcda_cjs.matchesState = matchesState, raiseCbaedcda_cjs.microstep = microstep, raiseCbaedcda_cjs.not = not, raiseCbaedcda_cjs.or = or, raiseCbaedcda_cjs.pathToStateValue = pathToStateValue, raiseCbaedcda_cjs.raise = raise2, raiseCbaedcda_cjs.resolveActionsAndContext = resolveActionsAndContext, raiseCbaedcda_cjs.resolveReferencedActor = resolveReferencedActor, raiseCbaedcda_cjs.resolveStateValue = resolveStateValue, raiseCbaedcda_cjs.spawnChild = spawnChild, raiseCbaedcda_cjs.stateIn = stateIn, raiseCbaedcda_cjs.stop = stop, raiseCbaedcda_cjs.stopChild = stopChild, raiseCbaedcda_cjs.toArray = toArray2, raiseCbaedcda_cjs.toObserver = toObserver, raiseCbaedcda_cjs.toStatePath = toStatePath, raiseCbaedcda_cjs.toTransitionConfigArray = toTransitionConfigArray, raiseCbaedcda_cjs.transitionNode = transitionNode, raiseCbaedcda_cjs;
33135
+ return raise5872b9e8_cjs.$$ACTOR_TYPE = $$ACTOR_TYPE, raise5872b9e8_cjs.Actor = Actor, raise5872b9e8_cjs.NULL_EVENT = NULL_EVENT, raise5872b9e8_cjs.ProcessingStatus = ProcessingStatus, raise5872b9e8_cjs.STATE_DELIMITER = STATE_DELIMITER, raise5872b9e8_cjs.XSTATE_ERROR = XSTATE_ERROR, raise5872b9e8_cjs.XSTATE_STOP = XSTATE_STOP, raise5872b9e8_cjs.and = and, raise5872b9e8_cjs.cancel = cancel, raise5872b9e8_cjs.cloneMachineSnapshot = cloneMachineSnapshot, raise5872b9e8_cjs.createActor = createActor, raise5872b9e8_cjs.createErrorActorEvent = createErrorActorEvent, raise5872b9e8_cjs.createInitEvent = createInitEvent, raise5872b9e8_cjs.createInvokeId = createInvokeId, raise5872b9e8_cjs.createMachineSnapshot = createMachineSnapshot, raise5872b9e8_cjs.evaluateGuard = evaluateGuard, raise5872b9e8_cjs.formatInitialTransition = formatInitialTransition, raise5872b9e8_cjs.formatTransition = formatTransition, raise5872b9e8_cjs.formatTransitions = formatTransitions, raise5872b9e8_cjs.getAllOwnEventDescriptors = getAllOwnEventDescriptors, raise5872b9e8_cjs.getAllStateNodes = getAllStateNodes, raise5872b9e8_cjs.getCandidates = getCandidates, raise5872b9e8_cjs.getDelayedTransitions = getDelayedTransitions, raise5872b9e8_cjs.getInitialStateNodes = getInitialStateNodes, raise5872b9e8_cjs.getPersistedSnapshot = getPersistedSnapshot, raise5872b9e8_cjs.getStateNodeByPath = getStateNodeByPath, raise5872b9e8_cjs.getStateNodes = getStateNodes, raise5872b9e8_cjs.interpret = interpret, raise5872b9e8_cjs.isInFinalState = isInFinalState, raise5872b9e8_cjs.isMachineSnapshot = isMachineSnapshot, raise5872b9e8_cjs.isStateId = isStateId, raise5872b9e8_cjs.macrostep = macrostep, raise5872b9e8_cjs.mapValues = mapValues, raise5872b9e8_cjs.matchesState = matchesState, raise5872b9e8_cjs.microstep = microstep, raise5872b9e8_cjs.not = not, raise5872b9e8_cjs.or = or, raise5872b9e8_cjs.pathToStateValue = pathToStateValue, raise5872b9e8_cjs.raise = raise2, raise5872b9e8_cjs.resolveActionsAndContext = resolveActionsAndContext, raise5872b9e8_cjs.resolveReferencedActor = resolveReferencedActor, raise5872b9e8_cjs.resolveStateValue = resolveStateValue, raise5872b9e8_cjs.spawnChild = spawnChild, raise5872b9e8_cjs.stateIn = stateIn, raise5872b9e8_cjs.stop = stop, raise5872b9e8_cjs.stopChild = stopChild, raise5872b9e8_cjs.toArray = toArray2, raise5872b9e8_cjs.toObserver = toObserver, raise5872b9e8_cjs.toStatePath = toStatePath, raise5872b9e8_cjs.toTransitionConfigArray = toTransitionConfigArray, raise5872b9e8_cjs.transitionNode = transitionNode, raise5872b9e8_cjs;
33085
33136
  }
33086
33137
  var hasRequiredXstateActors_cjs;
33087
33138
  function requireXstateActors_cjs() {
33088
33139
  if (hasRequiredXstateActors_cjs) return xstateActors_cjs;
33089
33140
  hasRequiredXstateActors_cjs = 1, Object.defineProperty(xstateActors_cjs, "__esModule", { value: !0 });
33090
- var guards_dist_xstateGuards = /* @__PURE__ */ requireRaiseCbaedcda_cjs();
33141
+ var guards_dist_xstateGuards = /* @__PURE__ */ requireRaise5872b9e8_cjs();
33091
33142
  requireXstateDev_cjs();
33092
33143
  function fromTransition(transition, initialContext) {
33093
33144
  return {
@@ -33394,11 +33445,11 @@ function requireXstateActors_cjs() {
33394
33445
  }
33395
33446
  return xstateActors_cjs.createEmptyActor = createEmptyActor, xstateActors_cjs.fromCallback = fromCallback, xstateActors_cjs.fromEventObservable = fromEventObservable, xstateActors_cjs.fromObservable = fromObservable, xstateActors_cjs.fromPromise = fromPromise, xstateActors_cjs.fromTransition = fromTransition, xstateActors_cjs;
33396
33447
  }
33397
- var log179b5431_cjs = {}, hasRequiredLog179b5431_cjs;
33398
- function requireLog179b5431_cjs() {
33399
- if (hasRequiredLog179b5431_cjs) return log179b5431_cjs;
33400
- hasRequiredLog179b5431_cjs = 1;
33401
- var guards_dist_xstateGuards = /* @__PURE__ */ requireRaiseCbaedcda_cjs();
33448
+ var StateMachine1cda96d3_cjs = {}, assignE9c344ea_cjs = {}, hasRequiredAssignE9c344ea_cjs;
33449
+ function requireAssignE9c344ea_cjs() {
33450
+ if (hasRequiredAssignE9c344ea_cjs) return assignE9c344ea_cjs;
33451
+ hasRequiredAssignE9c344ea_cjs = 1;
33452
+ var guards_dist_xstateGuards = /* @__PURE__ */ requireRaise5872b9e8_cjs();
33402
33453
  function createSpawner(actorScope, {
33403
33454
  machine,
33404
33455
  context: context2
@@ -33472,177 +33523,13 @@ function requireLog179b5431_cjs() {
33472
33523
  }
33473
33524
  return assign3.type = "xstate.assign", assign3.assignment = assignment, assign3.resolve = resolveAssign, assign3;
33474
33525
  }
33475
- function resolveEmit(_, snapshot, args, actionParams, {
33476
- event: eventOrExpr
33477
- }) {
33478
- const resolvedEvent = typeof eventOrExpr == "function" ? eventOrExpr(args, actionParams) : eventOrExpr;
33479
- return [snapshot, {
33480
- event: resolvedEvent
33481
- }, void 0];
33482
- }
33483
- function executeEmit(actorScope, {
33484
- event
33485
- }) {
33486
- actorScope.defer(() => actorScope.emit(event));
33487
- }
33488
- function emit2(eventOrExpr) {
33489
- function emit3(_args, _params) {
33490
- }
33491
- return emit3.type = "xstate.emit", emit3.event = eventOrExpr, emit3.resolve = resolveEmit, emit3.execute = executeEmit, emit3;
33492
- }
33493
- let SpecialTargets = /* @__PURE__ */ function(SpecialTargets2) {
33494
- return SpecialTargets2.Parent = "#_parent", SpecialTargets2.Internal = "#_internal", SpecialTargets2;
33495
- }({});
33496
- function resolveSendTo(actorScope, snapshot, args, actionParams, {
33497
- to,
33498
- event: eventOrExpr,
33499
- id: id2,
33500
- delay: delay2
33501
- }, extra) {
33502
- const delaysMap = snapshot.machine.implementations.delays;
33503
- if (typeof eventOrExpr == "string")
33504
- throw new Error(
33505
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
33506
- `Only event objects may be used with sendTo; use sendTo({ type: "${eventOrExpr}" }) instead`
33507
- );
33508
- const resolvedEvent = typeof eventOrExpr == "function" ? eventOrExpr(args, actionParams) : eventOrExpr;
33509
- let resolvedDelay;
33510
- if (typeof delay2 == "string") {
33511
- const configDelay = delaysMap && delaysMap[delay2];
33512
- resolvedDelay = typeof configDelay == "function" ? configDelay(args, actionParams) : configDelay;
33513
- } else
33514
- resolvedDelay = typeof delay2 == "function" ? delay2(args, actionParams) : delay2;
33515
- const resolvedTarget = typeof to == "function" ? to(args, actionParams) : to;
33516
- let targetActorRef;
33517
- if (typeof resolvedTarget == "string") {
33518
- if (resolvedTarget === SpecialTargets.Parent ? targetActorRef = actorScope.self._parent : resolvedTarget === SpecialTargets.Internal ? targetActorRef = actorScope.self : resolvedTarget.startsWith("#_") ? targetActorRef = snapshot.children[resolvedTarget.slice(2)] : targetActorRef = extra.deferredActorIds?.includes(resolvedTarget) ? resolvedTarget : snapshot.children[resolvedTarget], !targetActorRef)
33519
- throw new Error(`Unable to send event to actor '${resolvedTarget}' from machine '${snapshot.machine.id}'.`);
33520
- } else
33521
- targetActorRef = resolvedTarget || actorScope.self;
33522
- return [snapshot, {
33523
- to: targetActorRef,
33524
- targetId: typeof resolvedTarget == "string" ? resolvedTarget : void 0,
33525
- event: resolvedEvent,
33526
- id: id2,
33527
- delay: resolvedDelay
33528
- }, void 0];
33529
- }
33530
- function retryResolveSendTo(_, snapshot, params) {
33531
- typeof params.to == "string" && (params.to = snapshot.children[params.to]);
33532
- }
33533
- function executeSendTo(actorScope, params) {
33534
- actorScope.defer(() => {
33535
- const {
33536
- to,
33537
- event,
33538
- delay: delay2,
33539
- id: id2
33540
- } = params;
33541
- if (typeof delay2 == "number") {
33542
- actorScope.system.scheduler.schedule(actorScope.self, to, event, delay2, id2);
33543
- return;
33544
- }
33545
- actorScope.system._relay(
33546
- actorScope.self,
33547
- // at this point, in a deferred task, it should already be mutated by retryResolveSendTo
33548
- // if it initially started as a string
33549
- to,
33550
- event.type === guards_dist_xstateGuards.XSTATE_ERROR ? guards_dist_xstateGuards.createErrorActorEvent(actorScope.self.id, event.data) : event
33551
- );
33552
- });
33553
- }
33554
- function sendTo(to, eventOrExpr, options) {
33555
- function sendTo2(_args, _params) {
33556
- }
33557
- return sendTo2.type = "xstate.sendTo", sendTo2.to = to, sendTo2.event = eventOrExpr, sendTo2.id = options?.id, sendTo2.delay = options?.delay, sendTo2.resolve = resolveSendTo, sendTo2.retryResolve = retryResolveSendTo, sendTo2.execute = executeSendTo, sendTo2;
33558
- }
33559
- function sendParent(event, options) {
33560
- return sendTo(SpecialTargets.Parent, event, options);
33561
- }
33562
- function forwardTo(target, options) {
33563
- return sendTo(target, ({
33564
- event
33565
- }) => event, options);
33566
- }
33567
- function resolveEnqueueActions(actorScope, snapshot, args, actionParams, {
33568
- collect
33569
- }) {
33570
- const actions = [], enqueue = function(action) {
33571
- actions.push(action);
33572
- };
33573
- return enqueue.assign = (...args2) => {
33574
- actions.push(assign2(...args2));
33575
- }, enqueue.cancel = (...args2) => {
33576
- actions.push(guards_dist_xstateGuards.cancel(...args2));
33577
- }, enqueue.raise = (...args2) => {
33578
- actions.push(guards_dist_xstateGuards.raise(...args2));
33579
- }, enqueue.sendTo = (...args2) => {
33580
- actions.push(sendTo(...args2));
33581
- }, enqueue.sendParent = (...args2) => {
33582
- actions.push(sendParent(...args2));
33583
- }, enqueue.spawnChild = (...args2) => {
33584
- actions.push(guards_dist_xstateGuards.spawnChild(...args2));
33585
- }, enqueue.stopChild = (...args2) => {
33586
- actions.push(guards_dist_xstateGuards.stopChild(...args2));
33587
- }, enqueue.emit = (...args2) => {
33588
- actions.push(emit2(...args2));
33589
- }, collect({
33590
- context: args.context,
33591
- event: args.event,
33592
- enqueue,
33593
- check: (guard) => guards_dist_xstateGuards.evaluateGuard(guard, snapshot.context, args.event, snapshot),
33594
- self: actorScope.self,
33595
- system: actorScope.system
33596
- }, actionParams), [snapshot, void 0, actions];
33597
- }
33598
- function enqueueActions(collect) {
33599
- function enqueueActions2(_args, _params) {
33600
- }
33601
- return enqueueActions2.type = "xstate.enqueueActions", enqueueActions2.collect = collect, enqueueActions2.resolve = resolveEnqueueActions, enqueueActions2;
33602
- }
33603
- function resolveLog(_, snapshot, actionArgs, actionParams, {
33604
- value,
33605
- label: label2
33606
- }) {
33607
- return [snapshot, {
33608
- value: typeof value == "function" ? value(actionArgs, actionParams) : value,
33609
- label: label2
33610
- }, void 0];
33611
- }
33612
- function executeLog({
33613
- logger
33614
- }, {
33615
- value,
33616
- label: label2
33617
- }) {
33618
- label2 ? logger(label2, value) : logger(value);
33619
- }
33620
- function log(value = ({
33621
- context: context2,
33622
- event
33623
- }) => ({
33624
- context: context2,
33625
- event
33626
- }), label2) {
33627
- function log2(_args, _params) {
33628
- }
33629
- return log2.type = "xstate.log", log2.value = value, log2.label = label2, log2.resolve = resolveLog, log2.execute = executeLog, log2;
33630
- }
33631
- return log179b5431_cjs.SpecialTargets = SpecialTargets, log179b5431_cjs.assign = assign2, log179b5431_cjs.emit = emit2, log179b5431_cjs.enqueueActions = enqueueActions, log179b5431_cjs.forwardTo = forwardTo, log179b5431_cjs.log = log, log179b5431_cjs.sendParent = sendParent, log179b5431_cjs.sendTo = sendTo, log179b5431_cjs;
33526
+ return assignE9c344ea_cjs.assign = assign2, assignE9c344ea_cjs;
33632
33527
  }
33633
- var hasRequiredXstate_cjs;
33634
- function requireXstate_cjs() {
33635
- if (hasRequiredXstate_cjs) return xstate_cjs;
33636
- hasRequiredXstate_cjs = 1, Object.defineProperty(xstate_cjs, "__esModule", { value: !0 });
33637
- var actors_dist_xstateActors = requireXstateActors_cjs(), guards_dist_xstateGuards = /* @__PURE__ */ requireRaiseCbaedcda_cjs(), log = /* @__PURE__ */ requireLog179b5431_cjs();
33638
- requireXstateDev_cjs();
33639
- function assertEvent(event, type) {
33640
- const types = guards_dist_xstateGuards.toArray(type);
33641
- if (!types.includes(event.type)) {
33642
- const typesText = types.length === 1 ? `type "${types[0]}"` : `one of types "${types.join('", "')}"`;
33643
- throw new Error(`Expected event ${JSON.stringify(event)} to have ${typesText}`);
33644
- }
33645
- }
33528
+ var hasRequiredStateMachine1cda96d3_cjs;
33529
+ function requireStateMachine1cda96d3_cjs() {
33530
+ if (hasRequiredStateMachine1cda96d3_cjs) return StateMachine1cda96d3_cjs;
33531
+ hasRequiredStateMachine1cda96d3_cjs = 1;
33532
+ var guards_dist_xstateGuards = /* @__PURE__ */ requireRaise5872b9e8_cjs(), assign2 = /* @__PURE__ */ requireAssignE9c344ea_cjs();
33646
33533
  const cache = /* @__PURE__ */ new WeakMap();
33647
33534
  function memo2(object, key2, fn) {
33648
33535
  let memoizedData = cache.get(object);
@@ -33744,7 +33631,7 @@ function requireXstate_cjs() {
33744
33631
  }
33745
33632
  /** The mapping of events to transitions. */
33746
33633
  get on() {
33747
- return memo2(this, "on", () => [...this.transitions].flatMap(([descriptor, t2]) => t2.map((t3) => [descriptor, t3])).reduce((map, [descriptor, transition2]) => (map[descriptor] = map[descriptor] || [], map[descriptor].push(transition2), map), {}));
33634
+ return memo2(this, "on", () => [...this.transitions].flatMap(([descriptor, t2]) => t2.map((t3) => [descriptor, t3])).reduce((map, [descriptor, transition]) => (map[descriptor] = map[descriptor] || [], map[descriptor].push(transition), map), {}));
33748
33635
  }
33749
33636
  get after() {
33750
33637
  return memo2(this, "delayedTransitions", () => guards_dist_xstateGuards.getDelayedTransitions(this));
@@ -33798,7 +33685,7 @@ ${err.message}`);
33798
33685
  * Excludes any inert events.
33799
33686
  */
33800
33687
  get ownEvents() {
33801
- const events = new Set([...this.transitions.keys()].filter((descriptor) => this.transitions.get(descriptor).some((transition2) => !(!transition2.target && !transition2.actions.length && !transition2.reenter))));
33688
+ const events = new Set([...this.transitions.keys()].filter((descriptor) => this.transitions.get(descriptor).some((transition) => !(!transition.target && !transition.actions.length && !transition.reenter))));
33802
33689
  return Array.from(events);
33803
33690
  }
33804
33691
  }
@@ -33816,11 +33703,10 @@ ${err.message}`);
33816
33703
  }), this.root._initialize(), this.states = this.root.states, this.events = this.root.events;
33817
33704
  }
33818
33705
  /**
33819
- * Clones this state machine with the provided implementations and merges the
33820
- * `context` (if provided).
33706
+ * Clones this state machine with the provided implementations.
33821
33707
  *
33822
- * @param implementations Options (`actions`, `guards`, `actors`, `delays`,
33823
- * `context`) to recursively merge with the existing options.
33708
+ * @param implementations Options (`actions`, `guards`, `actors`, `delays`) to
33709
+ * recursively merge with the existing options.
33824
33710
  * @returns A new `StateMachine` instance with the provided implementations.
33825
33711
  */
33826
33712
  provide(implementations) {
@@ -33907,7 +33793,7 @@ ${err.message}`);
33907
33793
  input: event.input,
33908
33794
  self: self2
33909
33795
  });
33910
- return guards_dist_xstateGuards.resolveActionsAndContext(preInitial, initEvent, actorScope, [log.assign(assignment)], internalQueue, void 0);
33796
+ return guards_dist_xstateGuards.resolveActionsAndContext(preInitial, initEvent, actorScope, [assign2.assign(assignment)], internalQueue, void 0);
33911
33797
  }
33912
33798
  return preInitial;
33913
33799
  }
@@ -33965,33 +33851,28 @@ ${err.message}`);
33965
33851
  });
33966
33852
  children2[actorId] = actorRef;
33967
33853
  });
33968
- function resolveStateNodeFromIdOrPath(idOrPath, root2) {
33854
+ function resolveHistoryReferencedState(root2, referenced) {
33855
+ if (referenced instanceof StateNode)
33856
+ return referenced;
33969
33857
  try {
33970
- return root2.machine.getStateNodeById(idOrPath);
33858
+ return root2.machine.getStateNodeById(referenced.id);
33971
33859
  } catch {
33972
- try {
33973
- return guards_dist_xstateGuards.getStateNodeByPath(root2, idOrPath.split("."));
33974
- } catch {
33975
- return idOrPath;
33976
- }
33977
33860
  }
33978
33861
  }
33979
- function reviveHistoryValue(historyValue, root2) {
33980
- if (!historyValue || typeof historyValue != "object") return {};
33862
+ function reviveHistoryValue(root2, historyValue) {
33863
+ if (!historyValue || typeof historyValue != "object")
33864
+ return {};
33981
33865
  const revived = {};
33982
33866
  for (const key2 in historyValue) {
33983
33867
  const arr = historyValue[key2];
33984
- revived[key2] = arr.map((item) => {
33985
- if (item instanceof StateNode) return item;
33986
- if (typeof item == "object" && "id" in item && typeof item.id == "string") {
33987
- const resolved = resolveStateNodeFromIdOrPath(item.id, root2);
33988
- if (resolved instanceof StateNode) return resolved;
33989
- }
33990
- }).filter((item) => item !== void 0), revived[key2].length === 0 && delete revived[key2];
33868
+ for (const item of arr) {
33869
+ const resolved = resolveHistoryReferencedState(root2, item);
33870
+ resolved && (revived[key2] ??= [], revived[key2].push(resolved));
33871
+ }
33991
33872
  }
33992
33873
  return revived;
33993
33874
  }
33994
- const revivedHistoryValue = reviveHistoryValue(snapshot.historyValue, this.root), restoredSnapshot = guards_dist_xstateGuards.createMachineSnapshot({
33875
+ const revivedHistoryValue = reviveHistoryValue(this.root, snapshot.historyValue), restoredSnapshot = guards_dist_xstateGuards.createMachineSnapshot({
33995
33876
  ...snapshot,
33996
33877
  children: children2,
33997
33878
  _nodes: Array.from(guards_dist_xstateGuards.getAllStateNodes(guards_dist_xstateGuards.getStateNodes(this.root, snapshot.value))),
@@ -34015,8 +33896,186 @@ ${err.message}`);
34015
33896
  return reviveContext(restoredSnapshot.context, children2), restoredSnapshot;
34016
33897
  }
34017
33898
  }
33899
+ return StateMachine1cda96d3_cjs.StateMachine = StateMachine, StateMachine1cda96d3_cjs.StateNode = StateNode, StateMachine1cda96d3_cjs;
33900
+ }
33901
+ var log215998b6_cjs = {}, hasRequiredLog215998b6_cjs;
33902
+ function requireLog215998b6_cjs() {
33903
+ if (hasRequiredLog215998b6_cjs) return log215998b6_cjs;
33904
+ hasRequiredLog215998b6_cjs = 1;
33905
+ var guards_dist_xstateGuards = /* @__PURE__ */ requireRaise5872b9e8_cjs(), assign2 = /* @__PURE__ */ requireAssignE9c344ea_cjs();
33906
+ function resolveEmit(_, snapshot, args, actionParams, {
33907
+ event: eventOrExpr
33908
+ }) {
33909
+ const resolvedEvent = typeof eventOrExpr == "function" ? eventOrExpr(args, actionParams) : eventOrExpr;
33910
+ return [snapshot, {
33911
+ event: resolvedEvent
33912
+ }, void 0];
33913
+ }
33914
+ function executeEmit(actorScope, {
33915
+ event
33916
+ }) {
33917
+ actorScope.defer(() => actorScope.emit(event));
33918
+ }
33919
+ function emit2(eventOrExpr) {
33920
+ function emit3(_args, _params) {
33921
+ }
33922
+ return emit3.type = "xstate.emit", emit3.event = eventOrExpr, emit3.resolve = resolveEmit, emit3.execute = executeEmit, emit3;
33923
+ }
33924
+ let SpecialTargets = /* @__PURE__ */ function(SpecialTargets2) {
33925
+ return SpecialTargets2.Parent = "#_parent", SpecialTargets2.Internal = "#_internal", SpecialTargets2;
33926
+ }({});
33927
+ function resolveSendTo(actorScope, snapshot, args, actionParams, {
33928
+ to,
33929
+ event: eventOrExpr,
33930
+ id: id2,
33931
+ delay: delay2
33932
+ }, extra) {
33933
+ const delaysMap = snapshot.machine.implementations.delays;
33934
+ if (typeof eventOrExpr == "string")
33935
+ throw new Error(
33936
+ // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
33937
+ `Only event objects may be used with sendTo; use sendTo({ type: "${eventOrExpr}" }) instead`
33938
+ );
33939
+ const resolvedEvent = typeof eventOrExpr == "function" ? eventOrExpr(args, actionParams) : eventOrExpr;
33940
+ let resolvedDelay;
33941
+ if (typeof delay2 == "string") {
33942
+ const configDelay = delaysMap && delaysMap[delay2];
33943
+ resolvedDelay = typeof configDelay == "function" ? configDelay(args, actionParams) : configDelay;
33944
+ } else
33945
+ resolvedDelay = typeof delay2 == "function" ? delay2(args, actionParams) : delay2;
33946
+ const resolvedTarget = typeof to == "function" ? to(args, actionParams) : to;
33947
+ let targetActorRef;
33948
+ if (typeof resolvedTarget == "string") {
33949
+ if (resolvedTarget === SpecialTargets.Parent ? targetActorRef = actorScope.self._parent : resolvedTarget === SpecialTargets.Internal ? targetActorRef = actorScope.self : resolvedTarget.startsWith("#_") ? targetActorRef = snapshot.children[resolvedTarget.slice(2)] : targetActorRef = extra.deferredActorIds?.includes(resolvedTarget) ? resolvedTarget : snapshot.children[resolvedTarget], !targetActorRef)
33950
+ throw new Error(`Unable to send event to actor '${resolvedTarget}' from machine '${snapshot.machine.id}'.`);
33951
+ } else
33952
+ targetActorRef = resolvedTarget || actorScope.self;
33953
+ return [snapshot, {
33954
+ to: targetActorRef,
33955
+ targetId: typeof resolvedTarget == "string" ? resolvedTarget : void 0,
33956
+ event: resolvedEvent,
33957
+ id: id2,
33958
+ delay: resolvedDelay
33959
+ }, void 0];
33960
+ }
33961
+ function retryResolveSendTo(_, snapshot, params) {
33962
+ typeof params.to == "string" && (params.to = snapshot.children[params.to]);
33963
+ }
33964
+ function executeSendTo(actorScope, params) {
33965
+ actorScope.defer(() => {
33966
+ const {
33967
+ to,
33968
+ event,
33969
+ delay: delay2,
33970
+ id: id2
33971
+ } = params;
33972
+ if (typeof delay2 == "number") {
33973
+ actorScope.system.scheduler.schedule(actorScope.self, to, event, delay2, id2);
33974
+ return;
33975
+ }
33976
+ actorScope.system._relay(
33977
+ actorScope.self,
33978
+ // at this point, in a deferred task, it should already be mutated by retryResolveSendTo
33979
+ // if it initially started as a string
33980
+ to,
33981
+ event.type === guards_dist_xstateGuards.XSTATE_ERROR ? guards_dist_xstateGuards.createErrorActorEvent(actorScope.self.id, event.data) : event
33982
+ );
33983
+ });
33984
+ }
33985
+ function sendTo(to, eventOrExpr, options) {
33986
+ function sendTo2(_args, _params) {
33987
+ }
33988
+ return sendTo2.type = "xstate.sendTo", sendTo2.to = to, sendTo2.event = eventOrExpr, sendTo2.id = options?.id, sendTo2.delay = options?.delay, sendTo2.resolve = resolveSendTo, sendTo2.retryResolve = retryResolveSendTo, sendTo2.execute = executeSendTo, sendTo2;
33989
+ }
33990
+ function sendParent(event, options) {
33991
+ return sendTo(SpecialTargets.Parent, event, options);
33992
+ }
33993
+ function forwardTo(target, options) {
33994
+ return sendTo(target, ({
33995
+ event
33996
+ }) => event, options);
33997
+ }
33998
+ function resolveEnqueueActions(actorScope, snapshot, args, actionParams, {
33999
+ collect
34000
+ }) {
34001
+ const actions = [], enqueue = function(action) {
34002
+ actions.push(action);
34003
+ };
34004
+ return enqueue.assign = (...args2) => {
34005
+ actions.push(assign2.assign(...args2));
34006
+ }, enqueue.cancel = (...args2) => {
34007
+ actions.push(guards_dist_xstateGuards.cancel(...args2));
34008
+ }, enqueue.raise = (...args2) => {
34009
+ actions.push(guards_dist_xstateGuards.raise(...args2));
34010
+ }, enqueue.sendTo = (...args2) => {
34011
+ actions.push(sendTo(...args2));
34012
+ }, enqueue.sendParent = (...args2) => {
34013
+ actions.push(sendParent(...args2));
34014
+ }, enqueue.spawnChild = (...args2) => {
34015
+ actions.push(guards_dist_xstateGuards.spawnChild(...args2));
34016
+ }, enqueue.stopChild = (...args2) => {
34017
+ actions.push(guards_dist_xstateGuards.stopChild(...args2));
34018
+ }, enqueue.emit = (...args2) => {
34019
+ actions.push(emit2(...args2));
34020
+ }, collect({
34021
+ context: args.context,
34022
+ event: args.event,
34023
+ enqueue,
34024
+ check: (guard) => guards_dist_xstateGuards.evaluateGuard(guard, snapshot.context, args.event, snapshot),
34025
+ self: actorScope.self,
34026
+ system: actorScope.system
34027
+ }, actionParams), [snapshot, void 0, actions];
34028
+ }
34029
+ function enqueueActions(collect) {
34030
+ function enqueueActions2(_args, _params) {
34031
+ }
34032
+ return enqueueActions2.type = "xstate.enqueueActions", enqueueActions2.collect = collect, enqueueActions2.resolve = resolveEnqueueActions, enqueueActions2;
34033
+ }
34034
+ function resolveLog(_, snapshot, actionArgs, actionParams, {
34035
+ value,
34036
+ label: label2
34037
+ }) {
34038
+ return [snapshot, {
34039
+ value: typeof value == "function" ? value(actionArgs, actionParams) : value,
34040
+ label: label2
34041
+ }, void 0];
34042
+ }
34043
+ function executeLog({
34044
+ logger
34045
+ }, {
34046
+ value,
34047
+ label: label2
34048
+ }) {
34049
+ label2 ? logger(label2, value) : logger(value);
34050
+ }
34051
+ function log(value = ({
34052
+ context: context2,
34053
+ event
34054
+ }) => ({
34055
+ context: context2,
34056
+ event
34057
+ }), label2) {
34058
+ function log2(_args, _params) {
34059
+ }
34060
+ return log2.type = "xstate.log", log2.value = value, log2.label = label2, log2.resolve = resolveLog, log2.execute = executeLog, log2;
34061
+ }
34062
+ return log215998b6_cjs.SpecialTargets = SpecialTargets, log215998b6_cjs.emit = emit2, log215998b6_cjs.enqueueActions = enqueueActions, log215998b6_cjs.forwardTo = forwardTo, log215998b6_cjs.log = log, log215998b6_cjs.sendParent = sendParent, log215998b6_cjs.sendTo = sendTo, log215998b6_cjs;
34063
+ }
34064
+ var hasRequiredXstate_cjs;
34065
+ function requireXstate_cjs() {
34066
+ if (hasRequiredXstate_cjs) return xstate_cjs;
34067
+ hasRequiredXstate_cjs = 1, Object.defineProperty(xstate_cjs, "__esModule", { value: !0 });
34068
+ var actors_dist_xstateActors = requireXstateActors_cjs(), guards_dist_xstateGuards = /* @__PURE__ */ requireRaise5872b9e8_cjs(), StateMachine = /* @__PURE__ */ requireStateMachine1cda96d3_cjs(), log = /* @__PURE__ */ requireLog215998b6_cjs(), assign2 = /* @__PURE__ */ requireAssignE9c344ea_cjs();
34069
+ requireXstateDev_cjs();
34070
+ function assertEvent(event, type) {
34071
+ const types = guards_dist_xstateGuards.toArray(type);
34072
+ if (!types.includes(event.type)) {
34073
+ const typesText = types.length === 1 ? `type "${types[0]}"` : `one of types "${types.join('", "')}"`;
34074
+ throw new Error(`Expected event ${JSON.stringify(event)} to have ${typesText}`);
34075
+ }
34076
+ }
34018
34077
  function createMachine(config, implementations) {
34019
- return new StateMachine(config, implementations);
34078
+ return new StateMachine.StateMachine(config, implementations);
34020
34079
  }
34021
34080
  function createInertActorScope(actorLogic) {
34022
34081
  const self2 = guards_dist_xstateGuards.createActor(actorLogic);
@@ -34176,7 +34235,7 @@ ${err.message}`);
34176
34235
  }), done && sub.unsubscribe());
34177
34236
  });
34178
34237
  }
34179
- return xstate_cjs.createEmptyActor = actors_dist_xstateActors.createEmptyActor, xstate_cjs.fromCallback = actors_dist_xstateActors.fromCallback, xstate_cjs.fromEventObservable = actors_dist_xstateActors.fromEventObservable, xstate_cjs.fromObservable = actors_dist_xstateActors.fromObservable, xstate_cjs.fromPromise = actors_dist_xstateActors.fromPromise, xstate_cjs.fromTransition = actors_dist_xstateActors.fromTransition, xstate_cjs.Actor = guards_dist_xstateGuards.Actor, xstate_cjs.__unsafe_getAllOwnEventDescriptors = guards_dist_xstateGuards.getAllOwnEventDescriptors, xstate_cjs.and = guards_dist_xstateGuards.and, xstate_cjs.cancel = guards_dist_xstateGuards.cancel, xstate_cjs.createActor = guards_dist_xstateGuards.createActor, xstate_cjs.getStateNodes = guards_dist_xstateGuards.getStateNodes, xstate_cjs.interpret = guards_dist_xstateGuards.interpret, xstate_cjs.isMachineSnapshot = guards_dist_xstateGuards.isMachineSnapshot, xstate_cjs.matchesState = guards_dist_xstateGuards.matchesState, xstate_cjs.not = guards_dist_xstateGuards.not, xstate_cjs.or = guards_dist_xstateGuards.or, xstate_cjs.pathToStateValue = guards_dist_xstateGuards.pathToStateValue, xstate_cjs.raise = guards_dist_xstateGuards.raise, xstate_cjs.spawnChild = guards_dist_xstateGuards.spawnChild, xstate_cjs.stateIn = guards_dist_xstateGuards.stateIn, xstate_cjs.stop = guards_dist_xstateGuards.stop, xstate_cjs.stopChild = guards_dist_xstateGuards.stopChild, xstate_cjs.toObserver = guards_dist_xstateGuards.toObserver, xstate_cjs.SpecialTargets = log.SpecialTargets, xstate_cjs.assign = log.assign, xstate_cjs.emit = log.emit, xstate_cjs.enqueueActions = log.enqueueActions, xstate_cjs.forwardTo = log.forwardTo, xstate_cjs.log = log.log, xstate_cjs.sendParent = log.sendParent, xstate_cjs.sendTo = log.sendTo, xstate_cjs.SimulatedClock = SimulatedClock, xstate_cjs.StateMachine = StateMachine, xstate_cjs.StateNode = StateNode, xstate_cjs.assertEvent = assertEvent, xstate_cjs.createMachine = createMachine, xstate_cjs.getInitialSnapshot = getInitialSnapshot, xstate_cjs.getNextSnapshot = getNextSnapshot, xstate_cjs.initialTransition = initialTransition, xstate_cjs.setup = setup, xstate_cjs.toPromise = toPromise, xstate_cjs.transition = transition, xstate_cjs.waitFor = waitFor, xstate_cjs;
34238
+ return xstate_cjs.createEmptyActor = actors_dist_xstateActors.createEmptyActor, xstate_cjs.fromCallback = actors_dist_xstateActors.fromCallback, xstate_cjs.fromEventObservable = actors_dist_xstateActors.fromEventObservable, xstate_cjs.fromObservable = actors_dist_xstateActors.fromObservable, xstate_cjs.fromPromise = actors_dist_xstateActors.fromPromise, xstate_cjs.fromTransition = actors_dist_xstateActors.fromTransition, xstate_cjs.Actor = guards_dist_xstateGuards.Actor, xstate_cjs.__unsafe_getAllOwnEventDescriptors = guards_dist_xstateGuards.getAllOwnEventDescriptors, xstate_cjs.and = guards_dist_xstateGuards.and, xstate_cjs.cancel = guards_dist_xstateGuards.cancel, xstate_cjs.createActor = guards_dist_xstateGuards.createActor, xstate_cjs.getStateNodes = guards_dist_xstateGuards.getStateNodes, xstate_cjs.interpret = guards_dist_xstateGuards.interpret, xstate_cjs.isMachineSnapshot = guards_dist_xstateGuards.isMachineSnapshot, xstate_cjs.matchesState = guards_dist_xstateGuards.matchesState, xstate_cjs.not = guards_dist_xstateGuards.not, xstate_cjs.or = guards_dist_xstateGuards.or, xstate_cjs.pathToStateValue = guards_dist_xstateGuards.pathToStateValue, xstate_cjs.raise = guards_dist_xstateGuards.raise, xstate_cjs.spawnChild = guards_dist_xstateGuards.spawnChild, xstate_cjs.stateIn = guards_dist_xstateGuards.stateIn, xstate_cjs.stop = guards_dist_xstateGuards.stop, xstate_cjs.stopChild = guards_dist_xstateGuards.stopChild, xstate_cjs.toObserver = guards_dist_xstateGuards.toObserver, xstate_cjs.StateMachine = StateMachine.StateMachine, xstate_cjs.StateNode = StateMachine.StateNode, xstate_cjs.SpecialTargets = log.SpecialTargets, xstate_cjs.emit = log.emit, xstate_cjs.enqueueActions = log.enqueueActions, xstate_cjs.forwardTo = log.forwardTo, xstate_cjs.log = log.log, xstate_cjs.sendParent = log.sendParent, xstate_cjs.sendTo = log.sendTo, xstate_cjs.assign = assign2.assign, xstate_cjs.SimulatedClock = SimulatedClock, xstate_cjs.assertEvent = assertEvent, xstate_cjs.createMachine = createMachine, xstate_cjs.getInitialSnapshot = getInitialSnapshot, xstate_cjs.getNextSnapshot = getNextSnapshot, xstate_cjs.initialTransition = initialTransition, xstate_cjs.setup = setup, xstate_cjs.toPromise = toPromise, xstate_cjs.transition = transition, xstate_cjs.waitFor = waitFor, xstate_cjs;
34180
34239
  }
34181
34240
  var hasRequiredXstateReact_cjs;
34182
34241
  function requireXstateReact_cjs() {
@@ -40219,10 +40278,8 @@ function requireUtil$1() {
40219
40278
  zipObject
40220
40279
  };
40221
40280
  function addDummyNode(g, type, attrs, name) {
40222
- let v;
40223
- do
40281
+ for (var v = name; g.hasNode(v); )
40224
40282
  v = uniqueId(name);
40225
- while (g.hasNode(v));
40226
40283
  return attrs.dummy = type, g.setNode(v, attrs), v;
40227
40284
  }
40228
40285
  function simplify(g) {
@@ -40346,7 +40403,7 @@ function requireUtil$1() {
40346
40403
  let idCounter2 = 0;
40347
40404
  function uniqueId(prefix2) {
40348
40405
  var id2 = ++idCounter2;
40349
- return toString(prefix2) + id2;
40406
+ return prefix2 + ("" + id2);
40350
40407
  }
40351
40408
  function range(start2, limit, step = 1) {
40352
40409
  limit == null && (limit = start2, start2 = 0);
@@ -40587,6 +40644,9 @@ function requireRank() {
40587
40644
  var rankUtil = requireUtil(), longestPath = rankUtil.longestPath, feasibleTree = requireFeasibleTree(), networkSimplex = requireNetworkSimplex();
40588
40645
  rank_1 = rank;
40589
40646
  function rank(g) {
40647
+ var ranker = g.graph().ranker;
40648
+ if (ranker instanceof Function)
40649
+ return ranker(g);
40590
40650
  switch (g.graph().ranker) {
40591
40651
  case "network-simplex":
40592
40652
  networkSimplexRanker(g);
@@ -40597,6 +40657,8 @@ function requireRank() {
40597
40657
  case "longest-path":
40598
40658
  longestPathRanker(g);
40599
40659
  break;
40660
+ case "none":
40661
+ break;
40600
40662
  default:
40601
40663
  networkSimplexRanker(g);
40602
40664
  }
@@ -41293,7 +41355,7 @@ function requireLayout() {
41293
41355
  inputLabel.points = layoutLabel.points, Object.hasOwn(layoutLabel, "x") && (inputLabel.x = layoutLabel.x, inputLabel.y = layoutLabel.y);
41294
41356
  }), inputGraph.graph().width = layoutGraph.graph().width, inputGraph.graph().height = layoutGraph.graph().height;
41295
41357
  }
41296
- let graphNumAttrs = ["nodesep", "edgesep", "ranksep", "marginx", "marginy"], graphDefaults = { ranksep: 50, edgesep: 20, nodesep: 50, rankdir: "tb" }, graphAttrs = ["acyclicer", "ranker", "rankdir", "align"], nodeNumAttrs = ["width", "height"], nodeDefaults = { width: 0, height: 0 }, edgeNumAttrs = ["minlen", "weight", "width", "height", "labeloffset"], edgeDefaults = {
41358
+ let graphNumAttrs = ["nodesep", "edgesep", "ranksep", "marginx", "marginy"], graphDefaults = { ranksep: 50, edgesep: 20, nodesep: 50, rankdir: "tb" }, graphAttrs = ["acyclicer", "ranker", "rankdir", "align"], nodeNumAttrs = ["width", "height", "rank"], nodeDefaults = { width: 0, height: 0 }, edgeNumAttrs = ["minlen", "weight", "width", "height", "labeloffset"], edgeDefaults = {
41297
41359
  minlen: 1,
41298
41360
  weight: 1,
41299
41361
  width: 0,
@@ -41482,7 +41544,7 @@ function requireDebug() {
41482
41544
  }
41483
41545
  var version, hasRequiredVersion;
41484
41546
  function requireVersion() {
41485
- return hasRequiredVersion || (hasRequiredVersion = 1, version = "1.1.4"), version;
41547
+ return hasRequiredVersion || (hasRequiredVersion = 1, version = "1.1.5"), version;
41486
41548
  }
41487
41549
  var dagre$1, hasRequiredDagre;
41488
41550
  function requireDagre() {
@@ -50298,7 +50360,7 @@ const previewBg = css({
50298
50360
  component: RouteComponent$1
50299
50361
  });
50300
50362
  function RouteComponent$1() {
50301
- useDocumentTitle("LikeC4");
50363
+ useDocumentTitle(pageTitle);
50302
50364
  const views = [...useLikeC4Model$1("layouted").views()];
50303
50365
  return /* @__PURE__ */ jsx(Container, { size: "xl", children: /* @__PURE__ */ jsx(
50304
50366
  SimpleGrid,
@@ -51481,7 +51543,8 @@ const cssExportView = css({
51481
51543
  margin: 0,
51482
51544
  marginRight: "auto",
51483
51545
  marginBottom: "auto",
51484
- background: "transparent"
51546
+ background: "transparent",
51547
+ overflow: "hidden"
51485
51548
  });
51486
51549
  css({
51487
51550
  position: "fixed",
@@ -51533,7 +51596,7 @@ function ExportPage() {
51533
51596
  if (!viewportRef.current)
51534
51597
  return;
51535
51598
  [...viewportRef.current.querySelectorAll(".react-flow__viewport")].forEach((el) => {
51536
- el.style.transform = "";
51599
+ el.style.transform = "translate(" + padding + "px, " + padding + "px)";
51537
51600
  });
51538
51601
  }
51539
51602
  ), useDebouncedEffect(
@@ -51559,7 +51622,6 @@ function ExportPage() {
51559
51622
  "data-testid": "export-page",
51560
51623
  className: cx(cssExportView),
51561
51624
  style: {
51562
- padding,
51563
51625
  minWidth: width,
51564
51626
  width,
51565
51627
  minHeight: height,
@@ -51570,7 +51632,14 @@ function ExportPage() {
51570
51632
  /* @__PURE__ */ jsx(
51571
51633
  StaticLikeC4Diagram,
51572
51634
  {
51573
- view: diagram,
51635
+ view: {
51636
+ ...diagram,
51637
+ bounds: {
51638
+ ...diagram.bounds,
51639
+ x: padding,
51640
+ y: padding
51641
+ }
51642
+ },
51574
51643
  fitView: !1,
51575
51644
  fitViewPadding: 0,
51576
51645
  background: "transparent",
@@ -51643,7 +51712,7 @@ function ViewReact() {
51643
51712
  search: !0
51644
51713
  });
51645
51714
  }), title2 = view ? view.title ?? view.id : "View not found";
51646
- if (useDocumentTitle(title2 + " - LikeC4"), !view)
51715
+ if (console.log(pageTitle), useDocumentTitle(`${title2} - ${pageTitle}`), !view)
51647
51716
  return /* @__PURE__ */ jsx(NotFound, {});
51648
51717
  const hasNotations = (view.notation?.nodes ?? []).length > 0;
51649
51718
  return /* @__PURE__ */ jsx(