import { c as cu, h as hu } from "./codemirror.es2-DH2syXui.js";
import { a as N } from "./dialog.es-CQI76cVg.js";
var d = Object.defineProperty;
var f = (u, p) => d(u, "name", { value: p, configurable: true });
function b(u, p) {
  for (var o = 0; o < p.length; o++) {
    const s = p[o];
    if (typeof s != "string" && !Array.isArray(s)) {
      for (const i in s)
        if (i !== "default" && !(i in u)) {
          const a = Object.getOwnPropertyDescriptor(s, i);
          a && Object.defineProperty(u, i, a.get ? a : {
            enumerable: true,
            get: () => s[i]
          });
        }
    }
  }
  return Object.freeze(Object.defineProperty(u, Symbol.toStringTag, { value: "Module" }));
}
f(b, "_mergeNamespaces");
var j = { exports: {} };
(function(u, p) {
  (function(o) {
    o(cu(), N);
  })(function(o) {
    o.defineOption("search", { bottom: false });
    function s(e, r, n, t, l) {
      e.openDialog ? e.openDialog(r, l, { value: t, selectValueOnOpen: true, bottom: e.options.search.bottom }) : l(prompt(n, t));
    }
    f(s, "dialog");
    function i(e) {
      return e.phrase("Jump to line:") + ' <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">' + e.phrase("(Use line:column or scroll% syntax)") + "</span>";
    }
    f(i, "getJumpDialog");
    function a(e, r) {
      var n = Number(r);
      return /^[-+]/.test(r) ? e.getCursor().line + n : n - 1;
    }
    f(a, "interpretLine"), o.commands.jumpToLine = function(e) {
      var r = e.getCursor();
      s(e, i(e), e.phrase("Jump to line:"), r.line + 1 + ":" + r.ch, function(n) {
        if (n) {
          var t;
          if (t = /^\s*([\+\-]?\d+)\s*\:\s*(\d+)\s*$/.exec(n))
            e.setCursor(a(e, t[1]), Number(t[2]));
          else if (t = /^\s*([\+\-]?\d+(\.\d+)?)\%\s*/.exec(n)) {
            var l = Math.round(e.lineCount() * Number(t[1]) / 100);
            /^[-+]/.test(t[1]) && (l = r.line + l + 1), e.setCursor(l - 1, r.ch);
          } else
            (t = /^\s*\:?\s*([\+\-]?\d+)\s*/.exec(n)) && e.setCursor(a(e, t[1]), r.ch);
        }
      });
    }, o.keyMap.default["Alt-G"] = "jumpToLine";
  });
})();
var c = j.exports;
const x = /* @__PURE__ */ hu(c), O = /* @__PURE__ */ b({
  __proto__: null,
  default: x
}, [c]);
export {
  O as j
};
//# sourceMappingURL=jump-to-line.es-TscFQD6m.js.map
