System.register([], function (_export, _context) {
  "use strict";

  var __SystemJSRewritingHack;
  function openLocationInBrowser(location) {
    const start = {
      line: location.start.line - 1,
      ch: location.start.column
    };
    const end = {
      line: location.end.line - 1,
      ch: location.end.column
    };
    lively.files.exists(location.file).then(exists => {
      if (exists) {
        lively.openBrowser(location.file, true, {
          start,
          end
        }, false, undefined, true);
      } else {
        lively.notify("Unable to find file:" + location.file);
      }
    });
  }
  async function navigateToTimeline(timelineCallback) {
    const existingTimelines = document.body.querySelectorAll('aexpr-timeline');
    if (existingTimelines.length > 0) {
      const timeline = existingTimelines[0];
      timelineCallback(timeline);
      timeline.parentElement.focus();
      timeline.focus();
      return;
    }
    return lively.openComponentInWindow("aexpr-timeline").then(timeline => {
      timelineCallback(timeline);
    });
  }
  async function navigateToGraph(aexprs, event) {
    const existingGraph = document.body.querySelectorAll('aexpr-graph');
    if (existingGraph.length > 0) {
      const graph = existingGraph[0];
      graph.setAExprs(aexprs, event);
      graph.parentElement.focus();
      graph.focus();
      return;
    }
    lively.openComponentInWindow("aexpr-graph").then(graph => {
      graph.setAExprs(aexprs, event);
    });
  }
  function toValueString(value) {
    let valueString = value && value.toString ? value.toString() : value;
    if (typeof value === 'string' || value instanceof String) {
      valueString = "\"" + valueString + "\"";
    }
    if (typeof value === "number") {
      // Max 2 digits after comma
      return +parseFloat(value).toFixed(2);
    }
    return valueString;
  }
  function fileNameString(file) {
    return file.substring(file.lastIndexOf('/') + 1);
  }
  _export({
    openLocationInBrowser: openLocationInBrowser,
    navigateToTimeline: navigateToTimeline,
    navigateToGraph: navigateToGraph,
    toValueString: toValueString,
    fileNameString: fileNameString
  });
  return {
    setters: [],
    execute: function () {
      __SystemJSRewritingHack = {};
      _recorder_._https__lively_kernel_org_lively4_lively4_ansgar_src_client_reactive_components_basic_aexpr_debugging_utils_js = _recorder_._https__lively_kernel_org_lively4_lively4_ansgar_src_client_reactive_components_basic_aexpr_debugging_utils_js || {};
      Object.defineProperty(_recorder_._https__lively_kernel_org_lively4_lively4_ansgar_src_client_reactive_components_basic_aexpr_debugging_utils_js, "fileNameString", {
        get() {
          return fileNameString;
        },
        set(thisIsVererySecretVariableName) {
          _export("fileNameString", fileNameString = thisIsVererySecretVariableName);
          return true;
        },
        enumerable: true,
        configurable: true
      });
      Object.defineProperty(_recorder_._https__lively_kernel_org_lively4_lively4_ansgar_src_client_reactive_components_basic_aexpr_debugging_utils_js, "toValueString", {
        get() {
          return toValueString;
        },
        set(thisIsVererySecretVariableName) {
          _export("toValueString", toValueString = thisIsVererySecretVariableName);
          return true;
        },
        enumerable: true,
        configurable: true
      });
      Object.defineProperty(_recorder_._https__lively_kernel_org_lively4_lively4_ansgar_src_client_reactive_components_basic_aexpr_debugging_utils_js, "navigateToGraph", {
        get() {
          return navigateToGraph;
        },
        set(thisIsVererySecretVariableName) {
          _export("navigateToGraph", navigateToGraph = thisIsVererySecretVariableName);
          return true;
        },
        enumerable: true,
        configurable: true
      });
      Object.defineProperty(_recorder_._https__lively_kernel_org_lively4_lively4_ansgar_src_client_reactive_components_basic_aexpr_debugging_utils_js, "navigateToTimeline", {
        get() {
          return navigateToTimeline;
        },
        set(thisIsVererySecretVariableName) {
          _export("navigateToTimeline", navigateToTimeline = thisIsVererySecretVariableName);
          return true;
        },
        enumerable: true,
        configurable: true
      });
      Object.defineProperty(_recorder_._https__lively_kernel_org_lively4_lively4_ansgar_src_client_reactive_components_basic_aexpr_debugging_utils_js, "openLocationInBrowser", {
        get() {
          return openLocationInBrowser;
        },
        set(thisIsVererySecretVariableName) {
          _export("openLocationInBrowser", openLocationInBrowser = thisIsVererySecretVariableName);
          return true;
        },
        enumerable: true,
        configurable: true
      });
    }
  };
});