import { isPathSpec as m, toPaths as v } from "@simple-git/args-pathspec"; function* U(e, t) { const n = t === "global"; for (const o of e) o.isGlobal === n && (yield o); } const k = /* @__PURE__ */ new Set([ "--add", "--edit", "--remove-section", "--rename-section", "--replace-all", "--unset", "--unset-all", "-e" ]), S = /* @__PURE__ */ new Set([ "--get", "--get-all", "--get-color", "--get-colorbool", "--get-regexp", "--get-urlmatch", "--list", "-l" ]), P = /* @__PURE__ */ new Set([ "edit", "remove-section", "rename-section", "set", "unset" ]), E = /* @__PURE__ */ new Set(["get", "get-color", "get-colorbool", "list"]); function F(e, t) { for (const { name: o } of U(e, "task")) { if (k.has(o)) return p(!0, t); if (S.has(o)) return p(!1, t); } const n = t.at(0)?.toLowerCase(); return n === void 0 ? null : P.has(n) ? p(!0, t.slice(1)) : E.has(n) ? p(!1, t.slice(1)) : t.length === 1 ? p(!1, t) : p(!0, t); } function p(e = !1, t = []) { const n = t.at(0)?.toLowerCase(); return n === void 0 ? null : { isWrite: e, isRead: !e, key: n, value: t.at(1) }; } function A(e, t) { return t.isWrite && t.value !== void 0 ? { key: t.key, value: t.value, scope: e } : { key: t.key, scope: e }; } function M(e) { const t = e?.indexOf("=") || -1; return !e || t < 0 ? null : { key: e.slice(0, t).trim().toLowerCase(), value: e.slice(t + 1) }; } function N(e) { for (const { name: t } of U(e, "task")) switch (t) { case "--global": return "global"; case "--system": return "system"; case "--worktree": return "worktree"; case "--local": return "local"; case "--file": case "-f": return "file"; } return "local"; } function G({ name: e }) { if (e === "-c" || e === "--config") return "inline"; if (e === "--config-env") return "env"; } function* O(e) { for (const t of e) { const n = G(t), o = n && M(t.value); o && (yield { ...o, scope: n }); } } function L(e, t, n) { const o = { read: [], write: [...O(t)] }; return e === "config" && $( o, N(t), F(t, n) ), o; } function $(e, t, n) { if (n === null) return; const o = A(t, n); n.isWrite ? e.write.push(o) : e.read.push(o); } const x = { short: /* @__PURE__ */ new Map([ ["c", !0] // -c set config key for this invocation ]) }, D = { short: new Map([ ["C", !0], // -C change working directory ["P", !1], // -P no pager (alias for --no-pager) ["h", !1], // -h help ["p", !1], // -p paginate ["v", !1], // -v version ...x.short.entries() ]), long: /* @__PURE__ */ new Set([ "attr-source", "config-env", "exec-path", "git-dir", "list-cmds", "namespace", "super-prefix", "work-tree" ]) }, R = { clone: { short: /* @__PURE__ */ new Map([ ["b", !0], // -b ["j", !0], // -j parallel jobs ["l", !1], // -l local ["n", !1], // -n no-checkout ["o", !0], // -o remote name ["q", !1], // -q quiet ["s", !1], // -s shared ["u", !0] // -u ]), long: /* @__PURE__ */ new Set(["branch", "config", "jobs", "origin", "upload-pack", "u", "template"]) }, commit: { short: /* @__PURE__ */ new Map([ ["C", !0], // -C reuse message ["F", !0], // -F read message from file ["c", !0], // -c reedit message ["m", !0], // -m ["t", !0] // -t