System.register(["src/external/babel/babel7default.js", "utils"], function (_export, _context) {
  "use strict";

  var babelDefault, range, DependencyGraph, __SystemJSRewritingHack, t, AEXPR_IDENTIFIER_NAME;
  function leakingBindings(path) {
    globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
    const bindings = new Set();
    path.traverse({
      ReferencedIdentifier(id) {
        globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
        const outerBinding = path.scope.getBinding(id.node.name);
        if (!outerBinding) return;
        const actualBinding = id.scope.getBinding(id.node.name);
        if (outerBinding === actualBinding) {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
          bindings.add(actualBinding);
        }
      }
    });
    return bindings;
  }
  function isAExpr(path) {
    globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
    return t.isCallExpression(path) && t.isIdentifier(path.node.callee) && path.node.callee.name === AEXPR_IDENTIFIER_NAME && !path.scope.hasBinding(AEXPR_IDENTIFIER_NAME, true);
  }
  _export("DependencyGraph", void 0);
  return {
    setters: [function (_srcExternalBabelBabel7defaultJs) {
      babelDefault = _srcExternalBabelBabel7defaultJs.default;
    }, function (_utils) {
      range = _utils.range;
    }],
    execute: function () {
      __SystemJSRewritingHack = {};
      _recorder_._src_client_dependency_graph_graph_js = _recorder_._src_client_dependency_graph_graph_js || {};
      Object.defineProperty(_recorder_._src_client_dependency_graph_graph_js, "isAExpr", {
        get() {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
          return isAExpr;
        },
        set(thisIsVererySecretVariableName) {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
          isAExpr = thisIsVererySecretVariableName;
          return true;
        },
        enumerable: true,
        configurable: true
      });
      Object.defineProperty(_recorder_._src_client_dependency_graph_graph_js, "leakingBindings", {
        get() {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
          return leakingBindings;
        },
        set(thisIsVererySecretVariableName) {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
          leakingBindings = thisIsVererySecretVariableName;
          return true;
        },
        enumerable: true,
        configurable: true
      });
      Object.defineProperty(_recorder_._src_client_dependency_graph_graph_js, "babelDefault", {
        get() {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
          return babelDefault;
        },
        set(thisIsVererySecretVariableName) {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
          babelDefault = thisIsVererySecretVariableName;
          return true;
        },
        enumerable: true,
        configurable: true
      });
      Object.defineProperty(_recorder_._src_client_dependency_graph_graph_js, "range", {
        get() {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
          return range;
        },
        set(thisIsVererySecretVariableName) {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
          range = thisIsVererySecretVariableName;
          return true;
        },
        enumerable: true,
        configurable: true
      });
      ({
        types: t
      } = babelDefault.babel);
      Object.defineProperty(_recorder_._src_client_dependency_graph_graph_js, "t", {
        get() {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
          return t;
        },
        set(thisIsVererySecretVariableName) {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
          t = thisIsVererySecretVariableName;
          return true;
        },
        enumerable: true,
        configurable: true
      });
      _export("DependencyGraph", DependencyGraph = class DependencyGraph {
        get programPath() {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
          return this.capabilities.programPath;
        }
        constructor(capabilities) {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
          this.capabilities = capabilities;

          //Stores globally a `map` of properties (`String`) to objectbindings of the objects, that have a property of that name. 
          this.memberAssignments = new Map();
          this.finishedEnrichment = false;
          this.enrich();
        }
        getAexprAtCursor(location) {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
          let aexprPath;
          this.programPath.traverse({
            CallExpression(path) {
              globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
              if (!range(path.node.loc).contains(location)) {
                globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
                path.skip();
              } else if (isAExpr(path)) {
                globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
                aexprPath = path;
                path.stop();
              }
            }
          });
          return aexprPath;
        }
        getAllActiveExpressions() {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
          if (!this.programPath) return [];
          const allAExpr = [];
          this.programPath.traverse({
            CallExpression(path) {
              globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
              if (isAExpr(path)) {
                globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
                allAExpr.push(path);
              }
            }
          });
          return allAExpr;
        }
        get hasActiveExpressionsDirective() {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
          if (!this.programPath) return false;
          return this.programPath.node.directives.some(node => {
            globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
            return node.value && node.value.value === "enable aexpr";
          });
        }
        ensureEnrichment() {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
          if (this.finishedEnrichment) return true;
          if (!this.programPath || !this.hasActiveExpressionsDirective) return false;
          try {
            globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
            this.enrich();
          } catch (err) {
            globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
            console.error("Unable to process source code", err);
            return false;
          }
          return true;
        }
        enrich() {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
          if (!this.programPath) return;
          let self = this;
          this.programPath.traverse({
            enter(path) {
              globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
              path.node.extra = {
                // this in necessary due to possible circles
                // this collects the correct dependencies
                // breaks as soon as a node is contained by more than one circle (but this turned out to be unlikely)
                visited: 2,
                //same for return recursion
                returnVisited: 2
              };
            }
          });

          // adds the corresponding binding to every identifier
          this.programPath.traverse({
            Scopable(path) {
              globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
              Object.entries(path.scope.bindings).forEach(([_name, binding]) => {
                globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
                binding.referencePaths.forEach(path => {
                  globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
                  path.node.extra.binding = binding;
                });
              });
            }
          });
          this.extractMemberAssignments();
          this.enrichFunctionNodes();
          this.programPath.traverse({
            Expression(expr) {
              globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
              self.collectExpressionInformation(expr);
            }
          });
          this.finishedEnrichment = true;
        }

        // Filters every memberassignment and registers it in `this.memberAssignments`
        extractMemberAssignments() {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
          let self = this;
          this.programPath.traverse({
            MemberExpression(expr) {
              globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
              if (expr.node.computed) return;
              if (!expr.parentPath.isAssignmentExpression()) return;
              let assignment = self.assignedValue(expr.parentPath);
              let obj = expr.get("object");
              let objKey = obj.node.extra.binding || 'misc';
              let property = expr.get("property").node.name;
              let entry = self.memberAssignments.get(property);
              if (!entry) {
                globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
                // property unknown, adding new property and its accesses to the map
                let newMap = new Map();
                newMap.set(objKey, [assignment]);
                self.memberAssignments.set(property, newMap);
              } else {
                globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
                let objEntry = entry.get(objKey);
                if (!objEntry) {
                  globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
                  objEntry = [];
                  entry.set(objKey, objEntry);
                }
                objEntry.push(assignment);
              }
            }
          });
        }
        enrichFunctionNodes() {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
          // adds bindings definend outside of the current scope(e.g. Function) to the scope
          this.programPath.traverse({
            'Function|ArrowFunctionExpression|Program'(path) {
              globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
              path.node.extra.leakingBindings = leakingBindings(path);
              const callExpressions = path.node.extra.callExpressions = [];
              const objects = path.node.extra.objects = new Map();
              const returns = path.node.extra.returns = [];
              path.traverse({
                MemberExpression(expr) {
                  globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
                  if (expr.parentPath.isAssignmentExpression()) return;
                  let objExpr = expr.get("object").node;
                  let property = expr.get("property").node.name;
                  let entry = objects.get(objExpr);
                  if (!entry) {
                    globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
                    objects.set(objExpr, new Set([property]));
                  } else {
                    globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
                    entry.add(property);
                  }
                }
              });
              path.traverse({
                ReturnStatement(ret) {
                  globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
                  if (ret.has("argument")) {
                    globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
                    returns.push(ret.get("argument"));
                  }
                },
                CallExpression(call) {
                  globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
                  callExpressions.push(call);
                }
              });
            }
          });
        }

        /* Main recursion for enriching AST 
        *  Resolves Expression nodes and follows their children in order to find
        *  - resolvedObjects - the {ObjExpression, [Bindings]} in which the expression may result
        *  - resolvedCallees - the [Function] which callepressions may actually be
        *  - results         - the [Function] which may be returned by an expression or Identifier
        *
        */
        collectExpressionInformation(path) {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
          if (path.node.extra.results) {
            globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
            return path.node.extra.results;
          }
          if (path.node.extra.returnVisited <= 0) {
            globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
            path.node.extra.resolvedObjects = [];
            path.node.extra.results = [];
            return [];
          }
          path.node.extra.returnVisited -= 1;
          let results = [];
          let resolvedObjects = [];
          if (path.isObjectExpression()) {
            globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
            resolvedObjects = [{
              objectExpression: path,
              bindings: new Set()
            }];
          } else if (path.isIdentifier()) {
            globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
            let binding = path.node.extra.binding;
            if (binding) {
              globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
              [binding.path, ...binding.constantViolations].forEach(item => {
                globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
                this.collectExpressionInformation(item);
                results.push(item.node.extra.results);
                item.node.extra.resolvedObjects.forEach(obj => {
                  globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
                  obj.bindings.add(binding);
                  resolvedObjects.push(obj);
                });
              });
            }
          } else if (path.isAssignmentExpression() || path.isVariableDeclarator()) {
            globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
            let val = this.assignedValue(path);
            if (val && val.node) {
              globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
              this.collectExpressionInformation(val);
              results = val.node.extra.results;
              resolvedObjects = val.node.extra.resolvedObjects;
            }
          } else if (path.isFunction()) {
            globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
            results = [path];
          } else if (path.isConditionalExpression()) {
            globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
            [path.get("consequent"), path.get("alternate")].forEach(expr => {
              globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
              this.collectExpressionInformation(expr);
              results.push(expr.node.extra.results);
              resolvedObjects.push(expr.node.extra.resolvedObjects);
            });
          } else if (path.isCallExpression()) {
            globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
            const callee = path.get("callee");
            let resolvedCallees = [];
            this.collectExpressionInformation(callee);
            callee.node.extra.results.forEach(func => {
              globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
              this.collectExpressionInformation(func);
              const body = func.get("body");
              if (!body.isBlockStatement()) {
                globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
                // slim arrow function        
                this.collectExpressionInformation(body);
                results.push(body.node.extra.results);
              } else {
                globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
                func.node.extra.returns.forEach(returnStatement => {
                  globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
                  this.collectExpressionInformation(returnStatement);
                  results.push(returnStatement.node.extra.results);
                  resolvedObjects.push(returnStatement.node.extra.resolvedObjects);
                });
              }
              // hey we found a callee as well. 
              resolvedCallees.push(func);
            });
            path.node.extra.resolvedCallees = resolvedCallees.flat();
          } else if (path.isMemberExpression()) {
            globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
            const objExpr = path.get("object");
            this.collectExpressionInformation(objExpr);
            let tmp = objExpr.node.extra.resolvedObjects.flat();
            tmp.forEach(result => {
              globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
              this.assignmentsOf(path.get("property").node.name, result).forEach(assignment => {
                globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
                this.collectExpressionInformation(assignment);
                results.push(assignment.node.extra.results);
                resolvedObjects.push(assignment.node.extra.resolvedObjects);
              });
            });
          }
          path.node.extra.resolvedObjects = resolvedObjects.flat();
          path.node.extra.results = results.flat();
        }

        // Returns for a given 'property' and {ObjExpression, [Binding]} all known assignments including the declaration
        assignmentsOf(property, obj) {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
          let result = [];
          this.shadowedBindings(obj.bindings).forEach(binding => {
            globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
            let propertyEntry = this.memberAssignments.get(property) || new Map();
            let memberDependencies = propertyEntry.get("misc") || [];
            memberDependencies.forEach(assignment => result.push(assignment));
            let objEntry = propertyEntry.get(binding);
            if (objEntry) {
              globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
              objEntry.forEach(assignment => result.push(assignment));
            }
          });

          // try to read as much from the given ObjectExpression as possible

          let objExpr = obj.objectExpression; // the nodePath
          if (objExpr && objExpr.isObjectExpression()) {
            globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
            let tmp = objExpr.get("properties").find(path => path.get("key").node.name === property);
            if (tmp) {
              globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
              if (tmp.isObjectProperty()) {
                globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
                result.push(tmp.get("value"));
              } else if (tmp.isObjectMethod()) {
                globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
                result.push(tmp);
              }
            }
          }
          return result;
        }
        assignedValue(path) {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
          if (path.isFunctionDeclaration()) return path;
          if (path.isAssignmentExpression()) return path.get("right");
          if (path.isVariableDeclarator()) {
            globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
            const id = path.get("id");
            if (id.isPattern()) return; // #TODO
            return path.get("init");
          }
          return;
        }

        /* returns all [binding] that the input [binding] may be assigned to.
         * ATTENTION: this only works for object bindings, since literal values are copied in javascript
         * `let a = 4; let b = a` `b` is not shadowed
         *
         *
         * But if `a` is an object it is, so instead of using the actual binding `b`, we use every binding `b` resolves to (including `b`)
         * 
         * //Where is b changed?
         * let a = {x:1};
         * let b = a; // a is shadowed binding
         * a.x = 2; //<--!!!
         * //b is equal to {x:2}
         */
        shadowedBindings(bindings) {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
          if (!bindings) return [];

          /* this should be stored in the members map or in an extra property. 
          * DOES NOT DETECT DEPENDENCIES THROUGH SIMPLE ASSIGNMENTS (a la `a = b`)
          * do this with extra sweep as last enrichment step, when the new property in there
          */
          let result = bindings;
          bindings.forEach(binding => {
            globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
            binding.path.node.extra.resolvedObjects.forEach(obj => {
              globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
              if (obj.bindings) {
                globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
                obj.bindings.forEach(item => result.add(item));
              }
            });
          });
          return result;
        }

        /* returns a [Node] of nodes where the active Expression on this location may be changed
        * DOES NOT care for execution order of the code
        * uses heuristics e.g. fixed recursion depth
        */
        resolveDependenciesAtLocation(location) {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
          let node;
          let dep;
          let dependencyGraph = this;
          this.programPath.traverse({
            CallExpression(path) {
              globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
              if (isAExpr(path) && range(path.node.loc).contains(location.node.loc)) {
                globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
                if (path.node.dependencies != null) {
                  globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
                  dep = path.node.dependencies;
                  console.log("dependencies already collected: ", dep);
                  return;
                }
                path.node.extra.dependencies = dependencyGraph._resolveDependencies(path.get("arguments")[0]);
                node = path.node;
              }
            }
          });
          if (dep) {
            globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
            return dep;
          }
          return node.extra.dependencies;
        }
        resolveDependenciesForMember(memberName) {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
          let deps = [];
          const self = this;
          let dependencyGraph = this;
          this.programPath.traverse({
            Function(path) {
              globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
              if (!path.node.key || path.node.key.name !== memberName) return;
              if (!path.node.extra.dependencies) {
                globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
                path.node.extra.dependencies = dependencyGraph.resolveDependencies(path);
              }
              deps.push(...(path.node.extra.dependencies || []), path.get("key"));
            },
            AssignmentExpression(path) {
              globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
              const left = path.node.left;
              if (t.isMemberExpression(left), t.isThisExpression(left.object) && left.property.name === memberName) {
                globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
                deps.push(path);
              }
            },
            UpdateExpression(path) {
              globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
              const argument = path.node.argument;
              if (t.isMemberExpression(argument), t.isThisExpression(argument.object) && argument.property.name === memberName) {
                globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
                deps.push(path);
              }
            }
            //Todo: Array stuff??
          });

          return deps;
        }
        resolveDependencies(path) {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
          const self = this;
          if ((path.node.extra.visited -= 1) <= 0) {
            globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
            return path.node.extra.dependencies || new Set();
          }
          if (path.node.extra.dependencies) {
            globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
            // the dependencies were already collected... just return them
            return path.node.extra.dependencies;
          }
          let dependencies = new Set([...this.shadowedBindings(path.node.extra.leakingBindings)].map(binding => [...binding.constantViolations]).flat());
          path.node.extra.callExpressions.forEach(callExpression => {
            globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
            callExpression.node.extra.resolvedCallees.forEach(callee => {
              globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
              if (t.isFunction(callee)) {
                globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
                this._resolveDependencies(callee).forEach(dep => dependencies.add(dep));
              }
              if (t.isAssignmentExpression(callee)) {
                globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
                const value = this.assignedValue(callee);
                if (t.isFunction(value) || t.isArrowFunctionExpression(value)) {
                  globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
                  this.resolveDependencies(value).forEach(dep => dependencies.add(dep));
                }
              }
              if (t.isVariableDeclarator(callee)) {
                globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
              } //we should not end up here
            });
          });

          if (path.node.extra.objects.size) {
            globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
            for (const [objExpr, members] of path.node.extra.objects.entries()) {
              globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
              for (const member of members) {
                globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
                self.assignmentsOf(member, {
                  bindings: new Set(objExpr.extra.binding ? [objExpr.extra.binding] : [])
                }).forEach(assignment => {
                  globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
                  dependencies.add(assignment);
                });
              }
            }
          }
          path.node.extra.dependencies = dependencies;
          return dependencies;
        }
      });
      /*MD
      # Helper
      MD*/
      Object.defineProperty(_recorder_._src_client_dependency_graph_graph_js, "DependencyGraph", {
        get() {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
          return DependencyGraph;
        },
        set(thisIsVererySecretVariableName) {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
          _export("DependencyGraph", DependencyGraph = thisIsVererySecretVariableName);
          return true;
        },
        enumerable: true,
        configurable: true
      });
      AEXPR_IDENTIFIER_NAME = 'aexpr';
      Object.defineProperty(_recorder_._src_client_dependency_graph_graph_js, "AEXPR_IDENTIFIER_NAME", {
        get() {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
          return AEXPR_IDENTIFIER_NAME;
        },
        set(thisIsVererySecretVariableName) {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/dependency-graph/graph.js"]++;
          AEXPR_IDENTIFIER_NAME = thisIsVererySecretVariableName;
          return true;
        },
        enumerable: true,
        configurable: true
      });
    }
  };
});