
import { dirname as _$_dirname } from "node:path";
import { createRequire as _$_createRequire } from "node:module";
import { fileURLToPath as _$_fileURLToPath } from "node:url";

const require = _$_createRequire(import.meta.url);
const __dirname = _$_dirname(_$_fileURLToPath(import.meta.url));

var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __commonJS = (cb, mod) => function __require() {
  try {
    return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
  } catch (e) {
    throw mod = 0, e;
  }
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));

// node_modules/array-ify/index.js
var require_array_ify = __commonJS({
  "node_modules/array-ify/index.js"(exports, module) {
    "use strict";
    module.exports = function(val) {
      return Array.isArray(val) ? val : [val];
    };
  }
});

// node_modules/is-obj/index.js
var require_is_obj = __commonJS({
  "node_modules/is-obj/index.js"(exports, module) {
    "use strict";
    module.exports = (value) => {
      const type = typeof value;
      return value !== null && (type === "object" || type === "function");
    };
  }
});

// node_modules/dot-prop/index.js
var require_dot_prop = __commonJS({
  "node_modules/dot-prop/index.js"(exports, module) {
    "use strict";
    var isObj = require_is_obj();
    var disallowedKeys = [
      "__proto__",
      "prototype",
      "constructor"
    ];
    var isValidPath = (pathSegments) => !pathSegments.some((segment) => disallowedKeys.includes(segment));
    function getPathSegments(path) {
      const pathArray = path.split(".");
      const parts = [];
      for (let i = 0; i < pathArray.length; i++) {
        let p = pathArray[i];
        while (p[p.length - 1] === "\\" && pathArray[i + 1] !== void 0) {
          p = p.slice(0, -1) + ".";
          p += pathArray[++i];
        }
        parts.push(p);
      }
      if (!isValidPath(parts)) {
        return [];
      }
      return parts;
    }
    module.exports = {
      get(object, path, value) {
        if (!isObj(object) || typeof path !== "string") {
          return value === void 0 ? object : value;
        }
        const pathArray = getPathSegments(path);
        if (pathArray.length === 0) {
          return;
        }
        for (let i = 0; i < pathArray.length; i++) {
          if (!Object.prototype.propertyIsEnumerable.call(object, pathArray[i])) {
            return value;
          }
          object = object[pathArray[i]];
          if (object === void 0 || object === null) {
            if (i !== pathArray.length - 1) {
              return value;
            }
            break;
          }
        }
        return object;
      },
      set(object, path, value) {
        if (!isObj(object) || typeof path !== "string") {
          return object;
        }
        const root = object;
        const pathArray = getPathSegments(path);
        for (let i = 0; i < pathArray.length; i++) {
          const p = pathArray[i];
          if (!isObj(object[p])) {
            object[p] = {};
          }
          if (i === pathArray.length - 1) {
            object[p] = value;
          }
          object = object[p];
        }
        return root;
      },
      delete(object, path) {
        if (!isObj(object) || typeof path !== "string") {
          return false;
        }
        const pathArray = getPathSegments(path);
        for (let i = 0; i < pathArray.length; i++) {
          const p = pathArray[i];
          if (i === pathArray.length - 1) {
            delete object[p];
            return true;
          }
          object = object[p];
          if (!isObj(object)) {
            return false;
          }
        }
      },
      has(object, path) {
        if (!isObj(object) || typeof path !== "string") {
          return false;
        }
        const pathArray = getPathSegments(path);
        if (pathArray.length === 0) {
          return false;
        }
        for (let i = 0; i < pathArray.length; i++) {
          if (isObj(object)) {
            if (!(pathArray[i] in object)) {
              return false;
            }
            object = object[pathArray[i]];
          } else {
            return false;
          }
        }
        return true;
      }
    };
  }
});

