{
  "schemaVersion": 1,
  "slug": "clothing-size-calculator",
  "category": "fashion",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "7044309b13b17ea17fef50a90a6556718a48d2ce76af038a1a8f909f1ddd0761",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/clothing-size-calculator.json",
    "src/engine.js"
  ],
  "runtimeSource": "/sources/engine.txt",
  "runtimeHash": "5c888d8898afbdee36267bb9977829e1e2ac568f6677c8ee87469c139864645c",
  "scope": "The compute function records implemented equations, constants, lookup tables and custom rules. Inputs record defaults and allowed values; outputs record precision and units. Defaults are examples, not recommendations. General background references are not evidence for this specific algorithm.",
  "publishedFormula": {
    "formula": "chestMin = b + i·s; chestMax = b + (i+1)·s; waistMin = chestMin − o; waistMax = chestMax − o",
    "vars": [
      [
        "i",
        "Letter-size index (XS = 0…3XL = 6)"
      ],
      [
        "b",
        "Chest baseline (32 women, 34 men; model inputs)"
      ],
      [
        "s",
        "Step (2 women, 1.5 men; model inputs)"
      ],
      [
        "o",
        "Waist offset (6 women, 4 men; model inputs)"
      ],
      [
        "chestMin",
        "Lower chest/bust range (in)"
      ],
      [
        "chestMax",
        "Upper chest/bust range (in)"
      ],
      [
        "waistMin",
        "Lower waist range (in)"
      ],
      [
        "waistMax",
        "Upper waist range (in)"
      ]
    ],
    "note": "The fixed baselines and increments are illustrative model inputs, not a standard brand conversion. All four displayed ranges are in inches."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "if(!['XS','S','M','L','XL','XXL','3XL'].includes(letter)||!['female','male'].includes(profile))return{__error:'inputError'};const out=(()=>{const i=['XS','S','M','L','XL','XXL','3XL'].indexOf(letter),n=i<0?2:i,base=profile==='female'?32:34,step=profile==='female'?2:1.5,offset=profile==='female'?6:4,chestMin=Math.round(base+n*step),chestMax=Math.round(base+(n+1)*step);return {chestMin,chestMax,waistMin:Math.round(chestMin-offset),waistMax:Math.round(chestMax-offset)};})();if(out.__error)return out;return {...out,chestRange:out.chestMin+' / '+out.chestMax,waistRange:out.waistMin+' / '+out.waistMax};",
    "inputs": [
      {
        "name": "letter",
        "type": "select",
        "default": "M",
        "options": [
          {
            "value": "XS"
          },
          {
            "value": "S"
          },
          {
            "value": "M"
          },
          {
            "value": "L"
          },
          {
            "value": "XL"
          },
          {
            "value": "XXL"
          },
          {
            "value": "3XL"
          }
        ]
      },
      {
        "name": "profile",
        "type": "select",
        "default": "female",
        "options": [
          {
            "value": "female"
          },
          {
            "value": "male"
          }
        ]
      }
    ],
    "outputs": [
      {
        "name": "chestRange",
        "type": "text",
        "precision": 0,
        "unit": "in",
        "range": true
      },
      {
        "name": "waistRange",
        "type": "text",
        "precision": 0,
        "unit": "in",
        "range": true
      },
      {
        "name": "chestMin",
        "precision": 0,
        "unit": "in",
        "trimTrailingZeros": true
      },
      {
        "name": "chestMax",
        "precision": 0,
        "unit": "in",
        "trimTrailingZeros": true
      },
      {
        "name": "waistMin",
        "precision": 0,
        "unit": "in",
        "trimTrailingZeros": true
      },
      {
        "name": "waistMax",
        "precision": 0,
        "unit": "in",
        "trimTrailingZeros": true
      }
    ],
    "interpret": null
  }
}
