Z21552

{
    "Z1K1": "Z2",
    "Z2K1": {
        "Z1K1": "Z6",
        "Z6K1": "Z21552"
    },
    "Z2K2": {
        "Z1K1": "Z14",
        "Z14K1": "Z21539",
        "Z14K3": {
            "Z1K1": "Z16",
            "Z16K1": "Z600",
            "Z16K2": "function Z21539(Z21539K1) {\n  // List of valid elements (periodic table symbols)\n  const validElements = [\n    'H', 'He', 'Li', 'Be', 'B', 'C', 'N', 'O', 'F', 'Ne', 'Na', 'Mg', 'Al', 'Si', 'P', 'S', 'Cl', 'Ar', \n    'K', 'Ca', 'Sc', 'Ti', 'V', 'Cr', 'Mn', 'Fe', 'Co', 'Ni', 'Cu', 'Zn', 'Ga', 'Ge', 'As', 'Se', 'Br', \n    'Kr', 'Rb', 'Sr', 'Y', 'Zr', 'Nb', 'Mo', 'Tc', 'Ru', 'Rh', 'Pd', 'Ag', 'Cd', 'In', 'Sn', 'Sb', 'I', \n    'Xe', 'Cs', 'Ba', 'La', 'Ce', 'Pr', 'Nd', 'Pm', 'Sm', 'Eu', 'Gd', 'Tb', 'Dy', 'Ho', 'Er', 'Tm', 'Yb', \n    'Lu', 'Hf', 'Ta', 'W', 'Re', 'Os', 'Ir', 'Pt', 'Au', 'Hg', 'Tl', 'Pb', 'Bi', 'Po', 'At', 'Rn', 'Fr', \n    'Ra', 'Ac', 'Th', 'Pa', 'U', 'Np', 'Pu', 'Am', 'Cm', 'Bk', 'Cf', 'Es', 'Fm', 'Md', 'No', 'Lr', 'Rf', \n    'Db', 'Sg', 'Bh', 'Hs', 'Mt', 'Ds', 'Rg', 'Cn', 'Nh', 'Fl', 'Mc', 'Lv', 'Ts', 'Og'\n  ];\n\n  const inchi = Z21539K1;\n\n  // Basic check for correct InChI prefix and general structure\n  const inchiPattern = /^InChI=1S?\\/[A-Za-z0-9\\-+(),\\/*]+$/;\n  if (!inchiPattern.test(inchi)) {\n    return false;\n  }\n\n  const layers = inchi.split('/');\n\n  // 1. Validate the molecular formula (basic element and number matching)\n  const molecularFormulaPattern = /^([A-Z][a-z]?[0-9]*|\\([A-Za-z0-9\\-+]+\\))+/;\n  const invalidElementPattern = /[^A-Za-z0-9\\-+(),*]/;\n  if (!molecularFormulaPattern.test(layers[1]) || invalidElementPattern.test(layers[1])) {\n    return false;\n  }\n\n  // Split molecular formula into components (elements and numbers)\n  const formulaParts = layers[1].match(/[A-Z][a-z]?[0-9]*|\\([A-Za-z0-9\\-+]+\\)/g);\n\n  // Check each element in the formula\n  for (let part of formulaParts) {\n    const element = part.match(/[A-Z][a-z]?/)[0]; // Extract element symbol\n    if (!validElements.includes(element)) {\n      return false; // If an invalid element is found, return false\n    }\n  }\n\n  // Check if the layers have stereochemistry or configuration info\n  const stereochemistryPattern = /^t\\d+(-\\d+)*$/;  // Matches /t followed by digits and optional hyphen (e.g., /t1-2-3)\n  const doubleBondStereochemistryPattern = /^m\\d+(-\\d+)*$/;  // Matches /m followed by digits and optional hyphen (e.g., /m1-2)\n  const parityPattern = /^s[12]$/;  // Matches /s1 or /s2\n\n  // Validate tetrahedral stereochemistry layer (if exists)\n  if (layers[4] \u0026\u0026 !stereochemistryPattern.test(layers[4]) \u0026\u0026 layers[4] !== 't1-') {\n    return false;  // Allow t1- as a valid exception\n  }\n\n  // Validate double bond stereochemistry layer (if exists)\n  if (layers[5]) {\n    // Check that bond indices are within 1 of each other\n    const bondIndices = layers[5].match(/\\d+/g);\n    if (bondIndices \u0026\u0026 bondIndices.length \u003E 1) {\n      for (let i = 0; i \u003C bondIndices.length - 1; i++) {\n        const currentBond = parseInt(bondIndices[i], 10);\n        const nextBond = parseInt(bondIndices[i + 1], 10);\n        if (Math.abs(currentBond - nextBond) \u003E 1) {\n          return false;  // Bonds must only be within 1 of each other\n        }\n      }\n    }\n    if (!doubleBondStereochemistryPattern.test(layers[5])) {\n      return false;\n    }\n  }\n\n  // Validate stereochemistry parity layer (if exists)\n  if (layers[6] \u0026\u0026 !parityPattern.test(layers[6])) {\n    return false;\n  }\n\n  return true;\n}\n"
        }
    },
    "Z2K3": {
        "Z1K1": "Z12",
        "Z12K1": [
            "Z11",
            {
                "Z1K1": "Z11",
                "Z11K1": "Z1002",
                "Z11K2": "International Chemical Identifier validation, JS"
            },
            {
                "Z1K1": "Z11",
                "Z11K1": "Z1004",
                "Z11K2": "est-ce un Internat. Chemical Id. valide ?, Python"
            }
        ]
    },
    "Z2K4": {
        "Z1K1": "Z32",
        "Z32K1": [
            "Z31"
        ]
    },
    "Z2K5": {
        "Z1K1": "Z12",
        "Z12K1": [
            "Z11"
        ]
    }
}