// node_modules/compare-func/index.js
var require_compare_func = __commonJS({
  "node_modules/compare-func/index.js"(exports, module) {
    "use strict";
    var arrayify = require_array_ify();
    var dotPropGet = require_dot_prop().get;
    function compareFunc2(prop) {
      return function(a, b) {
        var ret = 0;
        arrayify(prop).some(function(el) {
          var x;
          var y;
          if (typeof el === "function") {
            x = el(a);
            y = el(b);
          } else if (typeof el === "string") {
            x = dotPropGet(a, el);
            y = dotPropGet(b, el);
          } else {
            x = a;
            y = b;
          }
          if (x === y) {
            ret = 0;
            return;
          }
          if (typeof x === "string" && typeof y === "string") {
            ret = x.localeCompare(y);
            return ret !== 0;
          }
          ret = x < y ? -1 : 1;
          return true;
        });
        return ret;
      };
    }
    module.exports = compareFunc2;
  }
});

// node_modules/conventional-changelog-conventionalcommits/src/constants.js
var DEFAULT_COMMIT_TYPES = Object.freeze([
  {
    type: "feat",
    section: "Features"
  },
  {
    type: "feature",
    section: "Features"
  },
  {
    type: "fix",
    section: "Bug Fixes"
  },
  {
    type: "perf",
    section: "Performance Improvements"
  },
  {
    type: "revert",
    section: "Reverts"
  },
  {
    type: "docs",
    section: "Documentation",
    hidden: true
  },
  {
    type: "style",
    section: "Styles",
    hidden: true
  },
  {
    type: "chore",
    section: "Miscellaneous Chores",
    hidden: true
  },
  {
    type: "refactor",
    section: "Code Refactoring",
    hidden: true
  },
  {
    type: "test",
    section: "Tests",
    hidden: true
  },
  {
    type: "build",
    section: "Build System",
    hidden: true
  },
  {
    type: "ci",
    section: "Continuous Integration",
    hidden: true
  }
].map(Object.freeze));

// node_modules/conventional-changelog-conventionalcommits/src/parser.js
function createParserOpts(config) {
  return {
    headerPattern: /^(\w*)(?:\((.*)\))?!?: (.*)$/,
    breakingHeaderPattern: /^(\w*)(?:\((.*)\))?!: (.*)$/,
    headerCorrespondence: [
      "type",
      "scope",
      "subject"
    ],
    noteKeywords: ["BREAKING CHANGE", "BREAKING-CHANGE"],
    revertPattern: /^(?:Revert|revert:)\s"?([\s\S]+?)"?\s*This reverts commit (\w*)\./i,
    revertCorrespondence: ["header", "hash"],
    issuePrefixes: config?.issuePrefixes || ["#"]
  };
}

// node_modules/conventional-changelog-conventionalcommits/src/writer.js
var import_compare_func = __toESM(require_compare_func(), 1);

// node_modules/conventional-changelog-conventionalcommits/src/utils.js
function hasIntersection(a, b) {
  if (!a || !b) {
    return false;
  }
  let listA = a;
  let listB = b;
  if (!Array.isArray(listA)) {
    listA = [listA];
  }
  if (!Array.isArray(listB)) {
    listB = [listB];
  }
  return listA.some((item) => listB.includes(item));
}
function matchScope(config = {}, commit) {
  const {
    scope: targetScope,
    scopeOnly = false
  } = config;
  const includesScope = hasIntersection(
    commit.scope?.split(","),
    targetScope
  );
  return !targetScope || scopeOnly && includesScope || !scopeOnly && (!commit.scope || includesScope);
}

