"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var X520_exports = {};
__export(X520_exports, {
  X520: () => X520
});
module.exports = __toCommonJS(X520_exports);
var import_DerCodec = require("#codec/DerCodec.js");
var import_MatterError = require("#MatterError.js");
var import_String = require("#util/String.js");
/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
var X520;
((X5202) => {
  X5202.NON_WELL_DEFINED_DATE = /* @__PURE__ */ new Date("9999-12-31 23:59:59Z");
  X5202.OID_TO_FIELD_MAP = {
    // All others are registered dynamically during function creation
    "06092a864886f70d010901": "domainComponent"
  };
  const GenericString_X520 = (id, fieldName) => {
    const oidHex = `5504${import_String.hex.byte(id)}`;
    if (X5202.OID_TO_FIELD_MAP[oidHex] !== void 0 && X5202.OID_TO_FIELD_MAP[oidHex] !== fieldName) {
      throw new import_MatterError.InternalError(
        `X520 GenericString_X520 mapping for OID ${id} already exists with a different field name: "${X5202.OID_TO_FIELD_MAP[oidHex]}" vs "${fieldName}"`
      );
    }
    X5202.OID_TO_FIELD_MAP[oidHex] = fieldName;
    return (data, asPrintedString = false) => {
      let value = data;
      if (asPrintedString) {
        value = (0, import_DerCodec.DatatypeOverride)(import_DerCodec.DerType.PrintableString, value);
      }
      return [(0, import_DerCodec.DerObject)(oidHex, { value })];
    };
  };
  X5202.CommonName = GenericString_X520(3, "commonName");
  X5202.SurName = GenericString_X520(4, "surName");
  X5202.SerialNumber = GenericString_X520(5, "serialNum");
  X5202.CountryName = GenericString_X520(6, "countryName");
  X5202.LocalityName = GenericString_X520(7, "localityName");
  X5202.StateOrProvinceName = GenericString_X520(8, "stateOrProvinceName");
  X5202.OrganisationName = GenericString_X520(10, "orgName");
  X5202.OrganizationalUnitName = GenericString_X520(11, "orgUnitName");
  X5202.Title = GenericString_X520(12, "title");
  X5202.Name = GenericString_X520(41, "name");
  X5202.GivenName = GenericString_X520(42, "givenName");
  X5202.Initials = GenericString_X520(43, "initials");
  X5202.GenerationQualifier = GenericString_X520(44, "genQualifier");
  X5202.DnQualifier = GenericString_X520(46, "dnQualifier");
  X5202.Pseudonym = GenericString_X520(65, "pseudonym");
  X5202.DomainComponent = (value) => [
    (0, import_DerCodec.DerObject)("06092A864886F70D010901", { value: (0, import_DerCodec.DatatypeOverride)(import_DerCodec.DerType.IA5String, value) })
  ];
})(X520 || (X520 = {}));
//# sourceMappingURL=X520.js.map
