{
  "mappings": "AAAA,cAAc,gBAAgB,YAAY,gBAAgB;KAGrD,kBAAkB;CACrB;CACA,OAAO;;AAGT,OAAO,cAAM,cACX,QAAQ,mCACR,OAAO;AAST,OAAO,cAAM,sBACX,QAAQ,mCACR,OAAO,oBACN,iBAAiB;AAUpB,OAAO,cAAM,mBACX,QAAQ,mCACR,OAAO,oBACN",
  "names": [],
  "sources": [
    "src/getFontSize.ts"
  ],
  "version": 3,
  "sourcesContent": [
    "import type { FontSizeTokens, FontTokens, Variable } from '@tamagui/core'\nimport { getConfig, isVariable } from '@tamagui/core'\n\ntype GetFontSizeOpts = {\n  relativeSize?: number\n  font?: FontTokens\n}\n\nexport const getFontSize = (\n  inSize: FontSizeTokens | null | undefined,\n  opts?: GetFontSizeOpts\n): number => {\n  const res = getFontSizeVariable(inSize, opts)\n  if (isVariable(res)) {\n    return +res.val\n  }\n  return res ? +res : 16\n}\n\nexport const getFontSizeVariable = (\n  inSize: FontSizeTokens | null | undefined,\n  opts?: GetFontSizeOpts\n): FontSizeTokens | Variable<string> | null | undefined => {\n  const token = getFontSizeToken(inSize, opts)\n  if (!token) {\n    return inSize\n  }\n  const conf = getConfig()\n  const font = conf.fontsParsed[opts?.font || conf.defaultFontToken]\n  return font?.size[token] as Variable<string>\n}\n\nexport const getFontSizeToken = (\n  inSize: FontSizeTokens | null | undefined,\n  opts?: GetFontSizeOpts\n): FontSizeTokens | null => {\n  if (typeof inSize === 'number') {\n    return null\n  }\n  // backwards compat\n  const relativeSize = opts?.relativeSize || 0\n  const conf = getConfig()\n  const font = conf.fontsParsed[opts?.font || conf.defaultFontToken]\n  const fontSize =\n    font?.size ||\n    // fallback to size tokens\n    conf.tokensParsed.size\n  const size =\n    (inSize === '$true' && !('$true' in fontSize) ? '$4' : inSize) ??\n    ('$true' in fontSize ? '$true' : '$4')\n\n  const sizeTokens = Object.keys(fontSize)\n\n  let foundIndex = sizeTokens.indexOf(size)\n  if (foundIndex === -1) {\n    if (size.endsWith('.5')) {\n      foundIndex = sizeTokens.indexOf(size.replace('.5', ''))\n    }\n  }\n  if (process.env.NODE_ENV === 'development') {\n    if (foundIndex === -1) {\n      console.warn('No font size found', size, opts, 'in size tokens', sizeTokens)\n    }\n  }\n  const tokenIndex = Math.min(\n    Math.max(0, foundIndex + relativeSize),\n    sizeTokens.length - 1\n  )\n  return (sizeTokens[tokenIndex] ?? size) as FontSizeTokens\n}\n"
  ]
}