// node_modules/conventional-changelog-conventionalcommits/src/templates.js
var mainTemplate = `{{> header}}
{{#if noteGroups}}
{{#each noteGroups}}

### \u26A0 {{title}}

{{#each notes}}
* {{#if commit.scope}}**{{commit.scope}}:** {{/if}}{{text}}
{{/each}}
{{/each}}
{{/if}}
{{#each commitGroups}}

{{#if title}}
### {{title}}

{{/if}}
{{#each commits}}
{{> commit root=@root}}
{{/each}}
{{/each}}
{{> footer}}
`;
var headerPartial = `## {{#if @root.linkCompare~}}
  [{{version}}]({{compareUrlFormat}})
{{~else}}
  {{~version}}
{{~/if}}
{{~#if title}} "{{title}}"
{{~/if}}
{{~#if date}} ({{date}})
{{/if}}
`;
var commitPartial = `*{{#if scope}} **{{scope}}:**
{{~/if}} {{#if subject}}
  {{~subject}}
{{~else}}
  {{~header}}
{{~/if}}

{{~!-- commit link --}}{{~#if hash}} {{#if @root.linkReferences~}}
  ([{{shortHash}}]({{commitUrlFormat}}))
{{~else}}
  {{~shortHash}}
{{~/if}}{{~/if}}

{{~!-- commit references --}}
{{~#if references~}}
  , closes
  {{~#each references}} {{#if @root.linkReferences~}}
    [
    {{~#if this.owner}}
      {{~this.owner}}/
    {{~/if}}
    {{~this.repository}}{{this.prefix}}{{this.issue}}]({{issueUrlFormat}})
  {{~else}}
    {{~#if this.owner}}
      {{~this.owner}}/
    {{~/if}}
    {{~this.repository}}{{this.prefix}}{{this.issue}}
  {{~/if}}{{/each}}
{{~/if}}

`;
var footerPartial = ``;

// node_modules/conventional-changelog-conventionalcommits/src/writer.js
var COMMIT_HASH_LENGTH = 7;
var releaseAsRegex = /release-as:\s*\w*@?([0-9]+\.[0-9]+\.[0-9a-z]+(-[0-9a-z.]+)?)\s*/i;
var owner = "{{#if this.owner}}{{~this.owner}}{{else}}{{~@root.owner}}{{/if}}";
var host = "{{~@root.host}}";
var repository = "{{#if this.repository}}{{~this.repository}}{{else}}{{~@root.repository}}{{/if}}";
function createWriterOpts(config) {
  const finalConfig = {
    types: DEFAULT_COMMIT_TYPES,
    issueUrlFormat: "{{host}}/{{owner}}/{{repository}}/issues/{{id}}",
    commitUrlFormat: "{{host}}/{{owner}}/{{repository}}/commit/{{hash}}",
    compareUrlFormat: "{{host}}/{{owner}}/{{repository}}/compare/{{previousTag}}...{{currentTag}}",
    userUrlFormat: "{{host}}/{{user}}",
    issuePrefixes: ["#"],
    ...config
  };
  const commitUrlFormat = expandTemplate(finalConfig.commitUrlFormat, {
    host,
    owner,
    repository
  });
  const compareUrlFormat = expandTemplate(finalConfig.compareUrlFormat, {
    host,
    owner,
    repository
  });
  const issueUrlFormat = expandTemplate(finalConfig.issueUrlFormat, {
    host,
    owner,
    repository,
    id: "{{this.issue}}",
    prefix: "{{this.prefix}}"
  });
  const commitGroupOrder = finalConfig.types.flatMap((t) => t.section).filter((t) => t);
  return {
    mainTemplate,
    headerPartial: headerPartial.replace(/{{compareUrlFormat}}/g, compareUrlFormat),
    commitPartial: commitPartial.replace(/{{commitUrlFormat}}/g, commitUrlFormat).replace(/{{issueUrlFormat}}/g, issueUrlFormat),
    footerPartial,
    transform: (commit, context) => {
      let discard = true;
      const issues = [];
      const entry = findTypeEntry(finalConfig.types, commit);
      if (commit.footer && releaseAsRegex.test(commit.footer) || commit.body && releaseAsRegex.test(commit.body)) {
        discard = false;
      }
      const notes = commit.notes.map((note) => {
        discard = false;
        return {
          ...note,
          title: "BREAKING CHANGES"
        };
      });
      if (
        // breaking changes attached to any type are still displayed.
        discard && (entry === void 0 || entry.hidden) || !matchScope(finalConfig, commit)
      ) {
        return void 0;
      }
      const type = entry ? entry.section : commit.type;
      const scope = commit.scope === "*" || finalConfig.scope ? "" : commit.scope;
      const shortHash = typeof commit.hash === "string" ? commit.hash.substring(0, COMMIT_HASH_LENGTH) : commit.shortHash;
      let { subject } = commit;
      if (typeof subject === "string") {
        const issueRegEx = `(${finalConfig.issuePrefixes.join("|")})([a-z0-9]+)`;
        const re = new RegExp(issueRegEx, "g");
        subject = subject.replace(re, (_, prefix, issue) => {
          issues.push(prefix + issue);
          const url = expandTemplate(finalConfig.issueUrlFormat, {
            host: context.host,
            owner: context.owner,
            repository: context.repository,
            id: issue,
            prefix
          });
          return `[${prefix}${issue}](${url})`;
        });
        subject = subject.replace(/`[^`]*`|\B@([a-z0-9](?:-?[a-z0-9/]){0,38})/g, (match, user) => {
          if (!user) {
            return match;
          }
          if (user.includes("/")) {
            return `@${user}`;
          }
          const usernameUrl = expandTemplate(finalConfig.userUrlFormat, {
            host: context.host,
            owner: context.owner,
            repository: context.repository,
            user
          });
          return `[@${user}](${usernameUrl})`;
        });
      }
      const references = commit.references.filter((reference) => !issues.includes(reference.prefix + reference.issue));
      return {
        notes,
        type,
        scope,
        shortHash,
        subject,
        references
      };
    },
    groupBy: "type",
    // the groupings of commit messages, e.g., Features vs., Bug Fixes, are
    // sorted based on their probable importance:
    commitGroupsSort: (a, b) => {
      const gRankA = commitGroupOrder.indexOf(a.title);
      const gRankB = commitGroupOrder.indexOf(b.title);
      return gRankA - gRankB;
    },
    commitsSort: ["scope", "subject"],
    noteGroupsSort: "title",
    notesSort: import_compare_func.default
  };
}
function findTypeEntry(types, commit) {
  const typeKey = (commit.revert ? "revert" : commit.type || "").toLowerCase();
  return types.find((entry) => {
    if (entry.type !== typeKey) {
      return false;
    }
    if (entry.scope && entry.scope !== commit.scope) {
      return false;
    }
    return true;
  });
}
function expandTemplate(template, context) {
  let expanded = template;
  Object.keys(context).forEach((key) => {
    expanded = expanded.replace(new RegExp(`{{${key}}}`, "g"), context[key]);
  });
  return expanded;
}

// node_modules/conventional-changelog-conventionalcommits/src/whatBump.js
function createWhatBump(config = {}) {
  const {
    types = DEFAULT_COMMIT_TYPES,
    bumpStrict = false
  } = config;
  const hiddenTypes = bumpStrict && types.reduce((hiddenTypes2, type) => {
    if (type.hidden) {
      hiddenTypes2.push(type.type);
    }
    return hiddenTypes2;
  }, []);
  return function whatBump(commits) {
    let level = 2;
    let breakings = 0;
    let features = 0;
    let bugfixes = 0;
    commits.forEach((commit) => {
      if (!matchScope(config, commit)) {
        return;
      }
      if (commit.notes.length > 0) {
        breakings += commit.notes.length;
        level = 0;
      } else if (commit.type === "feat" || commit.type === "feature") {
        features += 1;
        if (level === 2) {
          level = 1;
        }
      } else if (bumpStrict && !hiddenTypes.includes(commit.type)) {
        bugfixes += 1;
      }
    });
    if (config?.preMajor && level < 2) {
      level++;
    } else if (bumpStrict && level === 2 && !breakings && !features && !bugfixes) {
      return null;
    }
    return {
      level,
      reason: breakings === 1 ? `There is ${breakings} BREAKING CHANGE and ${features} features` : `There are ${breakings} BREAKING CHANGES and ${features} features`
    };
  };
}

// node_modules/conventional-changelog-conventionalcommits/src/index.js
function createPreset(config) {
  return {
    commits: {
      ignore: config?.ignoreCommits,
      merges: false
    },
    parser: createParserOpts(config),
    writer: createWriterOpts(config),
    whatBump: createWhatBump(config)
  };
}

// src/parser.ts
var parser_default = createPreset({});
export {
  parser_default as default
};
