{ "version": 3, "sources": ["../../node_modules/color-name/index.js", "../../node_modules/color-parse/index.mjs", "../../node_modules/color-space/rgb.js", "../../node_modules/color-space/hsl.js", "../../node_modules/color-rgba/index.mjs", "../src/screen_gfx.ts", "../src/shield_text.ts", "../src/custom_shields.ts", "../src/shield_canvas_draw.ts", "../src/shield_banner.ts", "../src/shield.ts", "../src/document_graphics.ts", "../src/shield_renderer.ts", "../src/shield_helper.ts"], "sourcesContent": ["'use strict'\r\n\r\nmodule.exports = {\r\n\t\"aliceblue\": [240, 248, 255],\r\n\t\"antiquewhite\": [250, 235, 215],\r\n\t\"aqua\": [0, 255, 255],\r\n\t\"aquamarine\": [127, 255, 212],\r\n\t\"azure\": [240, 255, 255],\r\n\t\"beige\": [245, 245, 220],\r\n\t\"bisque\": [255, 228, 196],\r\n\t\"black\": [0, 0, 0],\r\n\t\"blanchedalmond\": [255, 235, 205],\r\n\t\"blue\": [0, 0, 255],\r\n\t\"blueviolet\": [138, 43, 226],\r\n\t\"brown\": [165, 42, 42],\r\n\t\"burlywood\": [222, 184, 135],\r\n\t\"cadetblue\": [95, 158, 160],\r\n\t\"chartreuse\": [127, 255, 0],\r\n\t\"chocolate\": [210, 105, 30],\r\n\t\"coral\": [255, 127, 80],\r\n\t\"cornflowerblue\": [100, 149, 237],\r\n\t\"cornsilk\": [255, 248, 220],\r\n\t\"crimson\": [220, 20, 60],\r\n\t\"cyan\": [0, 255, 255],\r\n\t\"darkblue\": [0, 0, 139],\r\n\t\"darkcyan\": [0, 139, 139],\r\n\t\"darkgoldenrod\": [184, 134, 11],\r\n\t\"darkgray\": [169, 169, 169],\r\n\t\"darkgreen\": [0, 100, 0],\r\n\t\"darkgrey\": [169, 169, 169],\r\n\t\"darkkhaki\": [189, 183, 107],\r\n\t\"darkmagenta\": [139, 0, 139],\r\n\t\"darkolivegreen\": [85, 107, 47],\r\n\t\"darkorange\": [255, 140, 0],\r\n\t\"darkorchid\": [153, 50, 204],\r\n\t\"darkred\": [139, 0, 0],\r\n\t\"darksalmon\": [233, 150, 122],\r\n\t\"darkseagreen\": [143, 188, 143],\r\n\t\"darkslateblue\": [72, 61, 139],\r\n\t\"darkslategray\": [47, 79, 79],\r\n\t\"darkslategrey\": [47, 79, 79],\r\n\t\"darkturquoise\": [0, 206, 209],\r\n\t\"darkviolet\": [148, 0, 211],\r\n\t\"deeppink\": [255, 20, 147],\r\n\t\"deepskyblue\": [0, 191, 255],\r\n\t\"dimgray\": [105, 105, 105],\r\n\t\"dimgrey\": [105, 105, 105],\r\n\t\"dodgerblue\": [30, 144, 255],\r\n\t\"firebrick\": [178, 34, 34],\r\n\t\"floralwhite\": [255, 250, 240],\r\n\t\"forestgreen\": [34, 139, 34],\r\n\t\"fuchsia\": [255, 0, 255],\r\n\t\"gainsboro\": [220, 220, 220],\r\n\t\"ghostwhite\": [248, 248, 255],\r\n\t\"gold\": [255, 215, 0],\r\n\t\"goldenrod\": [218, 165, 32],\r\n\t\"gray\": [128, 128, 128],\r\n\t\"green\": [0, 128, 0],\r\n\t\"greenyellow\": [173, 255, 47],\r\n\t\"grey\": [128, 128, 128],\r\n\t\"honeydew\": [240, 255, 240],\r\n\t\"hotpink\": [255, 105, 180],\r\n\t\"indianred\": [205, 92, 92],\r\n\t\"indigo\": [75, 0, 130],\r\n\t\"ivory\": [255, 255, 240],\r\n\t\"khaki\": [240, 230, 140],\r\n\t\"lavender\": [230, 230, 250],\r\n\t\"lavenderblush\": [255, 240, 245],\r\n\t\"lawngreen\": [124, 252, 0],\r\n\t\"lemonchiffon\": [255, 250, 205],\r\n\t\"lightblue\": [173, 216, 230],\r\n\t\"lightcoral\": [240, 128, 128],\r\n\t\"lightcyan\": [224, 255, 255],\r\n\t\"lightgoldenrodyellow\": [250, 250, 210],\r\n\t\"lightgray\": [211, 211, 211],\r\n\t\"lightgreen\": [144, 238, 144],\r\n\t\"lightgrey\": [211, 211, 211],\r\n\t\"lightpink\": [255, 182, 193],\r\n\t\"lightsalmon\": [255, 160, 122],\r\n\t\"lightseagreen\": [32, 178, 170],\r\n\t\"lightskyblue\": [135, 206, 250],\r\n\t\"lightslategray\": [119, 136, 153],\r\n\t\"lightslategrey\": [119, 136, 153],\r\n\t\"lightsteelblue\": [176, 196, 222],\r\n\t\"lightyellow\": [255, 255, 224],\r\n\t\"lime\": [0, 255, 0],\r\n\t\"limegreen\": [50, 205, 50],\r\n\t\"linen\": [250, 240, 230],\r\n\t\"magenta\": [255, 0, 255],\r\n\t\"maroon\": [128, 0, 0],\r\n\t\"mediumaquamarine\": [102, 205, 170],\r\n\t\"mediumblue\": [0, 0, 205],\r\n\t\"mediumorchid\": [186, 85, 211],\r\n\t\"mediumpurple\": [147, 112, 219],\r\n\t\"mediumseagreen\": [60, 179, 113],\r\n\t\"mediumslateblue\": [123, 104, 238],\r\n\t\"mediumspringgreen\": [0, 250, 154],\r\n\t\"mediumturquoise\": [72, 209, 204],\r\n\t\"mediumvioletred\": [199, 21, 133],\r\n\t\"midnightblue\": [25, 25, 112],\r\n\t\"mintcream\": [245, 255, 250],\r\n\t\"mistyrose\": [255, 228, 225],\r\n\t\"moccasin\": [255, 228, 181],\r\n\t\"navajowhite\": [255, 222, 173],\r\n\t\"navy\": [0, 0, 128],\r\n\t\"oldlace\": [253, 245, 230],\r\n\t\"olive\": [128, 128, 0],\r\n\t\"olivedrab\": [107, 142, 35],\r\n\t\"orange\": [255, 165, 0],\r\n\t\"orangered\": [255, 69, 0],\r\n\t\"orchid\": [218, 112, 214],\r\n\t\"palegoldenrod\": [238, 232, 170],\r\n\t\"palegreen\": [152, 251, 152],\r\n\t\"paleturquoise\": [175, 238, 238],\r\n\t\"palevioletred\": [219, 112, 147],\r\n\t\"papayawhip\": [255, 239, 213],\r\n\t\"peachpuff\": [255, 218, 185],\r\n\t\"peru\": [205, 133, 63],\r\n\t\"pink\": [255, 192, 203],\r\n\t\"plum\": [221, 160, 221],\r\n\t\"powderblue\": [176, 224, 230],\r\n\t\"purple\": [128, 0, 128],\r\n\t\"rebeccapurple\": [102, 51, 153],\r\n\t\"red\": [255, 0, 0],\r\n\t\"rosybrown\": [188, 143, 143],\r\n\t\"royalblue\": [65, 105, 225],\r\n\t\"saddlebrown\": [139, 69, 19],\r\n\t\"salmon\": [250, 128, 114],\r\n\t\"sandybrown\": [244, 164, 96],\r\n\t\"seagreen\": [46, 139, 87],\r\n\t\"seashell\": [255, 245, 238],\r\n\t\"sienna\": [160, 82, 45],\r\n\t\"silver\": [192, 192, 192],\r\n\t\"skyblue\": [135, 206, 235],\r\n\t\"slateblue\": [106, 90, 205],\r\n\t\"slategray\": [112, 128, 144],\r\n\t\"slategrey\": [112, 128, 144],\r\n\t\"snow\": [255, 250, 250],\r\n\t\"springgreen\": [0, 255, 127],\r\n\t\"steelblue\": [70, 130, 180],\r\n\t\"tan\": [210, 180, 140],\r\n\t\"teal\": [0, 128, 128],\r\n\t\"thistle\": [216, 191, 216],\r\n\t\"tomato\": [255, 99, 71],\r\n\t\"turquoise\": [64, 224, 208],\r\n\t\"violet\": [238, 130, 238],\r\n\t\"wheat\": [245, 222, 179],\r\n\t\"white\": [255, 255, 255],\r\n\t\"whitesmoke\": [245, 245, 245],\r\n\t\"yellow\": [255, 255, 0],\r\n\t\"yellowgreen\": [154, 205, 50]\r\n};\r\n", "/**\n * @module color-parse\n */\nimport names from 'color-name'\n\nexport default parse\n\n/**\n * Base hues\n * http://dev.w3.org/csswg/css-color/#typedef-named-hue\n */\n//FIXME: use external hue detector\nvar baseHues = {\n\tred: 0,\n\torange: 60,\n\tyellow: 120,\n\tgreen: 180,\n\tblue: 240,\n\tpurple: 300\n}\n\n/**\n * Parse color from the string passed\n *\n * @return {Object} A space indicator `space`, an array `values` and `alpha`\n */\nfunction parse(cstr) {\n\tvar m, parts = [], alpha = 1, space\n\n\tif (typeof cstr === 'string') {\n\t\tcstr = cstr.toLowerCase();\n\n\t\t//keyword\n\t\tif (names[cstr]) {\n\t\t\tparts = names[cstr].slice()\n\t\t\tspace = 'rgb'\n\t\t}\n\n\t\t//reserved words\n\t\telse if (cstr === 'transparent') {\n\t\t\talpha = 0\n\t\t\tspace = 'rgb'\n\t\t\tparts = [0, 0, 0]\n\t\t}\n\n\t\t//hex\n\t\telse if (/^#[A-Fa-f0-9]+$/.test(cstr)) {\n\t\t\tvar base = cstr.slice(1)\n\t\t\tvar size = base.length\n\t\t\tvar isShort = size <= 4\n\t\t\talpha = 1\n\n\t\t\tif (isShort) {\n\t\t\t\tparts = [\n\t\t\t\t\tparseInt(base[0] + base[0], 16),\n\t\t\t\t\tparseInt(base[1] + base[1], 16),\n\t\t\t\t\tparseInt(base[2] + base[2], 16)\n\t\t\t\t]\n\t\t\t\tif (size === 4) {\n\t\t\t\t\talpha = parseInt(base[3] + base[3], 16) / 255\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tparts = [\n\t\t\t\t\tparseInt(base[0] + base[1], 16),\n\t\t\t\t\tparseInt(base[2] + base[3], 16),\n\t\t\t\t\tparseInt(base[4] + base[5], 16)\n\t\t\t\t]\n\t\t\t\tif (size === 8) {\n\t\t\t\t\talpha = parseInt(base[6] + base[7], 16) / 255\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!parts[0]) parts[0] = 0\n\t\t\tif (!parts[1]) parts[1] = 0\n\t\t\tif (!parts[2]) parts[2] = 0\n\n\t\t\tspace = 'rgb'\n\t\t}\n\n\t\t//color space\n\t\telse if (m = /^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\\s*\\(([^\\)]*)\\)/.exec(cstr)) {\n\t\t\tvar name = m[1]\n\t\t\tvar isRGB = name === 'rgb'\n\t\t\tvar base = name.replace(/a$/, '')\n\t\t\tspace = base\n\t\t\tvar size = base === 'cmyk' ? 4 : base === 'gray' ? 1 : 3\n\t\t\tparts = m[2].trim()\n\t\t\t\t.split(/\\s*[,\\/]\\s*|\\s+/)\n\t\t\t\t.map(function (x, i) {\n\t\t\t\t\t//\n\t\t\t\t\tif (/%$/.test(x)) {\n\t\t\t\t\t\t//alpha\n\t\t\t\t\t\tif (i === size) return parseFloat(x) / 100\n\t\t\t\t\t\t//rgb\n\t\t\t\t\t\tif (base === 'rgb') return parseFloat(x) * 255 / 100\n\t\t\t\t\t\treturn parseFloat(x)\n\t\t\t\t\t}\n\t\t\t\t\t//hue\n\t\t\t\t\telse if (base[i] === 'h') {\n\t\t\t\t\t\t//\n\t\t\t\t\t\tif (/deg$/.test(x)) {\n\t\t\t\t\t\t\treturn parseFloat(x)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//\n\t\t\t\t\t\telse if (baseHues[x] !== undefined) {\n\t\t\t\t\t\t\treturn baseHues[x]\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn parseFloat(x)\n\t\t\t\t})\n\n\t\t\tif (name === base) parts.push(1)\n\t\t\talpha = (isRGB) ? 1 : (parts[size] === undefined) ? 1 : parts[size]\n\t\t\tparts = parts.slice(0, size)\n\t\t}\n\n\t\t//named channels case\n\t\telse if (cstr.length > 10 && /[0-9](?:\\s|\\/)/.test(cstr)) {\n\t\t\tparts = cstr.match(/([0-9]+)/g).map(function (value) {\n\t\t\t\treturn parseFloat(value)\n\t\t\t})\n\n\t\t\tspace = cstr.match(/([a-z])/ig).join('').toLowerCase()\n\t\t}\n\t}\n\n\t//numeric case\n\telse if (!isNaN(cstr)) {\n\t\tspace = 'rgb'\n\t\tparts = [cstr >>> 16, (cstr & 0x00ff00) >>> 8, cstr & 0x0000ff]\n\t}\n\n\t//array-like\n\telse if (Array.isArray(cstr) || cstr.length) {\n\t\tparts = [cstr[0], cstr[1], cstr[2]]\n\t\tspace = 'rgb'\n\t\talpha = cstr.length === 4 ? cstr[3] : 1\n\t}\n\n\t//object case - detects css cases of rgb and hsl\n\telse if (cstr instanceof Object) {\n\t\tif (cstr.r != null || cstr.red != null || cstr.R != null) {\n\t\t\tspace = 'rgb'\n\t\t\tparts = [\n\t\t\t\tcstr.r || cstr.red || cstr.R || 0,\n\t\t\t\tcstr.g || cstr.green || cstr.G || 0,\n\t\t\t\tcstr.b || cstr.blue || cstr.B || 0\n\t\t\t]\n\t\t}\n\t\telse {\n\t\t\tspace = 'hsl'\n\t\t\tparts = [\n\t\t\t\tcstr.h || cstr.hue || cstr.H || 0,\n\t\t\t\tcstr.s || cstr.saturation || cstr.S || 0,\n\t\t\t\tcstr.l || cstr.lightness || cstr.L || cstr.b || cstr.brightness\n\t\t\t]\n\t\t}\n\n\t\talpha = cstr.a || cstr.alpha || cstr.opacity || 1\n\n\t\tif (cstr.opacity != null) alpha /= 100\n\t}\n\n\treturn {\n\t\tspace: space,\n\t\tvalues: parts,\n\t\talpha: alpha\n\t}\n}\n", "/**\n * RGB space.\n *\n * @module color-space/rgb\n */\n\nexport default {\n\tname: 'rgb',\n\tmin: [0,0,0],\n\tmax: [255,255,255],\n\tchannel: ['red', 'green', 'blue'],\n\talias: ['RGB']\n};\n", "/**\n * @module color-space/hsl\n */\nimport rgb from './rgb.js';\n\nexport default {\n\tname: 'hsl',\n\tmin: [0,0,0],\n\tmax: [360,100,100],\n\tchannel: ['hue', 'saturation', 'lightness'],\n\talias: ['HSL'],\n\n\trgb: function(hsl) {\n\t\tvar h = hsl[0]/360, s = hsl[1]/100, l = hsl[2]/100, t1, t2, t3, rgb, val, i=0;\n\n\t\tif (s === 0) return val = l * 255, [val, val, val];\n\n\t\tt2 = l < 0.5 ? l * (1 + s) : l + s - l * s;\n\t\tt1 = 2 * l - t2;\n\n\t\trgb = [0, 0, 0];\n\t\tfor (;i<3;) {\n\t\t\tt3 = h + 1 / 3 * - (i - 1);\n\t\t\tt3 < 0 ? t3++ : t3 > 1 && t3--;\n\t\t\tval = 6 * t3 < 1 ? t1 + (t2 - t1) * 6 * t3 :\n\t\t\t2 * t3 < 1 ? t2 :\n\t\t\t3 * t3 < 2 ? t1 + (t2 - t1) * (2 / 3 - t3) * 6 :\n\t\t\tt1;\n\t\t\trgb[i++] = val * 255;\n\t\t}\n\n\t\treturn rgb;\n\t}\n};\n\n\n//extend rgb\nrgb.hsl = function(rgb) {\n\tvar r = rgb[0]/255,\n\t\t\tg = rgb[1]/255,\n\t\t\tb = rgb[2]/255,\n\t\t\tmin = Math.min(r, g, b),\n\t\t\tmax = Math.max(r, g, b),\n\t\t\tdelta = max - min,\n\t\t\th, s, l;\n\n\tif (max === min) {\n\t\th = 0;\n\t}\n\telse if (r === max) {\n\t\th = (g - b) / delta;\n\t}\n\telse if (g === max) {\n\t\th = 2 + (b - r) / delta;\n\t}\n\telse if (b === max) {\n\t\th = 4 + (r - g)/ delta;\n\t}\n\n\th = Math.min(h * 60, 360);\n\n\tif (h < 0) {\n\t\th += 360;\n\t}\n\n\tl = (min + max) / 2;\n\n\tif (max === min) {\n\t\ts = 0;\n\t}\n\telse if (l <= 0.5) {\n\t\ts = delta / (max + min);\n\t}\n\telse {\n\t\ts = delta / (2 - max - min);\n\t}\n\n\treturn [h, s * 100, l * 100];\n};\n", "/** @module color-rgba */\r\nimport parse from 'color-parse'\r\nimport rgb from 'color-space/rgb.js'\r\nimport hsl from 'color-space/hsl.js'\r\n\r\nexport default function rgba (color) {\r\n\t// template literals\r\n\tif (Array.isArray(color) && color.raw) color = String.raw(...arguments)\r\n\r\n\tvar values, i, l\r\n\r\n\t//attempt to parse non-array arguments\r\n\tvar parsed = parse(color)\r\n\r\n\tif (!parsed.space) return []\r\n\r\n\tconst min = parsed.space[0] === 'h' ? hsl.min : rgb.min\r\n\tconst max = parsed.space[0] === 'h' ? hsl.max : rgb.max\r\n\r\n\tvalues = Array(3)\r\n\tvalues[0] = Math.min(Math.max(parsed.values[0], min[0]), max[0])\r\n\tvalues[1] = Math.min(Math.max(parsed.values[1], min[1]), max[1])\r\n\tvalues[2] = Math.min(Math.max(parsed.values[2], min[2]), max[2])\r\n\r\n\tif (parsed.space[0] === 'h') {\r\n\t\tvalues = hsl.rgb(values)\r\n\t}\r\n\r\n\tvalues.push(Math.min(Math.max(parsed.alpha, 0), 1))\r\n\r\n\treturn values\r\n}\r\n", "import { StyleImage } from \"maplibre-gl\";\n\nimport rgba from \"color-rgba\";\n\nconst defaultFontFamily = '\"sans-serif-condensed\", \"Arial Narrow\", sans-serif';\nexport const shieldFont = (size: number, fontFamily: string) =>\n `condensed 500 ${size}px ${fontFamily || defaultFontFamily}`;\n\n//If a computed shield font size is below this value, choose a wider shield if possible\nexport const fontSizeThreshold = 11.8;\n\n// Replaces `sourceVal` with a blend of `lightenVal` and `darkenVal` proportional to the brightness;\n// i.e. white becomes `darkenVal`, black becomes `lightenVal`, and anit-aliased pixels remain anit-aliased\nexport function blendedColorVal(sourceVal, lightenVal, darkenVal) {\n return (\n 255 -\n (sourceVal / 255) * (255 - darkenVal) -\n (1 - sourceVal / 255) * (255 - lightenVal)\n );\n}\n\nexport function copyPixel(source, dest, sourceOffset, destOffset) {\n //Red\n dest[destOffset] = source[sourceOffset];\n //Green\n dest[destOffset + 1] = source[sourceOffset + 1];\n //Blue\n dest[destOffset + 2] = source[sourceOffset + 2];\n //Alpha\n dest[destOffset + 3] = source[sourceOffset + 3];\n}\n\nexport function copyAndRecolorPixel(\n source,\n dest,\n sourceOffset,\n destOffset,\n colorLighten,\n colorDarken\n) {\n //Red\n dest[destOffset] = blendedColorVal(\n source[sourceOffset],\n colorLighten[0],\n colorDarken[0]\n );\n //Green\n dest[destOffset + 1] = blendedColorVal(\n source[sourceOffset + 1],\n colorLighten[1],\n colorDarken[1]\n );\n //Blue\n dest[destOffset + 2] = blendedColorVal(\n source[sourceOffset + 2],\n colorLighten[2],\n colorDarken[2]\n );\n //Alpha\n dest[destOffset + 3] = source[sourceOffset + 3];\n}\n\nexport function transposeImageData(\n destination: CanvasRenderingContext2D,\n source: StyleImage,\n yOffset: number,\n verticalReflect: boolean,\n colorLighten: string,\n colorDarken: string\n): void {\n let imgData = destination.createImageData(\n source.data.width,\n source.data.height\n );\n\n let pixelCopyFn =\n colorLighten || colorDarken ? copyAndRecolorPixel : copyPixel;\n\n let lighten = colorLighten ? rgba(colorLighten) : rgba(\"#000\");\n let darken = colorDarken ? rgba(colorDarken) : rgba(\"#fff\");\n\n if (!verticalReflect) {\n for (let i = 0; i < source.data.data.length; i += 4) {\n pixelCopyFn(source.data.data, imgData.data, i, i, lighten, darken);\n }\n } else {\n //4 bytes/px, copy in reverse vertical order.\n for (let y = 0; y < source.data.height; y++) {\n for (let x = 0; x < source.data.width; x++) {\n let destRow = source.data.height - y - 1;\n let destIdx = (destRow * source.data.width + x) * 4;\n let srcIdx = (y * source.data.width + x) * 4;\n pixelCopyFn(\n source.data.data,\n imgData.data,\n srcIdx,\n destIdx,\n lighten,\n darken\n );\n }\n }\n }\n\n destination.putImageData(imgData, 0, yOffset);\n}\n", "\"use strict\";\n\nimport * as Gfx from \"./screen_gfx.js\";\nimport { ShieldRenderingContext } from \"./shield_renderer.js\";\nimport {\n BoxPadding,\n Dimension,\n ShieldDefinition,\n TextLayout,\n TextLayoutParameters,\n} from \"./types.js\";\n\nconst VerticalAlignment = {\n Middle: \"middle\",\n Top: \"top\",\n Bottom: \"bottom\",\n} as const;\n\ntype VerticalAlignmentType =\n (typeof VerticalAlignment)[keyof typeof VerticalAlignment];\n\ntype TextLayoutScaler = (\n availSize: Dimension,\n textSize: Dimension,\n options?: TextLayoutParameters\n) => TextTransform;\n\ninterface TextTransform {\n scale: number;\n valign: VerticalAlignmentType;\n}\n\nexport interface TextPlacement {\n xBaseline: number;\n yBaseline: number;\n fontPx: number;\n}\n\nlet noPadding: BoxPadding = {\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n};\n\nfunction ellipseScale(spaceBounds: Dimension, textBounds: Dimension): number {\n //Math derived from https://mathworld.wolfram.com/Ellipse-LineIntersection.html\n var a = spaceBounds.width;\n var b = spaceBounds.height;\n\n var x0 = textBounds.width;\n var y0 = textBounds.height;\n\n return (a * b) / Math.sqrt(a * a * y0 * y0 + b * b * x0 * x0);\n}\n\nfunction ellipseTextConstraint(\n spaceBounds: Dimension,\n textBounds: Dimension\n): TextTransform {\n return {\n scale: ellipseScale(spaceBounds, textBounds),\n valign: VerticalAlignment.Middle,\n };\n}\n\nfunction southHalfEllipseTextConstraint(\n spaceBounds: Dimension,\n textBounds: Dimension\n): TextTransform {\n return {\n scale: ellipseScale(spaceBounds, {\n //Turn ellipse 90 degrees\n height: textBounds.width / 2,\n width: textBounds.height,\n }),\n valign: VerticalAlignment.Top,\n };\n}\n\nfunction rectTextConstraint(\n spaceBounds: Dimension,\n textBounds: Dimension\n): TextTransform {\n var scaleHeight = spaceBounds.height / textBounds.height;\n var scaleWidth = spaceBounds.width / textBounds.width;\n\n return {\n scale: Math.min(scaleWidth, scaleHeight),\n valign: VerticalAlignment.Middle,\n };\n}\n\nfunction roundedRectTextConstraint(\n spaceBounds: Dimension,\n textBounds: Dimension,\n options: TextLayoutParameters\n): TextTransform {\n //Shrink space bounds so that corners hit the arcs\n let constraintRadius = 2;\n if (options !== undefined && options.radius !== undefined) {\n constraintRadius = options.radius;\n }\n\n return rectTextConstraint(\n {\n width: spaceBounds.width - constraintRadius * (2 - Math.sqrt(2)),\n height: spaceBounds.height - constraintRadius * (2 - Math.sqrt(2)),\n },\n textBounds\n );\n}\n\nfunction diamondTextConstraint(\n spaceBounds: Dimension,\n textBounds: Dimension\n): TextTransform {\n let a = spaceBounds.width;\n let b = spaceBounds.height;\n\n let x0 = textBounds.width;\n let y0 = textBounds.height;\n\n return {\n scale: (a * b) / (b * x0 + a * y0),\n valign: VerticalAlignment.Middle,\n };\n}\n\nfunction triangleDownTextConstraint(\n spaceBounds: Dimension,\n textBounds: Dimension\n): TextTransform {\n return {\n scale: diamondTextConstraint(spaceBounds, textBounds).scale,\n valign: VerticalAlignment.Top,\n };\n}\n\n// Warning!!! Hack!!!\nfunction isRunningInWebKit(): boolean {\n if (typeof window === \"undefined\") {\n return false;\n }\n const userAgent = window.navigator.userAgent;\n return /WebKit/i.test(userAgent) && !/Chrome/i.test(userAgent);\n}\n\n/**\n * Determines the position and font size to draw text so that it fits within\n * a bounding box.\n *\n * @param {*} r - rendering context\n * @param {*} text - text to draw\n * @param {*} padding - top/bottom/left/right padding around text\n * @param {*} bounds - size of the overall graphics area\n * @param {*} textLayoutDef - algorithm definition for text scaling\n * @param {*} maxFontSize - maximum font size\n * @returns JOSN object containing (X,Y) draw position and font size\n */\nexport function layoutShieldText(\n r: ShieldRenderingContext,\n text: string,\n padding: BoxPadding,\n bounds: Dimension,\n textLayoutDef: TextLayout,\n maxFontSize: number = 14\n): TextPlacement {\n let padTop = r.px(padding.top) || 0;\n let padBot = r.px(padding.bottom) || 0;\n let padLeft = r.px(padding.left) || 0;\n let padRight = r.px(padding.right) || 0;\n\n let maxFont = r.px(maxFontSize);\n //Temporary canvas for text measurment\n let ctx: CanvasRenderingContext2D = r.gfxFactory.createGraphics(bounds);\n\n ctx.font = Gfx.shieldFont(Gfx.fontSizeThreshold, r.options.shieldFont);\n ctx.textAlign = \"left\";\n ctx.textBaseline = \"top\";\n\n let metrics: TextMetrics = ctx.measureText(text);\n\n let textWidth: number =\n Math.abs(metrics.actualBoundingBoxLeft) +\n Math.abs(metrics.actualBoundingBoxRight);\n let textHeight: number =\n Math.abs(metrics.actualBoundingBoxDescent) +\n Math.abs(metrics.actualBoundingBoxAscent);\n\n //Adjust for excess descender text height across browsers\n textHeight *= 0.9;\n\n //Adjust for excess text height measured in Webkit engine specifically\n if (isRunningInWebKit()) {\n textHeight *= 0.54;\n }\n\n let availHeight: number = bounds.height - padTop - padBot;\n let availWidth: number = bounds.width - padLeft - padRight;\n\n let xBaseline: number = padLeft + availWidth / 2;\n\n let textLayoutFunc = drawTextFunctions[textLayoutDef.constraintFunc];\n\n let spaceAvail: Dimension = { height: availHeight, width: availWidth };\n let measuredTextBounds: Dimension = { height: textHeight, width: textWidth };\n\n let textConstraint: TextTransform = textLayoutFunc(\n spaceAvail,\n measuredTextBounds,\n textLayoutDef.options\n );\n\n //If size-to-fill shield text is too big, shrink it\n var fontSize = Math.min(\n maxFont,\n Gfx.fontSizeThreshold * textConstraint.scale\n );\n\n ctx.font = Gfx.shieldFont(fontSize, r.options.shieldFont);\n ctx.textAlign = \"left\";\n ctx.textBaseline = \"top\";\n\n metrics = ctx.measureText(text);\n textHeight =\n Math.abs(metrics.actualBoundingBoxDescent) +\n Math.abs(metrics.actualBoundingBoxAscent);\n\n let yBaseline: number;\n\n switch (textConstraint.valign) {\n case VerticalAlignment.Top:\n yBaseline = padTop + metrics.actualBoundingBoxAscent;\n break;\n case VerticalAlignment.Bottom:\n yBaseline =\n padTop + availHeight - textHeight + metrics.actualBoundingBoxAscent;\n break;\n case VerticalAlignment.Middle:\n default:\n yBaseline = padTop + (availHeight - textHeight) / 2;\n break;\n }\n\n return {\n xBaseline,\n yBaseline,\n fontPx: fontSize,\n };\n}\n\nconst defaultDefForLayout: Partial = {\n padding: {\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n },\n shapeBlank: {\n drawFunc: \"rect\",\n params: {\n fillColor: \"white\",\n strokeColor: \"black\",\n },\n },\n};\n\n/**\n * Determines the position and font size to draw text so that it fits within\n * a bounding box.\n *\n * @param {*} r - rendering context\n * @param {*} text - text to draw\n * @param {*} def - shield definition\n * @param {*} bounds - size of the overall graphics area\n * @returns JOSN object containing (X,Y) draw position and font size\n */\nexport function layoutShieldTextFromDef(\n r: ShieldRenderingContext,\n text: string,\n def: Partial,\n bounds: Dimension\n): TextPlacement {\n //FIX\n if (def == null) {\n def = defaultDefForLayout;\n }\n\n var padding = def.padding || noPadding;\n\n var textLayoutDef = {\n constraintFunc: \"rect\",\n };\n\n var maxFontSize = 14; // default max size\n\n if (typeof def.textLayout != \"undefined\") {\n textLayoutDef = def.textLayout;\n }\n\n if (typeof def.maxFontSize != \"undefined\") {\n maxFontSize = Math.min(maxFontSize, def.maxFontSize); // shield definition cannot set max size higher than default\n }\n\n return layoutShieldText(r, text, padding, bounds, textLayoutDef, maxFontSize);\n}\n\n/**\n * Draw text on a shield\n *\n * @param {*} r - rendering context\n * @param {*} ctx - graphics context to draw to\n * @param {*} text - text to draw\n * @param {*} textLayout - location to draw text\n */\nexport function renderShieldText(\n r: ShieldRenderingContext,\n ctx: CanvasRenderingContext2D,\n text: string,\n textLayout: TextPlacement\n): void {\n //Text color is set by fillStyle\n configureShieldText(r, ctx, textLayout);\n\n ctx.fillText(text, textLayout.xBaseline, textLayout.yBaseline);\n}\n\n/**\n * Draw drop shadow for text on a shield\n *\n * @param {*} r - rendering context\n * @param {*} ctx - graphics context to draw to\n * @param {*} text - text to draw\n * @param {*} textLayout - location to draw text\n */\nexport function drawShieldHaloText(\n r: ShieldRenderingContext,\n ctx: CanvasRenderingContext2D,\n text: string,\n textLayout: TextPlacement\n): void {\n //Stroke color is set by strokeStyle\n configureShieldText(r, ctx, textLayout);\n\n ctx.shadowColor = ctx.strokeStyle.toString();\n ctx.shadowBlur = 0;\n ctx.lineWidth = r.px(2);\n\n ctx.strokeText(text, textLayout.xBaseline, textLayout.yBaseline);\n ctx.shadowColor = null;\n ctx.shadowBlur = null;\n}\n\nfunction configureShieldText(\n r: ShieldRenderingContext,\n ctx: CanvasRenderingContext2D,\n textLayout: TextPlacement\n): void {\n ctx.textAlign = \"center\";\n ctx.textBaseline = \"top\";\n ctx.font = Gfx.shieldFont(textLayout.fontPx, r.options.shieldFont);\n}\n\nexport function calculateTextWidth(\n r: ShieldRenderingContext,\n text: string,\n fontSize: number\n): number {\n var ctx = r.emptySprite(); //dummy canvas\n ctx.font = Gfx.shieldFont(fontSize, r.options.shieldFont);\n return Math.ceil(ctx.measureText(text).width);\n}\n\n//Register text draw functions\nconst drawTextFunctions = {};\n\n/**\n * Invoked by a style to implement a custom draw function\n *\n * @param {*} name name of the function as referenced by the shield definition\n * @param {*} fxn callback to the implementing function. Takes two parameters, ref and options\n */\nfunction registerDrawTextFunction(name: string, fxn: TextLayoutScaler): void {\n drawTextFunctions[name] = fxn;\n}\n\n//Built-in draw functions (standard shapes)\nregisterDrawTextFunction(\"diamond\", diamondTextConstraint);\nregisterDrawTextFunction(\"ellipse\", ellipseTextConstraint);\nregisterDrawTextFunction(\"rect\", rectTextConstraint);\nregisterDrawTextFunction(\"roundedRect\", roundedRectTextConstraint);\nregisterDrawTextFunction(\"southHalfEllipse\", southHalfEllipseTextConstraint);\nregisterDrawTextFunction(\"triangleDown\", triangleDownTextConstraint);\n", "\"use strict\";\n\nimport * as ShieldDraw from \"./shield_canvas_draw\";\nimport { ShieldRenderingContext } from \"./shield_renderer\";\nimport { ShapeBlankParams } from \"./types\";\n\n// Special case for Allegheny, PA Belt System\nexport function paBelt(\n r: ShieldRenderingContext,\n ctx: CanvasRenderingContext2D,\n params: ShapeBlankParams\n): number {\n ShieldDraw.roundedRectangle(r, ctx, {\n fillColor: \"white\",\n strokeColor: \"black\",\n outlineWidth: 1,\n radius: 2,\n rectWidth: 20,\n });\n\n let fillColor = params.fillColor;\n\n let lineWidth = r.px(0.5);\n let diameter = r.shieldSize() / 3 - lineWidth;\n ctx.beginPath();\n ctx.arc(\n r.shieldSize() / 2,\n r.shieldSize() / 2,\n diameter,\n 0,\n 2 * Math.PI,\n false\n );\n\n ctx.fillStyle = fillColor;\n ctx.strokeStyle = params.strokeColor;\n ctx.fill();\n\n ctx.lineWidth = lineWidth;\n ctx.stroke();\n return 20;\n}\n\n// Special case for Branson color-coded routes\nexport function bransonRoute(\n r: ShieldRenderingContext,\n ctx: CanvasRenderingContext2D,\n params: ShapeBlankParams\n): number {\n ShieldDraw.roundedRectangle(r, ctx, {\n fillColor: \"#006747\",\n strokeColor: \"white\",\n outlineWidth: 1,\n radius: 2,\n rectWidth: 20,\n });\n\n let fillColor = params.fillColor;\n\n let lineWidth = r.px(0.5);\n let x = 0.15 * r.shieldSize() + lineWidth;\n let width = 0.7 * r.shieldSize() - 2 * lineWidth;\n\n let y = 0.4 * r.shieldSize() + lineWidth;\n let height = 0.45 * r.shieldSize() - 2 * lineWidth;\n\n ctx.beginPath();\n ctx.rect(x, y, width, height);\n\n ctx.fillStyle = fillColor;\n ctx.strokeStyle = params.strokeColor;\n ctx.fill();\n\n ctx.lineWidth = lineWidth;\n ctx.stroke();\n return 20;\n}\n\nexport function loadCustomShields() {\n ShieldDraw.registerDrawFunction(\"branson\", bransonRoute, 20);\n ShieldDraw.registerDrawFunction(\"paBelt\", paBelt, 20);\n}\n", "\"use strict\";\n\n/**\n * Shield blanks which are drawn rather built from raster shield blanks\n */\n\nimport * as ShieldText from \"./shield_text\";\nimport { loadCustomShields } from \"./custom_shields\";\nimport { ShapeDrawFunction, ShieldRenderingContext } from \"./shield_renderer\";\nimport { ShapeBlankParams } from \"./types\";\n\nconst minGenericShieldWidth = 20;\nconst maxGenericShieldWidth = 34;\nconst genericShieldFontSize = 18;\n\nexport function computeWidth(\n r: ShieldRenderingContext,\n params: ShapeBlankParams,\n ref: string,\n shape?: string\n) {\n if (fixedWidthDefinitions[shape] !== undefined) {\n return r.px(fixedWidthDefinitions[shape]);\n }\n\n let rectWidth = params.rectWidth == undefined ? null : params.rectWidth;\n let sideAngle = params.sideAngle == undefined ? 0 : params.sideAngle;\n let tangent = Math.tan(sideAngle);\n\n if (rectWidth == null) {\n let shieldWidth =\n ShieldText.calculateTextWidth(r, ref, r.px(genericShieldFontSize)) +\n r.px(2);\n let minWidth = r.px(minGenericShieldWidth);\n\n //Shape-specific width adjustments\n switch (shape) {\n case \"pentagon\":\n let yOffset = params.yOffset == undefined ? 0 : params.yOffset;\n shieldWidth += ((r.shieldSize() - r.px(yOffset)) * tangent) / 2;\n break;\n case \"trapezoid\":\n shieldWidth += (r.shieldSize() * tangent) / 2;\n break;\n case \"triangle\":\n minWidth += r.px(2);\n break;\n case \"diamond\":\n case \"hexagonHorizontal\":\n minWidth += r.px(4);\n break;\n }\n\n return Math.max(\n minWidth,\n Math.min(r.px(maxGenericShieldWidth), shieldWidth)\n );\n } else {\n return r.px(rectWidth);\n }\n}\n\nfunction ellipse(\n r: ShieldRenderingContext,\n ctx: CanvasRenderingContext2D,\n params: ShapeBlankParams,\n ref: string\n): number {\n let fill = params.fillColor == undefined ? \"white\" : params.fillColor;\n let outline = params.strokeColor == undefined ? \"black\" : params.strokeColor;\n\n let width = computeWidth(r, params, ref);\n\n let lineWidth = r.px(1);\n let radiusX = width / 2 - lineWidth;\n let radiusY = r.shieldSize() / 2 - lineWidth;\n\n ctx.beginPath();\n\n ctx.ellipse(\n ctx.canvas.width / 2,\n r.shieldSize() / 2,\n radiusX,\n radiusY,\n 0,\n 0,\n 2 * Math.PI,\n false\n );\n\n ctx.fillStyle = fill;\n ctx.fill();\n ctx.lineWidth = lineWidth;\n ctx.strokeStyle = outline;\n ctx.stroke();\n\n return width;\n}\n\nexport function pill(\n r: ShieldRenderingContext,\n ctx: CanvasRenderingContext2D,\n params: ShapeBlankParams,\n ref?: string\n): number {\n /*\n shieldSize() has to be divided by r.px(1) to get down to 1x resolution.\n Then we divide in half again to get a 50% height corner radius, hence px(2).\n */\n params.radius = r.shieldSize() / r.px(2);\n return roundedRectangle(r, ctx, params, ref);\n}\n\nexport function roundedRectangle(\n r: ShieldRenderingContext,\n ctx: CanvasRenderingContext2D,\n params: ShapeBlankParams,\n ref?: string\n): number {\n let fill = params.fillColor == undefined ? \"white\" : params.fillColor;\n let outline = params.strokeColor == undefined ? \"black\" : params.strokeColor;\n let radius = params.radius == undefined ? 0 : params.radius;\n let outlineWidth = params.outlineWidth == undefined ? 1 : params.outlineWidth;\n\n let width = computeWidth(r, params, ref);\n\n let lineThick = r.px(outlineWidth);\n let lineWidth = lineThick / 2;\n let drawRadius = r.px(radius);\n\n let x0 = lineWidth;\n let x1 = lineWidth + drawRadius;\n let x2 = width - lineWidth - drawRadius;\n let x3 = width - lineWidth;\n\n let y0 = lineWidth;\n let y1 = lineWidth + drawRadius;\n let y2 = r.shieldSize() - lineWidth - drawRadius;\n let y3 = r.shieldSize() - lineWidth;\n\n ctx.beginPath();\n ctx.moveTo(x2, y0);\n ctx.arcTo(x3, y0, x3, y1, drawRadius);\n ctx.arcTo(x3, y3, x2, y3, drawRadius);\n ctx.arcTo(x0, y3, x0, y2, drawRadius);\n ctx.arcTo(x0, y0, x1, y0, drawRadius);\n ctx.closePath();\n\n ctx.lineWidth = lineThick;\n ctx.fillStyle = fill;\n ctx.fill();\n\n if (outline != null) {\n ctx.strokeStyle = outline;\n ctx.stroke();\n }\n\n return width;\n}\n\nfunction escutcheon(\n r: ShieldRenderingContext,\n ctx: CanvasRenderingContext2D,\n params: ShapeBlankParams,\n ref: string\n): number {\n let yOffset = params.yOffset == undefined ? 0 : params.yOffset;\n let fill = params.fillColor == undefined ? \"white\" : params.fillColor;\n let outline = params.strokeColor == undefined ? \"black\" : params.strokeColor;\n let radius = params.radius == undefined ? 0 : params.radius;\n let outlineWidth = params.outlineWidth == undefined ? 1 : params.outlineWidth;\n\n let width = computeWidth(r, params, ref);\n\n let lineThick = r.px(outlineWidth);\n let lineWidth = lineThick / 2;\n let drawRadius = r.px(radius);\n let drawOffset = r.px(yOffset);\n\n let x0 = lineWidth;\n let x5 = width - lineWidth;\n\n let y0 = lineWidth;\n let y5 = r.shieldSize() - lineWidth;\n\n let x1 = x0 + drawRadius;\n let x3 = (x0 + x5) / 2;\n let y1 = y0 + drawRadius;\n let y2 = y5 - drawOffset;\n\n let x2 = (2 * x0 + x3) / 3;\n let x4 = (x3 + 2 * x5) / 3;\n let y3 = (y2 + y5) / 2;\n\n let y4 = (y3 + 2 * y5) / 3;\n\n ctx.beginPath();\n ctx.moveTo(x3, y5);\n ctx.bezierCurveTo(x2, y4, x0, y3, x0, y2);\n ctx.arcTo(x0, y0, x1, y0, drawRadius);\n ctx.arcTo(x5, y0, x5, y1, drawRadius);\n ctx.lineTo(x5, y2);\n ctx.bezierCurveTo(x5, y3, x4, y4, x3, y5);\n ctx.closePath();\n\n ctx.lineWidth = lineThick;\n ctx.fillStyle = fill;\n ctx.fill();\n\n if (outline != null) {\n ctx.strokeStyle = outline;\n ctx.stroke();\n }\n\n return width;\n}\n\nfunction fishhead(\n r: ShieldRenderingContext,\n ctx: CanvasRenderingContext2D,\n params: ShapeBlankParams,\n ref: string\n): number {\n let pointUp = params.pointUp == undefined ? false : params.pointUp;\n let fill = params.fillColor == undefined ? \"white\" : params.fillColor;\n let outline = params.strokeColor == undefined ? \"black\" : params.strokeColor;\n let outlineWidth = params.outlineWidth == undefined ? 1 : params.outlineWidth;\n\n let angleSign = pointUp ? -1 : 1;\n\n let width = computeWidth(r, params, ref);\n\n let lineThick = r.px(outlineWidth);\n let lineWidth = lineThick / 2;\n\n let x0 = lineWidth;\n let x8 = width - lineWidth;\n\n let y0 = pointUp ? r.shieldSize() - lineWidth : lineWidth;\n let y6 = pointUp ? lineWidth : r.shieldSize() - lineWidth;\n\n let x1 = x0 + r.px(1);\n let x2 = x0 + r.px(2.5);\n let x4 = (x0 + x8) / 2;\n let x6 = x8 - r.px(2.5);\n let x7 = x8 - r.px(1);\n let y1 = y0 + angleSign * r.px(2);\n let y2 = y0 + angleSign * r.px(4.5);\n let y3 = y0 + angleSign * r.px(7);\n let y4 = y6 - angleSign * r.px(6);\n let y5 = y6 - angleSign * r.px(1);\n\n let x3 = (x0 + x4) / 2;\n let x5 = (x4 + x8) / 2;\n\n ctx.beginPath();\n ctx.moveTo(x4, y6);\n ctx.bezierCurveTo(x3, y5, x0, y4, x0, y3);\n ctx.bezierCurveTo(x0, y2, x1, y1, x2, y0);\n ctx.lineTo(x6, y0);\n ctx.bezierCurveTo(x7, y1, x8, y2, x8, y3);\n ctx.bezierCurveTo(x8, y4, x5, y5, x4, y6);\n ctx.closePath();\n\n ctx.lineWidth = lineThick;\n ctx.fillStyle = fill;\n ctx.fill();\n\n if (outline != null) {\n ctx.strokeStyle = outline;\n ctx.stroke();\n }\n\n return width;\n}\n\nfunction triangle(\n r: ShieldRenderingContext,\n ctx: CanvasRenderingContext2D,\n params: ShapeBlankParams,\n ref: string\n): number {\n let pointUp = params.pointUp == undefined ? false : params.pointUp;\n let fill = params.fillColor == undefined ? \"white\" : params.fillColor;\n let outline = params.strokeColor == undefined ? \"black\" : params.strokeColor;\n let radius = params.radius == undefined ? 0 : params.radius;\n let outlineWidth = params.outlineWidth == undefined ? 1 : params.outlineWidth;\n\n let angleSign = pointUp ? -1 : 1;\n\n let width = computeWidth(r, params, ref, \"triangle\");\n\n let lineThick = r.px(outlineWidth);\n let lineWidth = lineThick / 2;\n let drawRadius = r.px(radius);\n\n let x0 = lineWidth;\n let x8 = width - lineWidth;\n let y0 = pointUp ? r.shieldSize() - lineWidth : lineWidth;\n let y5 = pointUp ? lineWidth : r.shieldSize() - lineWidth;\n\n let x2 = x0 + drawRadius;\n let x4 = (x0 + x8) / 2;\n let x6 = x8 - drawRadius;\n let y1 = y0 + angleSign * drawRadius;\n\n let angle = Math.atan((x4 - x2) / Math.abs(y5 - drawRadius - y1));\n let sine = Math.sin(angle);\n let cosine = Math.cos(angle);\n let halfTangent = Math.tan(angle / 2);\n let halfComplementTangent = Math.tan(Math.PI / 4 - angle / 2);\n\n let x1 = x2 - drawRadius * cosine;\n let x3 = x4 - drawRadius * halfComplementTangent;\n let x5 = x4 + drawRadius * halfComplementTangent;\n let x7 = x6 + drawRadius * cosine;\n let y2 = y1 + angleSign * drawRadius * halfTangent;\n let y3 = y1 + angleSign * drawRadius * sine;\n let y4 = y5 - angleSign * drawRadius * (1 - sine);\n\n ctx.beginPath();\n ctx.moveTo(x4, y5);\n ctx.arcTo(x3, y5, x1, y3, drawRadius);\n ctx.arcTo(x0, y2, x0, y1, drawRadius);\n ctx.arcTo(x0, y0, x2, y0, drawRadius);\n ctx.arcTo(x8, y0, x8, y1, drawRadius);\n ctx.arcTo(x8, y2, x7, y3, drawRadius);\n ctx.arcTo(x5, y5, x4, y5, drawRadius);\n ctx.closePath();\n\n ctx.lineWidth = lineThick;\n ctx.fillStyle = fill;\n ctx.fill();\n\n if (outline != null) {\n ctx.strokeStyle = outline;\n ctx.stroke();\n }\n\n return width;\n}\n\nfunction trapezoid(\n r: ShieldRenderingContext,\n ctx: CanvasRenderingContext2D,\n params: ShapeBlankParams,\n ref: string\n): number {\n let shortSideUp =\n params.shortSideUp == undefined ? false : params.shortSideUp;\n let sideAngle = params.sideAngle == undefined ? 0 : params.sideAngle;\n let fill = params.fillColor == undefined ? \"white\" : params.fillColor;\n let outline = params.strokeColor == undefined ? \"black\" : params.strokeColor;\n let radius = params.radius == undefined ? 0 : params.radius;\n let outlineWidth = params.outlineWidth == undefined ? 1 : params.outlineWidth;\n let angleSign = shortSideUp ? -1 : 1;\n\n let sine = Math.sin(sideAngle);\n let cosine = Math.cos(sideAngle);\n let tangent = Math.tan(sideAngle);\n\n let width = computeWidth(r, params, ref, \"trapezoid\");\n\n let lineThick = r.px(outlineWidth);\n let lineWidth = lineThick / 2;\n let drawRadius = r.px(radius);\n\n let x0 = lineWidth;\n let x9 = width - lineWidth;\n let y0 = shortSideUp ? r.shieldSize() - lineWidth : lineWidth;\n let y3 = shortSideUp ? lineWidth : r.shieldSize() - lineWidth;\n\n let y1 = y0 + angleSign * drawRadius * (1 + sine);\n let y2 = y3 - angleSign * drawRadius * (1 - sine);\n\n let x1 = x0 + (y1 - y0) * tangent;\n let x2 = x1 + drawRadius * cosine;\n let x3 = x0 + angleSign * (y2 - y0) * tangent;\n let x4 = x0 + angleSign * (y3 - y0) * tangent;\n let x5 = x3 + angleSign * drawRadius * cosine;\n let x6 = width - x4;\n let x7 = width - x3;\n let x8 = width - x2;\n\n ctx.beginPath();\n ctx.moveTo(x8, y0);\n ctx.arcTo(x9, y0, x7, y2, drawRadius);\n ctx.arcTo(x6, y3, x5, y3, drawRadius);\n ctx.arcTo(x4, y3, x1, y1, drawRadius);\n ctx.arcTo(x0, y0, x8, y0, drawRadius);\n ctx.closePath();\n\n ctx.lineWidth = lineThick;\n ctx.fillStyle = fill;\n ctx.fill();\n\n if (outline != null) {\n ctx.strokeStyle = outline;\n ctx.stroke();\n }\n\n return width;\n}\n\nfunction diamond(\n r: ShieldRenderingContext,\n ctx: CanvasRenderingContext2D,\n params: ShapeBlankParams,\n ref: string\n): number {\n let fill = params.fillColor == undefined ? \"white\" : params.fillColor;\n let outline = params.strokeColor == undefined ? \"black\" : params.strokeColor;\n let radius = params.radius == undefined ? 0 : params.radius;\n let outlineWidth = params.outlineWidth == undefined ? 1 : params.outlineWidth;\n\n let height = shapeHeight(r, \"diamond\");\n let width = computeWidth(r, params, ref, \"diamond\");\n\n let lineThick = r.px(outlineWidth);\n let lineWidth = lineThick / 2;\n let drawRadius = r.px(radius);\n\n let x0 = lineWidth;\n let x8 = width - lineWidth;\n let y0 = lineWidth;\n let y8 = height - lineWidth;\n\n let x4 = (x0 + x8) / 2;\n let y4 = (y0 + y8) / 2;\n\n let angle = Math.atan((x4 - drawRadius - x0) / (y8 - drawRadius - y4));\n let sine = Math.sin(angle);\n let cosine = Math.cos(angle);\n let halfTangent = Math.tan(angle / 2);\n let halfComplementTangent = Math.tan(Math.PI / 4 - angle / 2);\n\n let x1 = x0 + drawRadius * (1 - cosine);\n let x2 = x4 - drawRadius * cosine;\n let x3 = x4 - drawRadius * halfComplementTangent;\n let x5 = x4 + drawRadius * halfComplementTangent;\n let x6 = x4 + drawRadius * cosine;\n let x7 = x8 - drawRadius * (1 - cosine);\n\n let y1 = y0 + drawRadius * (1 - sine);\n let y2 = y4 - drawRadius * sine;\n let y3 = y4 - drawRadius * halfTangent;\n let y5 = y4 + drawRadius * halfTangent;\n let y6 = y4 + drawRadius * sine;\n let y7 = y8 - drawRadius * (1 - sine);\n\n ctx.beginPath();\n ctx.moveTo(x4, y8);\n ctx.arcTo(x3, y8, x1, y6, drawRadius);\n ctx.arcTo(x0, y5, x0, y4, drawRadius);\n ctx.arcTo(x0, y3, x2, y1, drawRadius);\n ctx.arcTo(x3, y0, x4, y0, drawRadius);\n ctx.arcTo(x5, y0, x7, y2, drawRadius);\n ctx.arcTo(x8, y3, x8, y4, drawRadius);\n ctx.arcTo(x8, y5, x6, y7, drawRadius);\n ctx.arcTo(x5, y8, x4, y8, drawRadius);\n ctx.closePath();\n\n ctx.lineWidth = lineThick;\n ctx.fillStyle = fill;\n ctx.fill();\n\n if (outline != null) {\n ctx.strokeStyle = outline;\n ctx.stroke();\n }\n return width;\n}\n\nfunction pentagon(\n r: ShieldRenderingContext,\n ctx: CanvasRenderingContext2D,\n params: ShapeBlankParams,\n ref: string\n): number {\n let pointUp = params.pointUp == undefined ? true : params.pointUp;\n let yOffset = params.yOffset == undefined ? 0 : params.yOffset;\n let sideAngle = params.sideAngle == undefined ? 0 : params.sideAngle;\n let fill = params.fillColor == undefined ? \"white\" : params.fillColor;\n let outline = params.strokeColor == undefined ? \"black\" : params.strokeColor;\n let radius1 = params.radius1 == undefined ? 0 : params.radius1;\n let radius2 = params.radius2 == undefined ? 0 : params.radius2;\n let outlineWidth = params.outlineWidth == undefined ? 1 : params.outlineWidth;\n\n let angleSign = pointUp ? -1 : 1;\n let sine = Math.sin(sideAngle);\n let cosine = Math.cos(sideAngle);\n let tangent = Math.tan(sideAngle);\n\n let width = computeWidth(r, params, ref, \"pentagon\");\n\n let lineThick = r.px(outlineWidth);\n let lineWidth = lineThick / 2;\n let drawRadius1 = r.px(radius1);\n let drawRadius2 = r.px(radius2);\n let drawOffset = r.px(yOffset);\n\n let x0 = lineWidth;\n let x8 = width - lineWidth;\n let y0 = pointUp ? r.shieldSize() - lineWidth : lineWidth;\n let y3 = pointUp ? lineWidth : r.shieldSize() - lineWidth;\n\n let y2 = y3 - angleSign * drawOffset;\n\n let x2 = x0 + angleSign * (y2 - y0) * tangent;\n let x4 = (x0 + x8) / 2;\n let x6 = x8 - angleSign * (y2 - y0) * tangent;\n\n let offsetAngle = Math.atan(drawOffset / (x4 - x0));\n\n let halfComplementAngle1 = (Math.PI / 2 - offsetAngle + sideAngle) / 2;\n let halfComplementTangent1 = Math.tan(halfComplementAngle1);\n\n let halfComplementAngle2 = (Math.PI / 2 - sideAngle) / 2;\n let halfComplementTangent2 = Math.tan(halfComplementAngle2);\n\n let x1 = x0 + drawRadius1 * halfComplementTangent1 * sine;\n let x3 = x2 + drawRadius2 * halfComplementTangent2;\n let x5 = x6 - drawRadius2 * halfComplementTangent2;\n let x7 = x8 - drawRadius1 * halfComplementTangent1 * sine;\n let y1 = y2 - angleSign * drawRadius1 * halfComplementTangent1 * cosine;\n\n ctx.beginPath();\n ctx.moveTo(x4, y3);\n ctx.arcTo(x0, y2, x1, y1, drawRadius1);\n ctx.arcTo(x2, y0, x3, y0, drawRadius2);\n ctx.lineTo(x5, y0);\n ctx.arcTo(x6, y0, x7, y1, drawRadius2);\n ctx.arcTo(x8, y2, x4, y3, drawRadius1);\n ctx.closePath();\n\n ctx.lineWidth = lineThick;\n ctx.fillStyle = fill;\n ctx.fill();\n\n if (outline != null) {\n ctx.strokeStyle = outline;\n ctx.stroke();\n }\n return width;\n}\n\nfunction hexagonVertical(\n r: ShieldRenderingContext,\n ctx: CanvasRenderingContext2D,\n params: ShapeBlankParams,\n ref: string\n): number {\n let yOffset = params.yOffset == undefined ? 0 : params.yOffset;\n let fill = params.fillColor == undefined ? \"white\" : params.fillColor;\n let outline = params.strokeColor == undefined ? \"black\" : params.strokeColor;\n let radius = params.radius == undefined ? 0 : params.radius;\n let outlineWidth = params.outlineWidth == undefined ? 1 : params.outlineWidth;\n\n let width = computeWidth(r, params, ref);\n\n let lineThick = r.px(outlineWidth);\n let lineWidth = lineThick / 2;\n let drawRadius = r.px(radius);\n let drawOffset = r.px(yOffset);\n\n let x0 = lineWidth;\n let x2 = width - lineWidth;\n let y0 = lineWidth;\n let y5 = r.shieldSize() - lineWidth;\n\n let x1 = (x0 + x2) / 2;\n let y1 = y0 + drawOffset;\n let y4 = y5 - drawOffset;\n\n let drawOffsetTangent =\n drawRadius * Math.tan(Math.PI / 4 - Math.asin(drawOffset / (x1 - x0)) / 2);\n let y2 = y1 + drawOffsetTangent;\n let y3 = y4 - drawOffsetTangent;\n\n ctx.beginPath();\n ctx.moveTo(x1, y5);\n ctx.arcTo(x0, y4, x0, y3, drawRadius);\n ctx.arcTo(x0, y1, x1, y0, drawRadius);\n ctx.lineTo(x1, y0);\n ctx.arcTo(x2, y1, x2, y2, drawRadius);\n ctx.arcTo(x2, y4, x1, y5, drawRadius);\n ctx.lineTo(x1, y5);\n ctx.closePath();\n\n ctx.lineWidth = lineThick;\n ctx.fillStyle = fill;\n ctx.fill();\n\n if (outline != null) {\n ctx.strokeStyle = outline;\n ctx.stroke();\n }\n return width;\n}\n\nfunction hexagonHorizontal(\n r: ShieldRenderingContext,\n ctx: CanvasRenderingContext2D,\n params: ShapeBlankParams,\n ref: string\n): number {\n let sideAngle = params.sideAngle == undefined ? 0 : params.sideAngle;\n let fill = params.fillColor == undefined ? \"white\" : params.fillColor;\n let outline = params.strokeColor == undefined ? \"black\" : params.strokeColor;\n let radius = params.radius == undefined ? 0 : params.radius;\n let outlineWidth = params.outlineWidth == undefined ? 1 : params.outlineWidth;\n\n let sine = Math.sin(sideAngle);\n let cosine = Math.cos(sideAngle);\n let tangent = Math.tan(sideAngle);\n let halfComplementTangent = Math.tan(Math.PI / 4 - sideAngle / 2);\n\n let width = computeWidth(r, params, ref, \"hexagonHorizontal\");\n\n let lineThick = r.px(outlineWidth);\n let lineWidth = lineThick / 2;\n let drawRadius = r.px(radius);\n\n let x0 = lineWidth;\n let x9 = width - lineWidth;\n let y0 = lineWidth;\n let y6 = r.shieldSize() - lineWidth;\n\n let y3 = (y0 + y6) / 2;\n\n let y1 = y0 + drawRadius * halfComplementTangent * cosine;\n let y2 = y3 - drawRadius * sine;\n let y4 = y3 + drawRadius * sine;\n let y5 = y6 - drawRadius * halfComplementTangent * cosine;\n\n let x1 = x0 + (y3 - y2) * tangent;\n let x3 = x0 + (y3 - y0) * tangent;\n let x6 = x9 - (y3 - y0) * tangent;\n let x8 = x9 - (y3 - y2) * tangent;\n\n let x2 = x3 - drawRadius * halfComplementTangent * sine;\n let x4 = x3 + drawRadius * halfComplementTangent;\n let x5 = x6 - drawRadius * halfComplementTangent;\n let x7 = x6 + drawRadius * halfComplementTangent * sine;\n\n ctx.beginPath();\n ctx.moveTo(x4, y0);\n ctx.arcTo(x6, y0, x7, y1, drawRadius);\n ctx.arcTo(x9, y3, x8, y4, drawRadius);\n ctx.arcTo(x6, y6, x5, y6, drawRadius);\n ctx.arcTo(x3, y6, x2, y5, drawRadius);\n ctx.arcTo(x0, y3, x1, y2, drawRadius);\n ctx.arcTo(x3, y0, x4, y0, drawRadius);\n ctx.closePath();\n\n ctx.lineWidth = lineThick;\n ctx.fillStyle = fill;\n ctx.fill();\n\n if (outline != null) {\n ctx.strokeStyle = outline;\n ctx.stroke();\n }\n return width;\n}\n\nfunction octagonVertical(\n r: ShieldRenderingContext,\n ctx: CanvasRenderingContext2D,\n params: ShapeBlankParams,\n ref: string\n): number {\n let yOffset = params.yOffset == undefined ? 0 : params.yOffset;\n let sideAngle = params.sideAngle == undefined ? 0 : params.sideAngle;\n let fill = params.fillColor == undefined ? \"white\" : params.fillColor;\n let outline = params.strokeColor == undefined ? \"black\" : params.strokeColor;\n let radius = params.radius == undefined ? 0 : params.radius;\n let outlineWidth = params.outlineWidth == undefined ? 1 : params.outlineWidth;\n\n let sine = Math.sin(sideAngle);\n let cosine = Math.cos(sideAngle);\n let tangent = Math.tan(sideAngle);\n\n let width = computeWidth(r, params, ref);\n\n let lineThick = r.px(outlineWidth);\n let lineWidth = lineThick / 2;\n let drawRadius = r.px(radius);\n let drawOffset = r.px(yOffset);\n\n let x0 = lineWidth;\n let x10 = width - lineWidth;\n let y0 = lineWidth;\n let y10 = r.shieldSize() - lineWidth;\n\n let x1 = x0 + drawRadius * tangent * sine;\n let x5 = (x0 + x10) / 2;\n let x9 = x10 - drawRadius * tangent * sine;\n let y2 = y0 + drawOffset;\n let y5 = (y0 + y10) / 2;\n let y8 = y10 - drawOffset;\n\n let x3 = x0 + (y5 - y2) * tangent;\n let x7 = x10 - (y5 - y2) * tangent;\n let y4 = y5 - drawRadius * tangent * cosine;\n let y6 = y5 + drawRadius * tangent * cosine;\n\n let offsetAngle = Math.atan(drawOffset / (x5 - x3));\n let offsetSine = Math.sin(offsetAngle);\n let offsetCosine = Math.cos(offsetAngle);\n\n let halfComplementAngle = (Math.PI / 2 - sideAngle - offsetAngle) / 2;\n let halfComplementCosine = Math.cos(halfComplementAngle);\n\n let dx =\n (drawRadius * Math.cos(sideAngle + halfComplementAngle)) /\n halfComplementCosine;\n let dy =\n (drawRadius * Math.sin(sideAngle + halfComplementAngle)) /\n halfComplementCosine;\n\n let x2 = x3 + dx - drawRadius * cosine;\n let x4 = x3 + dx - drawRadius * offsetSine;\n let x6 = x7 - dx + drawRadius * offsetSine;\n let x8 = x7 - dx + drawRadius * cosine;\n let y1 = y2 + dy - drawRadius * offsetCosine;\n let y3 = y2 + dy - drawRadius * sine;\n let y7 = y8 - dy + drawRadius * sine;\n let y9 = y8 - dy + drawRadius * offsetCosine;\n\n ctx.beginPath();\n ctx.moveTo(x5, y10);\n ctx.arcTo(x3, y8, x2, y7, drawRadius);\n ctx.arcTo(x0, y5, x1, y4, drawRadius);\n ctx.arcTo(x3, y2, x4, y1, drawRadius);\n ctx.lineTo(x5, y0);\n ctx.arcTo(x7, y2, x8, y3, drawRadius);\n ctx.arcTo(x10, y5, x9, y6, drawRadius);\n ctx.arcTo(x7, y8, x6, y9, drawRadius);\n ctx.lineTo(x5, y10);\n ctx.closePath();\n\n ctx.lineWidth = lineThick;\n ctx.fillStyle = fill;\n ctx.fill();\n\n if (outline != null) {\n ctx.strokeStyle = outline;\n ctx.stroke();\n }\n return width;\n}\n\nexport function shapeHeight(r: ShieldRenderingContext, name: string) {\n switch (name) {\n case \"diamond\":\n return r.shieldSize() + r.px(4);\n default:\n return r.shieldSize();\n }\n}\n\nexport function draw(\n r: ShieldRenderingContext,\n name: string,\n ctx: CanvasRenderingContext2D,\n params: ShapeBlankParams,\n ref: string\n): number {\n return drawFunctions[name](r, ctx, params, ref);\n}\n\n//Register draw functions\nconst drawFunctions = {};\n\n//Register fixed width values\nconst fixedWidthDefinitions = {};\n\n/**\n * Invoked by a style to implement a custom draw function\n *\n * @param {*} name name of the function as referenced by the shield definition\n * @param {*} fxn callback to the implementing function. Takes two parameters, ref and options\n * @param {*} fixedWidth if set, indicates that this function draws to a fixed width\n */\nexport function registerDrawFunction(\n name: string,\n fxn: ShapeDrawFunction,\n fixedWidth?: number\n) {\n drawFunctions[name] = fxn;\n if (fixedWidth !== undefined) {\n fixedWidthDefinitions[name] = fixedWidth;\n }\n}\n\n//Built-in draw functions (standard shapes)\nregisterDrawFunction(\"diamond\", diamond);\nregisterDrawFunction(\"ellipse\", ellipse);\nregisterDrawFunction(\"escutcheon\", escutcheon);\nregisterDrawFunction(\"fishhead\", fishhead);\nregisterDrawFunction(\"hexagonVertical\", hexagonVertical);\nregisterDrawFunction(\"hexagonHorizontal\", hexagonHorizontal);\nregisterDrawFunction(\"octagonVertical\", octagonVertical);\nregisterDrawFunction(\"pentagon\", pentagon);\nregisterDrawFunction(\"pill\", pill);\nregisterDrawFunction(\"roundedRectangle\", roundedRectangle);\nregisterDrawFunction(\"trapezoid\", trapezoid);\nregisterDrawFunction(\"triangle\", triangle);\n\n//Built-in custom draw functions (weird stuff)\nloadCustomShields();\n", "import { shieldFont } from \"./screen_gfx\";\nimport { ShieldRenderingContext } from \"./shield_renderer\";\nimport { TextPlacement, layoutShieldText } from \"./shield_text\";\nimport { Dimension, ShieldDefinition, TextLayout } from \"./types\";\n\nlet bannerLayout: TextLayout = {\n constraintFunc: \"rect\",\n};\n\n/**\n * Add modifier plaque text\n *\n * @param r - Shield rendering context\n * @param ctx - Canvas drawing context\n * @param shieldDef - Shield definition\n */\nexport function drawBanners(\n r: ShieldRenderingContext,\n ctx: CanvasRenderingContext2D,\n shieldDef: ShieldDefinition\n) {\n if (shieldDef.bannerTextColor) {\n ctx.fillStyle = shieldDef.bannerTextColor;\n } else {\n ctx.fillStyle = r.options.bannerTextColor;\n }\n drawBannerPart(r, ctx, shieldDef, drawBannerText);\n}\n\n/**\n * Add the halo around modifier plaque text\n *\n * @param r - Shield rendering context\n * @param ctx - Canvas drawing context\n * @param shieldDef - Shield definition\n */\nexport function drawBannerHalos(\n r: ShieldRenderingContext,\n ctx: CanvasRenderingContext2D,\n shieldDef: ShieldDefinition\n) {\n if (shieldDef.bannerTextHaloColor) {\n ctx.strokeStyle = ctx.shadowColor = shieldDef.bannerTextHaloColor;\n } else {\n ctx.strokeStyle = ctx.shadowColor = r.options.bannerTextHaloColor;\n }\n drawBannerPart(r, ctx, shieldDef, drawBannerHaloText);\n}\n\ntype BannerDrawComponentFunction = (\n r: ShieldRenderingContext,\n ctx: CanvasRenderingContext2D,\n text: string,\n bannerIndex: number\n) => void;\n\nfunction drawBannerPart(\n r: ShieldRenderingContext,\n ctx: CanvasRenderingContext2D,\n shieldDef: ShieldDefinition,\n drawFunc: BannerDrawComponentFunction\n): void {\n if (shieldDef == null || typeof shieldDef.banners == \"undefined\") {\n return; //Unadorned shield\n }\n\n for (var i = 0; i < shieldDef.banners.length; i++) {\n drawFunc(r, ctx, shieldDef.banners[i], i);\n }\n}\n\n/**\n * Get the number of banner placards associated with this shield\n *\n * @param shield - Shield definition\n * @returns the number of banner placards that need to be drawn\n */\nexport function getBannerCount(shield: ShieldDefinition): number {\n if (shield == null || typeof shield.banners == \"undefined\") {\n return 0; //Unadorned shield\n }\n return shield.banners.length;\n}\n\n/**\n * Draw text on a modifier plate above a shield\n *\n * @param {*} r - rendering context\n * @param {*} ctx - graphics context to draw to\n * @param {*} text - text to draw\n * @param {*} bannerIndex - plate position to draw, 0=top, incrementing\n */\nexport function drawBannerText(\n r: ShieldRenderingContext,\n ctx: CanvasRenderingContext2D,\n text: string,\n bannerIndex: number\n): void {\n drawBannerTextComponent(r, ctx, text, bannerIndex, true);\n}\n\n/**\n * Draw drop shadow for text on a modifier plate above a shield\n *\n * @param {*} r - rendering context\n * @param {*} ctx - graphics context to draw to\n * @param {*} text - text to draw\n * @param {*} bannerIndex - plate position to draw, 0=top, incrementing\n */\nexport function drawBannerHaloText(\n r: ShieldRenderingContext,\n ctx: CanvasRenderingContext2D,\n text: string,\n bannerIndex: number\n): void {\n drawBannerTextComponent(r, ctx, text, bannerIndex, false);\n}\n\n/**\n * Banners are composed of two components: text on top, and a shadow beneath.\n *\n * @param {*} r - rendering context\n * @param {*} ctx - graphics context to draw to\n * @param {*} text - text to draw\n * @param {*} bannerIndex - plate position to draw, 0=top, incrementing\n * @param {*} textComponent - if true, draw the text. If false, draw the halo\n */\nfunction drawBannerTextComponent(\n r: ShieldRenderingContext,\n ctx: CanvasRenderingContext2D,\n text: string,\n bannerIndex: number,\n textComponent: boolean\n): void {\n const bannerPadding = {\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n };\n\n let bannerBounds: Dimension = {\n width: ctx.canvas.width,\n height: r.px(r.options.bannerHeight - r.options.bannerPadding),\n };\n\n let textLayout: TextPlacement = layoutShieldText(\n r,\n text,\n bannerPadding,\n bannerBounds,\n bannerLayout\n );\n\n ctx.font = shieldFont(textLayout.fontPx, r.options.shieldFont);\n ctx.textBaseline = \"top\";\n ctx.textAlign = \"center\";\n\n if (textComponent) {\n ctx.fillText(\n text,\n textLayout.xBaseline,\n textLayout.yBaseline +\n bannerIndex * r.px(r.options.bannerHeight + r.options.bannerPadding)\n );\n } else {\n ctx.shadowBlur = 0;\n ctx.lineWidth = r.px(2);\n ctx.strokeText(\n text,\n textLayout.xBaseline,\n textLayout.yBaseline +\n bannerIndex * r.px(r.options.bannerHeight + r.options.bannerPadding)\n );\n\n ctx.shadowColor = null;\n ctx.shadowBlur = null;\n }\n}\n", "\"use strict\";\n\nimport * as ShieldText from \"./shield_text\";\nimport * as ShieldDraw from \"./shield_canvas_draw\";\nimport * as Gfx from \"./screen_gfx\";\nimport { drawBanners, drawBannerHalos, getBannerCount } from \"./shield_banner\";\nimport { ShieldRenderingContext } from \"./shield_renderer\";\nimport {\n Dimension,\n RouteDefinition,\n ShieldDefinition,\n ShieldDefinitions,\n} from \"./types\";\nimport { TextPlacement } from \"./shield_text\";\nimport { StyleImage } from \"maplibre-gl\";\n\nconst narrowCharacters = /[1IJijl .-]/g;\nconst maxRefLength = 7;\n\nfunction compoundShieldSize(\n r: ShieldRenderingContext,\n dimension: Dimension,\n bannerCount: number\n): Dimension {\n return {\n width: dimension.width,\n height:\n dimension.height +\n bannerCount * r.px(r.options.bannerHeight + r.options.bannerPadding),\n };\n}\n\nexport function isValidRef(ref: string): boolean {\n return ref !== null && ref.length !== 0 && ref.length <= maxRefLength;\n}\n\n/**\n * Retrieve the shield blank that goes with a particular route. If there are\n * multiple shields for a route (different widths), it picks the best shield.\n *\n * @param {*} r - render context\n * @param {*} shieldDef - shield definition for this route\n * @param {*} routeDef - route tagging from OSM\n * @returns shield blank or null if no shield exists\n */\nfunction getRasterShieldBlank(\n r: ShieldRenderingContext,\n shieldDef: ShieldDefinition,\n routeDef: RouteDefinition\n): StyleImage {\n let shieldArtwork = null;\n let textPlacement: TextPlacement;\n let bannerCount: number = 0;\n let bounds: Dimension;\n\n if (Array.isArray(shieldDef.spriteBlank)) {\n // Certain narrow characters count as two-thirds of a character\n let narrowCharacterCount = (routeDef.ref.match(narrowCharacters) ?? [])\n .length;\n let refLength = Math.ceil(routeDef.ref.length - narrowCharacterCount / 3);\n\n // Choose icon based on optimal character length at end of filename\n let finalIndex = shieldDef.spriteBlank.length - 1;\n let optimalCharacters = shieldDef.spriteBlank.map((blank) =>\n parseInt(blank.split(\"_\").reverse()[0])\n );\n let spriteIndex =\n refLength > optimalCharacters[finalIndex]\n ? finalIndex\n : Math.max(0, optimalCharacters.indexOf(refLength));\n\n shieldArtwork = r.spriteRepo.getSprite(shieldDef.spriteBlank[spriteIndex]);\n } else {\n shieldArtwork = r.spriteRepo.getSprite(shieldDef.spriteBlank);\n }\n\n return shieldArtwork;\n}\n\nfunction textColor(shieldDef: ShieldDefinition): string {\n if (shieldDef != null && typeof shieldDef.textColor != \"undefined\") {\n return shieldDef.textColor;\n }\n return \"black\";\n}\n\nfunction getDrawFunc(\n shieldDef: ShieldDefinition\n): (\n r: ShieldRenderingContext,\n ctx: CanvasRenderingContext2D,\n ref: string\n) => void {\n if (typeof shieldDef.shapeBlank != \"undefined\") {\n return (\n r: ShieldRenderingContext,\n ctx: CanvasRenderingContext2D,\n ref: string\n ) =>\n ShieldDraw.draw(\n r,\n shieldDef.shapeBlank.drawFunc,\n ctx,\n shieldDef.shapeBlank.params,\n ref\n );\n }\n console.warn(`Draw function not defined in:\\n${shieldDef}`);\n return (\n r: ShieldRenderingContext,\n ctx: CanvasRenderingContext2D,\n ref: string\n ) => {};\n}\n\nfunction getDrawHeight(\n r: ShieldRenderingContext,\n shieldDef: ShieldDefinition\n): number {\n if (typeof shieldDef.shapeBlank != \"undefined\") {\n return ShieldDraw.shapeHeight(r, shieldDef.shapeBlank.drawFunc);\n }\n return r.shieldSize();\n}\n\nfunction drawShieldText(\n r: ShieldRenderingContext,\n ctx: CanvasRenderingContext2D,\n shieldDef: ShieldDefinition,\n routeDef: RouteDefinition,\n shieldBounds: Dimension\n): CanvasRenderingContext2D {\n if (shieldDef.notext) {\n //If the shield definition says not to draw a ref, ignore ref\n return ctx;\n }\n\n //The ref is valid and we're supposed to draw it\n var textLayout = ShieldText.layoutShieldTextFromDef(\n r,\n routeDef.ref,\n shieldDef,\n shieldBounds\n );\n\n if (typeof r.debugOptions?.shieldTextHaloColor !== \"undefined\") {\n ctx.strokeStyle = r.debugOptions.shieldTextHaloColor;\n ShieldText.drawShieldHaloText(r, ctx, routeDef.ref, textLayout);\n } else if (shieldDef.textHaloColor) {\n ctx.strokeStyle = shieldDef.textHaloColor;\n ShieldText.drawShieldHaloText(r, ctx, routeDef.ref, textLayout);\n }\n\n ctx.fillStyle = textColor(shieldDef);\n ShieldText.renderShieldText(r, ctx, routeDef.ref, textLayout);\n\n if (r.debugOptions?.shieldTextBboxColor) {\n ctx.strokeStyle = r.debugOptions.shieldTextBboxColor;\n ctx.lineWidth = r.px(1);\n ctx.strokeRect(\n r.px(shieldDef.padding.left - 0.5),\n r.px(shieldDef.padding.top - 0.5),\n shieldBounds.width -\n r.px(shieldDef.padding.left + shieldDef.padding.right - 1),\n shieldBounds.height -\n r.px(shieldDef.padding.top + shieldDef.padding.bottom - 1)\n );\n }\n\n return ctx;\n}\n\nexport function missingIconLoader(\n r: ShieldRenderingContext,\n routeDef: RouteDefinition,\n spriteID: string,\n update: boolean\n): void {\n let ctx = generateShieldCtx(r, routeDef);\n if (ctx == null) {\n // Want to return null here, but that gives a corrupted display. See #243\n console.warn(\"Didn't produce a shield for\", JSON.stringify(routeDef));\n ctx = r.gfxFactory.createGraphics({ width: 1, height: 1 });\n }\n storeSprite(r, spriteID, ctx, update);\n}\n\nfunction storeSprite(\n r: ShieldRenderingContext,\n id: string,\n ctx: CanvasRenderingContext2D,\n update: boolean\n): void {\n const imgData = ctx.getImageData(0, 0, ctx.canvas.width, ctx.canvas.height);\n r.spriteRepo.putSprite(\n id,\n {\n width: ctx.canvas.width,\n height: ctx.canvas.height,\n data: imgData.data,\n },\n { pixelRatio: r.px(1) },\n update\n );\n}\n\nexport function storeNoShield(r: ShieldRenderingContext, id: string): void {\n storeSprite(r, id, r.emptySprite(), false);\n}\n\nfunction refForDefs(routeDef: RouteDefinition, shieldDef: ShieldDefinition) {\n // Handle special case for manually-applied abbreviations\n if (shieldDef.ref) {\n return shieldDef.ref;\n }\n if (\n shieldDef.refsByName &&\n routeDef.name &&\n shieldDef.refsByName[routeDef.name]\n ) {\n return shieldDef.refsByName[routeDef.name];\n }\n return routeDef.ref;\n}\n\nfunction getShieldDef(\n shields: ShieldDefinitions,\n routeDef: RouteDefinition\n): ShieldDefinition {\n if (!shields) {\n //This occurs if the ShieldJSON is loaded from the network and hasn't loaded yet.\n return null;\n }\n\n let shieldDef: ShieldDefinition = shields[routeDef.network];\n\n if (routeDef == null) {\n return null;\n }\n\n if (shieldDef == null) {\n // Default to plain black text with halo and no background shield\n console.debug(\"Generic shield for\", JSON.stringify(routeDef));\n\n return isValidRef(routeDef.ref) ? shields[\"default\"] : null;\n }\n\n var ref = refForDefs(routeDef, shieldDef);\n\n if (shieldDef.overrideByRef) {\n shieldDef = {\n ...shieldDef,\n ...shieldDef.overrideByRef[ref],\n };\n }\n\n if (shieldDef.overrideByName) {\n shieldDef = {\n ...shieldDef,\n ...shieldDef.overrideByName[routeDef.name || \"\"],\n };\n }\n\n //Special case where there's a defined fallback shield when no ref is tagged\n //Example: PA Turnpike\n if (!isValidRef(ref) && \"noref\" in shieldDef) {\n shieldDef = shieldDef.noref;\n // noref implies notext\n shieldDef.notext = true;\n }\n\n //Determine whether a route without a ref gets drawn\n if (\n !isValidRef(ref) &&\n !shieldDef.notext &&\n !shieldDef.ref &&\n !(shieldDef.refsByName && routeDef.name)\n ) {\n return null;\n }\n\n return shieldDef;\n}\n\n/**\n * Reformats an alphanumeric ref as Roman numerals, preserving any alphabetic\n * suffix.\n */\nexport function romanizeRef(ref: string): string {\n let number = parseInt(ref, 10);\n if (isNaN(number)) {\n return ref;\n }\n\n let roman =\n \"M\".repeat(number / 1000) +\n \"D\".repeat((number % 1000) / 500) +\n \"C\".repeat((number % 500) / 100) +\n \"L\".repeat((number % 100) / 50) +\n \"X\".repeat((number % 50) / 10) +\n \"V\".repeat((number % 10) / 5) +\n \"I\".repeat(number % 5);\n roman = roman\n .replace(\"DCCCC\", \"CM\")\n .replace(\"CCCC\", \"CD\")\n .replace(\"LXXXX\", \"XC\")\n .replace(\"XXXX\", \"XL\")\n .replace(\"VIIII\", \"IX\")\n .replace(\"IIII\", \"IV\");\n return roman + ref.slice(number.toString().length);\n}\n\nfunction getDrawnShieldBounds(\n r: ShieldRenderingContext,\n shieldDef: ShieldDefinition,\n ref: string\n): Dimension {\n let width = Math.max(\n r.shieldSize(),\n ShieldDraw.computeWidth(\n r,\n shieldDef.shapeBlank.params,\n ref,\n shieldDef.shapeBlank.drawFunc\n )\n );\n let height = ShieldDraw.shapeHeight(r, shieldDef.shapeBlank.drawFunc);\n\n return { width, height };\n}\n\nfunction bannerAreaHeight(\n r: ShieldRenderingContext,\n bannerCount: number\n): number {\n if (bannerCount === 0) {\n return 0;\n }\n return (\n bannerCount * r.px(r.options.bannerHeight) +\n //No padding after last banner\n (bannerCount - 1) * r.px(r.options.bannerPadding)\n );\n}\n\nexport function generateShieldCtx(\n r: ShieldRenderingContext,\n routeDef: RouteDefinition\n): CanvasRenderingContext2D {\n let shieldDef: ShieldDefinition = getShieldDef(r.shieldDef, routeDef);\n\n if (shieldDef == null) {\n return null;\n }\n\n routeDef.ref = refForDefs(routeDef, shieldDef);\n\n //Determine overall shield+banner dimensions\n let bannerCount = getBannerCount(shieldDef);\n\n let sourceSprite = getRasterShieldBlank(r, shieldDef, routeDef);\n\n let width = r.shieldSize();\n let height = r.shieldSize();\n\n let shieldBounds = null;\n\n if (sourceSprite == null) {\n if (typeof shieldDef.shapeBlank != \"undefined\") {\n let bounds = getDrawnShieldBounds(r, shieldDef, routeDef.ref);\n width = bounds.width;\n height = bounds.height;\n }\n shieldBounds = {\n width: width,\n height: getDrawHeight(r, shieldDef),\n };\n } else {\n width = sourceSprite.data.width;\n height = sourceSprite.data.height;\n shieldBounds = { width, height };\n }\n\n let bannerHeight = bannerAreaHeight(r, bannerCount);\n height += bannerHeight;\n\n //Generate empty canvas sized to the graphic\n let ctx = r.gfxFactory.createGraphics({ width, height });\n\n // Convert numbering systems. Normally alternative numbering systems should be\n // tagged directly in ref=*, but some shields use different numbering systems\n // for aesthetic reasons only.\n if (routeDef.ref && shieldDef.numberingSystem === \"roman\") {\n routeDef.ref = romanizeRef(routeDef.ref);\n }\n\n // Add the halo around modifier plaque text\n drawBannerHalos(r, ctx, shieldDef);\n\n //Shift canvas to draw shield below banner\n ctx.save();\n ctx.translate(0, bannerHeight);\n\n if (sourceSprite == null) {\n let drawFunc = getDrawFunc(shieldDef);\n drawFunc(r, ctx, routeDef.ref);\n } else {\n //This is a raw copy, so the yOffset (bannerHeight) is needed\n Gfx.transposeImageData(\n ctx,\n sourceSprite,\n bannerHeight,\n shieldDef.verticalReflect,\n shieldDef.colorLighten,\n shieldDef.colorDarken\n );\n }\n\n // Draw the shield text\n drawShieldText(r, ctx, shieldDef, routeDef, shieldBounds);\n\n ctx.restore();\n\n // Add modifier plaque text\n drawBanners(r, ctx, shieldDef);\n\n return ctx;\n}\n", "import { Bounds, GraphicsFactory } from \"./types\";\n\n/**\n * Get the Maplibre pixel reation being used in this browser. This determines\n * which sprite sheet is used and whether or not to double dimensions on graphics draws.\n * @returns Returns either 1 or 2 for \"1x\" or \"2x+\" displays.\n */\nexport function getDOMPixelRatio(): 1 | 2 {\n return (typeof window !== \"undefined\" && window.devicePixelRatio) > 1 ? 2 : 1;\n}\n\nexport class DOMGraphicsFactory implements GraphicsFactory {\n createGraphics(bounds: Bounds): CanvasRenderingContext2D {\n var ctx = document.createElement(\"canvas\").getContext(\"2d\");\n var ctx = document\n .createElement(\"canvas\")\n .getContext(\"2d\", { willReadFrequently: true });\n ctx.imageSmoothingQuality = \"high\";\n ctx.textAlign = \"center\";\n ctx.textBaseline = \"top\";\n ctx.canvas.width = bounds.width;\n ctx.canvas.height = bounds.height;\n return ctx;\n }\n pixelRatio(): number {\n return getDOMPixelRatio();\n }\n}\n", "import {\n Map as MapLibre,\n MapStyleImageMissingEvent,\n StyleImage,\n StyleImageMetadata,\n} from \"maplibre-gl\";\nimport {\n Bounds,\n DebugOptions,\n GraphicsFactory,\n RouteDefinition,\n RouteParser,\n ShapeBlankParams,\n ShieldDefinition,\n ShieldDefinitions,\n ShieldOptions,\n ShieldSpecification,\n SpriteRepository,\n StringPredicate,\n} from \"./types\";\nimport {\n storeNoShield,\n missingIconLoader,\n generateShieldCtx,\n} from \"./shield.js\";\nimport { DOMGraphicsFactory } from \"./document_graphics\";\n\nexport class ShieldRenderingContext {\n shieldDef: ShieldDefinitions;\n options: ShieldOptions;\n debugOptions?: DebugOptions;\n gfxFactory: GraphicsFactory;\n spriteRepo: SpriteRepository;\n private _emptySpriteCache: CanvasRenderingContext2D;\n\n public emptySprite(): CanvasRenderingContext2D {\n if (!this._emptySpriteCache) {\n this._emptySpriteCache = this.gfxFactory.createGraphics({\n width: 1,\n height: 1,\n });\n }\n return this._emptySpriteCache;\n }\n public px(pixels: number): number {\n return pixels * this.gfxFactory.pixelRatio();\n }\n public shieldSize(): number {\n return this.px(this.options.shieldSize);\n }\n}\n\nexport type ShapeDrawFunction = (\n r: ShieldRenderingContext,\n ctx: CanvasRenderingContext2D,\n params: ShapeBlankParams,\n ref?: string\n) => number;\n\nclass MaplibreGLSpriteRepository implements SpriteRepository {\n map: MapLibre;\n constructor(map: MapLibre) {\n this.map = map;\n }\n getSprite(spriteID: string): StyleImage {\n return this.map.style.getImage(spriteID);\n }\n putSprite(\n spriteID: string,\n image: ImageData,\n options: Partial,\n update: boolean\n ): void {\n if (update && this.map.listImages().includes(spriteID)) {\n this.map.removeImage(spriteID);\n this.map.addImage(spriteID, image);\n } else {\n this.map.addImage(spriteID, image, options);\n }\n }\n}\n\n/** Base class for shield renderers. Shield renderers use a builder pattern to configure its options. */\nexport class AbstractShieldRenderer {\n private _shieldPredicate: StringPredicate = () => true;\n private _networkPredicate: StringPredicate = () => true;\n private _routeParser: RouteParser;\n private _fontSpec: string;\n private _map: MapLibre;\n private _fontsLoaded: boolean = false;\n /** Cache images that are loaded before fonts so they can be re-rendered later */\n private _preFontImageCache: Map = new Map();\n\n /** @hidden */\n private _renderContext: ShieldRenderingContext;\n private _shieldDefCallbacks = [];\n\n /** Create a shield renderer */\n constructor(routeParser: RouteParser) {\n this._routeParser = routeParser;\n this._renderContext = new ShieldRenderingContext();\n this._renderContext.gfxFactory = new DOMGraphicsFactory();\n }\n\n /** Specify which shields to draw and with what graphics */\n protected setShields(shieldSpec: ShieldSpecification) {\n this._renderContext.options = shieldSpec.options;\n\n // Unpack any banner maps and compose them as separate network entries in-memory\n for (const [key, shieldDef] of Object.entries(shieldSpec.networks)) {\n if (!shieldDef) {\n continue; // Skip if shieldDef is null or undefined\n }\n\n // Check to see if it has a bannerMap\n if (shieldDef.bannerMap) {\n // If it does, loop through each entry in the bannerMap\n for (const [bannerKey, banners] of Object.entries(\n shieldDef.bannerMap\n )) {\n // Make a copy of the ShieldDefinition and attach the banners\n const banneredShieldDef: ShieldDefinition = {\n ...shieldDef,\n banners: banners,\n };\n // Insert this modified ShieldDefinition into the global network list\n shieldSpec.networks[bannerKey] = banneredShieldDef;\n }\n }\n }\n\n this._renderContext.shieldDef = shieldSpec.networks;\n this._fontSpec = \"1em \" + shieldSpec.options.shieldFont;\n console.log(\"ShieldJSON loaded\");\n if (this._map) {\n this.reloadShieldsOnFontLoad();\n }\n this._shieldDefCallbacks.forEach((callback) =>\n callback(shieldSpec.networks)\n );\n }\n\n private onFontsLoaded() {\n this._fontsLoaded = true;\n if (this._preFontImageCache.size == 0) {\n return;\n }\n console.log(\"Re-processing shields with loaded fonts\");\n\n // Loop through each previously-loaded shield and re-render it\n for (let [id, routeDef] of this._preFontImageCache.entries()) {\n missingIconLoader(this._renderContext, routeDef, id, true);\n }\n\n this._preFontImageCache.clear();\n this._map.redraw();\n }\n\n /** Get the shield definitions */\n public getShieldDefinitions(): ShieldDefinitions {\n return this._renderContext.shieldDef;\n }\n\n /** Set debugging options */\n public debugOptions(debugOptions: DebugOptions): AbstractShieldRenderer {\n this._renderContext.debugOptions = debugOptions;\n return this;\n }\n\n /** Set which unhandled sprite IDs this renderer handles */\n public filterImageID(\n shieldPredicate: StringPredicate\n ): AbstractShieldRenderer {\n this._shieldPredicate = shieldPredicate;\n return this;\n }\n\n /** Set which network values this renderer handles */\n public filterNetwork(\n networkPredicate: StringPredicate\n ): AbstractShieldRenderer {\n this._networkPredicate = networkPredicate;\n return this;\n }\n\n /** Set which graphics context to draw shields to */\n public graphicsFactory(gfxFactory: GraphicsFactory): AbstractShieldRenderer {\n this._renderContext.gfxFactory = gfxFactory;\n return this;\n }\n\n /** Set which MaplibreGL map to handle shields for */\n public renderOnMaplibreGL(map: MapLibre): AbstractShieldRenderer {\n this._map = map;\n if (this._fontSpec) {\n this.reloadShieldsOnFontLoad();\n }\n this.renderOnRepository(new MaplibreGLSpriteRepository(map));\n map.on(\"styleimagemissing\", this.getStyleImageMissingHandler());\n return this;\n }\n\n private reloadShieldsOnFontLoad(): void {\n if (!this._fontsLoaded && !document.fonts.check(this._fontSpec)) {\n document.fonts.load(this._fontSpec).then(() => this.onFontsLoaded());\n } else {\n this._fontsLoaded = true;\n }\n }\n\n /** Set a callback that fires when shield definitions are loaded */\n public onShieldDefLoad(\n callback: (shields: ShieldDefinitions) => void\n ): AbstractShieldRenderer {\n if (this._renderContext.shieldDef) {\n callback(this._renderContext.shieldDef);\n } else {\n this._shieldDefCallbacks.push(callback);\n }\n return this;\n }\n\n /** Set the storage location for existing and generated sprite images */\n public renderOnRepository(repo: SpriteRepository): AbstractShieldRenderer {\n if (!this._renderContext.spriteRepo) {\n this._renderContext.spriteRepo = repo;\n }\n return this;\n }\n\n /**\n * Get the handler function for styleimagemissing event calls\n *\n * See [MapStyleImageMissingEvent](https://maplibre.org/maplibre-gl-js/docs/API/types/maplibregl.MapStyleImageMissingEvent/) for more details.\n **/\n public getStyleImageMissingHandler() {\n return (e: MapStyleImageMissingEvent) => {\n try {\n if (!this._shieldPredicate(e.id)) {\n return;\n }\n let routeDef: RouteDefinition = this._routeParser.parse(e.id);\n if (!this._networkPredicate(routeDef.network)) {\n storeNoShield(this._renderContext, e.id);\n return;\n }\n if (routeDef) {\n if (!this._fontsLoaded && routeDef.ref) {\n this._preFontImageCache.set(e.id, routeDef);\n }\n missingIconLoader(this._renderContext, routeDef, e.id, false);\n }\n } catch (err) {\n console.error(`Exception while loading image \u2018${e?.id}\u2019:\\n`, err);\n }\n };\n }\n\n /** Get the graphic for a specified route */\n public getGraphicForRoute(network: string, ref: string, name: string) {\n return generateShieldCtx(this._renderContext, {\n network,\n ref,\n name,\n });\n }\n\n /** Get a blank route shield sprite in the default size */\n public emptySprite(): CanvasRenderingContext2D {\n return this._renderContext.emptySprite();\n }\n\n /** Get a blank route shield graphics context in a specified size */\n public createGraphics(bounds: Bounds): CanvasRenderingContext2D {\n return this._renderContext.gfxFactory.createGraphics(bounds);\n }\n\n /** Get the current pixel ration (1x/2x) */\n public pixelRatio(): number {\n return this._renderContext.px(1);\n }\n}\n\n/**\n * A shield renderer configured from a JSON specification\n *\n * @example\n *\n * const shields = {\n * \"US:I\": {\n * textColor: Color.shields.white,\n * spriteBlank: [\"shield_us_interstate_2\", \"shield_us_interstate_3\"],\n * textLayout: textConstraint(\"southHalfEllipse\"),\n * padding: {\n * left: 4,\n * right: 4,\n * top: 6,\n * bottom: 5,\n * },\n * }\n * };\n *\n * const shieldRenderer = new ShieldRenderer(shields, routeParser)\n * .filterImageID(shieldPredicate)\n * .filterNetwork(networkPredicate)\n * .renderOnMaplibreGL(map)\n * .onShieldDefLoad((shields) => afterShieldRendererLoads(shields)); //Post config\n */\nexport class ShieldRenderer extends AbstractShieldRenderer {\n constructor(shieldSpec: ShieldSpecification, routeParser: RouteParser) {\n super(routeParser);\n this.setShields(shieldSpec);\n }\n}\n\n/**\n * A shield renderer configured from a URL containing a JSON specification\n *\n * @example\n *\n * const shieldRenderer = new URLShieldRenderer(\"shields.json\", routeParser)\n * .filterImageID(shieldPredicate)\n * .filterNetwork(networkPredicate)\n * .renderOnMaplibreGL(map)\n * .onShieldDefLoad((shields) => afterShieldRendererLoads(shields)); //Post config\n **/\nexport class URLShieldRenderer extends AbstractShieldRenderer {\n constructor(\n /** URL containing the JSON shield definition */\n shieldsURL: URL,\n /** Function that extracts route identification from a sprite string */\n routeParser: RouteParser\n ) {\n super(routeParser);\n this.setShieldURL(shieldsURL);\n }\n\n /** Set the URL containing the shield specification */\n private async setShieldURL(shieldsURL: URL) {\n await fetch(shieldsURL)\n .then((res) => res.json())\n .then((json) => super.setShields(json))\n .catch((err) => console.error(err));\n }\n}\n\n/** @hidden Used for testing */\nexport class InMemorySpriteRepository implements SpriteRepository {\n sprites = {};\n public getSprite(spriteID: string): StyleImage {\n return this.sprites[spriteID];\n }\n public hasSprite(spriteID: string): boolean {\n return spriteID in this.sprites;\n }\n public putSprite(spriteID: string, image: ImageData): void {\n this.sprites[spriteID] = image;\n }\n}\n\nconst localRepo = new InMemorySpriteRepository();\n", "import { ShieldDefinition, TextLayout } from \"./types\";\n\n/**\n * Constrain the text to a rounded rectangle\n *\n * @param radius 1x pixel radius of the constraint corners\n * @returns a constraint definition\n */\nexport function roundedRectTextConstraint(radius: number): TextLayout {\n return {\n constraintFunc: \"roundedRect\",\n options: {\n radius: radius,\n },\n };\n}\n\n/**\n * Constrain the text to a specified constraint type\n *\n * @returns a constraint definition\n */\nexport function textConstraint(fxn: string): TextLayout {\n return {\n constraintFunc: fxn,\n };\n}\n\n/**\n * Draws a shield with an ellipse background\n *\n * @param {*} fillColor - Color of ellipse background fill\n * @param {*} strokeColor - Color of ellipse outline stroke\n * @param {*} textColor - Color of text (defaults to strokeColor)\n * @param {*} rectWidth - Width of ellipse (defaults to variable-width)\n * @returns a shield definition object\n */\nexport function ovalShield(\n fillColor: string,\n strokeColor: string,\n textColor: string,\n rectWidth: number\n): Partial {\n textColor = textColor ?? strokeColor;\n return {\n shapeBlank: {\n drawFunc: \"ellipse\",\n params: {\n fillColor,\n strokeColor,\n rectWidth,\n },\n },\n textLayout: textConstraint(\"ellipse\"),\n padding: {\n left: 2,\n right: 2,\n top: 2,\n bottom: 2,\n },\n textColor,\n };\n}\n\n/**\n * Draws a shield with circle background (special case of ovalShield)\n *\n * @param {*} fillColor - Color of circle background fill\n * @param {*} strokeColor - Color of circle outline stroke\n * @param {*} textColor - Color of text (defaults to strokeColor)\n * @returns a shield definition object\n */\nexport function circleShield(\n fillColor: string,\n strokeColor: string,\n textColor: string\n): Partial {\n return ovalShield(fillColor, strokeColor, textColor, 20);\n}\n\n/**\n * Draws a shield with a rectangle background\n *\n * @param {*} fillColor - Color of rectangle background fill\n * @param {*} strokeColor - Color of rectangle outline stroke\n * @param {*} textColor - Color of text (defaults to strokeColor)\n * @param {*} rectWidth - Width of rectangle (defaults to variable-width)\n * @param {*} radius - Corner radius of rectangle (defaults to 2)\n * @returns a shield definition object\n */\nexport function roundedRectShield(\n fillColor: string,\n strokeColor: string,\n textColor: string,\n rectWidth: number,\n radius: number\n): Partial {\n textColor = textColor ?? strokeColor;\n radius = radius ?? 2;\n return {\n shapeBlank: {\n drawFunc: \"roundedRectangle\",\n params: {\n fillColor,\n strokeColor,\n rectWidth,\n radius,\n },\n },\n textLayout: roundedRectTextConstraint(radius),\n padding: {\n left: 3,\n right: 3,\n top: 3,\n bottom: 3,\n },\n textColor,\n };\n}\n\n/**\n * Draws a shield with an escutcheon background, pointed downward\n *\n * @param {*} yOffset - Height of curved portion\n * @param {*} fillColor - Color of escutcheon background fill\n * @param {*} strokeColor - Color of escutcheon outline stroke\n * @param {*} textColor - Color of text (defaults to strokeColor)\n * @param {*} radius - Corner radius of escutcheon (defaults to 0)\n * @param {*} rectWidth - Width of escutcheon (defaults to variable-width)\n * @returns a shield definition object\n */\nexport function escutcheonDownShield(\n yOffset: number,\n fillColor: string,\n strokeColor: string,\n textColor: string,\n radius: number,\n rectWidth: number\n): Partial {\n textColor = textColor ?? strokeColor;\n radius = radius ?? 0;\n return {\n shapeBlank: {\n drawFunc: \"escutcheon\",\n params: {\n yOffset,\n fillColor,\n strokeColor,\n rectWidth,\n radius,\n outlineWidth: 1,\n },\n },\n textLayout: roundedRectTextConstraint(radius),\n padding: {\n left: 2,\n right: 2,\n top: 2,\n bottom: 0 + yOffset / 2,\n },\n textColor,\n };\n}\n\n/**\n * Draws a shield with a fishhead background, pointed downward\n *\n * @param {*} fillColor - Color of fishhead background fill\n * @param {*} strokeColor - Color of fishhead outline stroke\n * @param {*} textColor - Color of text (defaults to strokeColor)\n * @param {*} rectWidth - Width of fishhead (defaults to variable-width)\n * @returns a shield definition object\n */\nexport function fishheadDownShield(\n fillColor: string,\n strokeColor: string,\n textColor: string,\n rectWidth: number\n): Partial {\n textColor = textColor ?? strokeColor;\n return {\n shapeBlank: {\n drawFunc: \"fishhead\",\n params: {\n fillColor,\n strokeColor,\n rectWidth,\n outlineWidth: 1,\n },\n },\n textLayout: textConstraint(\"ellipse\"),\n padding: {\n left: 1,\n right: 1,\n top: 1,\n bottom: 5,\n },\n textColor,\n };\n}\n\n/**\n * Draws a shield with a triangle background, pointed downward\n *\n * @param {*} fillColor - Color of triangle background fill\n * @param {*} strokeColor - Color of triangle outline stroke\n * @param {*} textColor - Color of text (defaults to strokeColor)\n * @param {*} radius - Corner radius of triangle (defaults to 2)\n * @param {*} rectWidth - Width of triangle (defaults to variable-width)\n * @returns a shield definition object\n */\nexport function triangleDownShield(\n fillColor: string,\n strokeColor: string,\n textColor: string,\n radius: number,\n rectWidth: number\n): Partial {\n textColor = textColor ?? strokeColor;\n radius = radius ?? 2;\n\n return {\n shapeBlank: {\n drawFunc: \"triangle\",\n params: {\n pointUp: false,\n fillColor,\n strokeColor,\n rectWidth,\n radius,\n },\n },\n textLayout: textConstraint(\"triangleDown\"),\n padding: {\n left: 1,\n right: 1,\n top: 2,\n bottom: 1,\n },\n textColor,\n };\n}\n\n/**\n * Draws a shield with a trapezoid background, with the short side on bottom\n *\n * @param {*} sideAngle - Angle (in degrees) at which sides deviate from vertical\n * @param {*} fillColor - Color of trapezoid background fill\n * @param {*} strokeColor - Color of trapezoid outline stroke\n * @param {*} textColor - Color of text (defaults to strokeColor)\n * @param {*} radius - Corner radius of trapezoid (defaults to 0)\n * @param {*} rectWidth - Width of trapezoid (defaults to variable-width)\n * @returns a shield definition object\n */\nexport function trapezoidDownShield(\n sideAngle: number,\n fillColor: string,\n strokeColor: string,\n textColor: string,\n radius: number,\n rectWidth: number\n): Partial {\n let angleInRadians = (sideAngle * Math.PI) / 180;\n textColor = textColor ?? strokeColor;\n radius = radius ?? 0;\n\n return {\n shapeBlank: {\n drawFunc: \"trapezoid\",\n params: {\n sideAngle: angleInRadians,\n fillColor,\n strokeColor,\n rectWidth,\n radius,\n },\n },\n textLayout: roundedRectTextConstraint(radius),\n padding: {\n left: 2 + 10 * Math.tan(angleInRadians),\n right: 2 + 10 * Math.tan(angleInRadians),\n top: 2,\n bottom: 4,\n },\n textColor,\n };\n}\n\n/**\n * Draws a shield with a trapezoid background, with the short side on top\n *\n * @param {*} sideAngle - Angle (in degrees) at which sides deviate from vertical\n * @param {*} fillColor - Color of trapezoid background fill\n * @param {*} strokeColor - Color of trapezoid outline stroke\n * @param {*} textColor - Color of text (defaults to strokeColor)\n * @param {*} radius - Corner radius of trapezoid (defaults to 0)\n * @param {*} rectWidth - Width of trapezoid (defaults to variable-width)\n * @returns a shield definition object\n */\nexport function trapezoidUpShield(\n sideAngle: number,\n fillColor: string,\n strokeColor: string,\n textColor: string,\n radius: number,\n rectWidth: number\n): Partial {\n let angleInRadians = (sideAngle * Math.PI) / 180;\n textColor = textColor ?? strokeColor;\n radius = radius ?? 0;\n return {\n shapeBlank: {\n drawFunc: \"trapezoid\",\n params: {\n shortSideUp: true,\n sideAngle: angleInRadians,\n fillColor,\n strokeColor,\n rectWidth,\n radius,\n },\n },\n textLayout: roundedRectTextConstraint(radius),\n padding: {\n left: 2 + 10 * Math.tan(angleInRadians),\n right: 2 + 10 * Math.tan(angleInRadians),\n top: 4,\n bottom: 2,\n },\n textColor,\n };\n}\n\n/**\n * Draws a shield with a diamond background\n *\n * @param {*} fillColor - Color of diamond background fill\n * @param {*} strokeColor - Color of diamond outline stroke\n * @param {*} textColor - Color of text (defaults to strokeColor)\n * @param {*} radius - Corner radius of diamond (defaults to 2)\n * @param {*} rectWidth - Width of diamond (defaults to variable-width)\n * @returns a shield definition object\n */\nexport function diamondShield(\n fillColor: string,\n strokeColor: string,\n textColor: string,\n radius: number,\n rectWidth: number\n): Partial {\n textColor = textColor ?? strokeColor;\n radius = radius ?? 2;\n return {\n shapeBlank: {\n drawFunc: \"diamond\",\n params: {\n fillColor,\n strokeColor,\n radius,\n rectWidth,\n },\n },\n textLayout: textConstraint(\"diamond\"),\n padding: {\n left: 1,\n right: 1,\n top: 1,\n bottom: 1,\n },\n textColor,\n };\n}\n\n/**\n * Draws a shield with a pentagon background, pointed upward\n *\n * @param {*} yOffset - Height of diagonal edges\n * @param {*} sideAngle - Angle (in degrees) at which sides deviate from vertical\n * @param {*} fillColor - Color of pentagon background fill\n * @param {*} strokeColor - Color of pentagon outline stroke\n * @param {*} textColor - Color of text (defaults to strokeColor)\n * @param {*} radius1 - Corner radius of pointed side of pentagon (defaults to 2)\n * @param {*} radius2 - Corner radius of flat side of pentagon (defaults to 0)\n * @param {*} rectWidth - Width of pentagon (defaults to variable-width)\n * @returns a shield definition object\n */\nexport function pentagonUpShield(\n yOffset: number,\n sideAngle: number,\n fillColor: string,\n strokeColor: string,\n textColor: string,\n radius1: number,\n radius2: number,\n rectWidth: number\n): Partial {\n let angleInRadians = (sideAngle * Math.PI) / 180;\n textColor = textColor ?? strokeColor;\n radius1 = radius1 ?? 2;\n radius2 = radius2 ?? 0;\n return {\n shapeBlank: {\n drawFunc: \"pentagon\",\n params: {\n yOffset,\n sideAngle: angleInRadians,\n fillColor,\n strokeColor,\n radius1,\n radius2,\n rectWidth,\n },\n },\n textLayout: {\n constraintFunc: \"rect\",\n },\n padding: {\n left: 2 + ((20 - yOffset) * Math.tan(angleInRadians)) / 2,\n right: 2 + ((20 - yOffset) * Math.tan(angleInRadians)) / 2,\n top: 1 + yOffset / 2,\n bottom: 3,\n },\n textColor,\n };\n}\n\n/**\n * Draws a shield with a home plate background, pointed downward\n *\n * @param {*} yOffset - Height of diagonal edges\n * @param {*} fillColor - Color of home plate background fill\n * @param {*} strokeColor - Color of home plate outline stroke\n * @param {*} textColor - Color of text (defaults to strokeColor)\n * @param {*} radius1 - Corner radius of pointed side of home plate (defaults to 2)\n * @param {*} radius2 - Corner radius of flat side of home plate (defaults to 2)\n * @param {*} rectWidth - Width of home plate (defaults to variable-width)\n * @returns a shield definition object\n */\nexport function homePlateDownShield(\n yOffset: number,\n fillColor: string,\n strokeColor: string,\n textColor: string,\n radius1: number,\n radius2: number,\n rectWidth: number\n): Partial {\n textColor = textColor ?? strokeColor;\n radius1 = radius1 ?? 2;\n radius2 = radius2 ?? 2;\n return {\n shapeBlank: {\n drawFunc: \"pentagon\",\n params: {\n pointUp: false,\n yOffset,\n sideAngle: 0,\n fillColor,\n strokeColor,\n radius1,\n radius2,\n rectWidth,\n },\n },\n textLayout: roundedRectTextConstraint(radius2),\n padding: {\n left: 2,\n right: 2,\n top: 2,\n bottom: 1 + yOffset,\n },\n textColor,\n };\n}\n\n/**\n * Draws a shield with a home plate background, pointed upward\n *\n * @param {*} yOffset - Height of diagonal edges\n * @param {*} fillColor - Color of home plate background fill\n * @param {*} strokeColor - Color of home plate outline stroke\n * @param {*} textColor - Color of text (defaults to strokeColor)\n * @param {*} radius1 - Corner radius of pointed side of home plate (defaults to 2)\n * @param {*} radius2 - Corner radius of flat side of home plate (defaults to 2)\n * @param {*} rectWidth - Width of home plate (defaults to variable-width)\n * @returns a shield definition object\n */\nexport function homePlateUpShield(\n yOffset: number,\n fillColor: string,\n strokeColor: string,\n textColor: string,\n radius1: number,\n radius2: number,\n rectWidth: number\n): Partial {\n textColor = textColor ?? strokeColor;\n radius1 = radius1 ?? 2;\n radius2 = radius2 ?? 2;\n return {\n shapeBlank: {\n drawFunc: \"pentagon\",\n params: {\n pointUp: true,\n yOffset,\n sideAngle: 0,\n fillColor,\n strokeColor,\n radius1,\n radius2,\n rectWidth,\n },\n },\n textLayout: roundedRectTextConstraint(radius2),\n padding: {\n left: 2,\n right: 2,\n top: 1 + yOffset,\n bottom: 2,\n },\n textColor,\n };\n}\n\n/**\n * Draws a shield with a vertically-aligned hexagon background\n *\n * @param {*} yOffset - Height of diagonal edges\n * @param {*} fillColor - Color of hexagon background fill\n * @param {*} strokeColor - Color of hexagon outline stroke\n * @param {*} textColor - Color of text (defaults to strokeColor)\n * @param {*} radius - Corner radius of hexagon (defaults to 2)\n * @param {*} rectWidth - Width of hexagon (defaults to variable-width)\n * @returns a shield definition object\n */\nexport function hexagonVerticalShield(\n yOffset: number,\n fillColor: string,\n strokeColor: string,\n textColor: string,\n radius: number,\n rectWidth: number\n): Partial {\n textColor = textColor ?? strokeColor;\n radius = radius ?? 2;\n return {\n shapeBlank: {\n drawFunc: \"hexagonVertical\",\n params: {\n yOffset,\n fillColor,\n strokeColor,\n radius,\n rectWidth,\n },\n },\n textLayout: roundedRectTextConstraint(radius),\n padding: {\n left: 2,\n right: 2,\n top: 1 + yOffset,\n bottom: 1 + yOffset,\n },\n textColor,\n };\n}\n\n/**\n * Draws a shield with a horizontally-aligned hexagon background\n *\n * @param {*} sideAngle - Angle (in degrees) at which sides deviate from vertical\n * @param {*} fillColor - Color of hexagon background fill\n * @param {*} strokeColor - Color of hexagon outline stroke\n * @param {*} textColor - Color of text (defaults to strokeColor)\n * @param {*} radius - Corner radius of hexagon (defaults to 2)\n * @param {*} rectWidth - Width of hexagon (defaults to variable-width)\n * @returns a shield definition object\n */\nexport function hexagonHorizontalShield(\n sideAngle: number,\n fillColor: string,\n strokeColor: string,\n textColor: string,\n radius: number,\n rectWidth: number\n): Partial {\n let angleInRadians = (sideAngle * Math.PI) / 180;\n textColor = textColor ?? strokeColor;\n radius = radius ?? 2;\n return {\n shapeBlank: {\n drawFunc: \"hexagonHorizontal\",\n params: {\n sideAngle: angleInRadians,\n fillColor,\n strokeColor,\n radius,\n rectWidth,\n },\n },\n textLayout: textConstraint(\"ellipse\"),\n padding: {\n left: 3,\n right: 3,\n top: 2,\n bottom: 2,\n },\n textColor,\n };\n}\n\n/**\n * Draws a shield with an octagon background\n *\n * @param {*} yOffset - Height of diagonal edges\n * @param {*} sideAngle - Angle (in degrees) at which sides deviate from vertical\n * @param {*} fillColor - Color of octagon background fill\n * @param {*} strokeColor - Color of octagon outline stroke\n * @param {*} textColor - Color of text (defaults to strokeColor)\n * @param {*} radius - Corner radius of octagon (defaults to 2)\n * @param {*} rectWidth - Width of octagon (defaults to variable-width)\n * @returns a shield definition object\n */\nexport function octagonVerticalShield(\n yOffset: number,\n sideAngle: number,\n fillColor: string,\n strokeColor: string,\n textColor: string,\n radius: number,\n rectWidth: number\n): Partial {\n let angleInRadians = (sideAngle * Math.PI) / 180;\n textColor = textColor ?? strokeColor;\n radius = radius ?? 2;\n return {\n shapeBlank: {\n drawFunc: \"octagonVertical\",\n params: {\n yOffset,\n sideAngle: angleInRadians,\n fillColor,\n strokeColor,\n radius,\n rectWidth,\n },\n },\n textLayout: textConstraint(\"ellipse\"),\n padding: {\n left: 2,\n right: 2,\n top: 2,\n bottom: 2,\n },\n textColor,\n };\n}\n\n/**\n * Draws a shield with a pill-shaped background\n *\n * @param {*} fillColor - Color of pill background fill\n * @param {*} strokeColor - Color of pill outline stroke\n * @param {*} textColor - Color of text (defaults to strokeColor)\n * @param {*} rectWidth - Width of pill (defaults to variable-width)\n * @returns a shield definition object\n */\nexport function pillShield(\n fillColor: string,\n strokeColor: string,\n textColor: string,\n rectWidth: number\n): Partial {\n textColor = textColor ?? strokeColor;\n return {\n shapeBlank: {\n drawFunc: \"pill\",\n params: {\n fillColor,\n strokeColor,\n rectWidth,\n },\n },\n textLayout: textConstraint(\"ellipse\"),\n padding: {\n left: 2,\n right: 2,\n top: 2,\n bottom: 2,\n },\n textColor,\n };\n}\n\n/**\n * Adds banner text above a shield\n *\n * @param {*} baseDef - Shield definition object\n * @param {*} banners - Array of strings to be displayed above shield\n * @returns a shield definition object\n */\nexport function banneredShield(\n baseDef: ShieldDefinition,\n banners: string[],\n bannerColor?: string\n): ShieldDefinition {\n return {\n banners,\n bannerTextColor: bannerColor,\n ...baseDef,\n };\n}\n\n/**\n * Draws a circle icon inside a black-outlined white square shield\n *\n * @param {*} fillColor - Color of circle icon background fill\n * @param {*} strokeColor - Color of circle icon outline\n * @returns a shield definition object\n */\nexport function paBeltShield(\n fillColor: string,\n strokeColor: string\n): Partial {\n return {\n notext: true,\n shapeBlank: {\n drawFunc: \"paBelt\",\n params: {\n fillColor,\n strokeColor,\n },\n },\n };\n}\n\n/**\n * Draws a Branson, Missouri route shield\n *\n * @param {*} fillColor - Color of rectangle icon background fill\n * @param {*} strokeColor - Color of rectangle icon outline\n * @returns a shield definition object\n */\nexport function bransonRouteShield(\n fillColor: string,\n strokeColor: string\n): Partial {\n return {\n notext: true,\n shapeBlank: {\n drawFunc: \"branson\",\n params: {\n fillColor,\n strokeColor,\n },\n },\n };\n}\n"], "mappings": "0hBAAA,IAAAA,GAAAC,GAAA,CAAAC,GAAAC,KAAA,cAEAA,GAAO,QAAU,CAChB,UAAa,CAAC,IAAK,IAAK,GAAG,EAC3B,aAAgB,CAAC,IAAK,IAAK,GAAG,EAC9B,KAAQ,CAAC,EAAG,IAAK,GAAG,EACpB,WAAc,CAAC,IAAK,IAAK,GAAG,EAC5B,MAAS,CAAC,IAAK,IAAK,GAAG,EACvB,MAAS,CAAC,IAAK,IAAK,GAAG,EACvB,OAAU,CAAC,IAAK,IAAK,GAAG,EACxB,MAAS,CAAC,EAAG,EAAG,CAAC,EACjB,eAAkB,CAAC,IAAK,IAAK,GAAG,EAChC,KAAQ,CAAC,EAAG,EAAG,GAAG,EAClB,WAAc,CAAC,IAAK,GAAI,GAAG,EAC3B,MAAS,CAAC,IAAK,GAAI,EAAE,EACrB,UAAa,CAAC,IAAK,IAAK,GAAG,EAC3B,UAAa,CAAC,GAAI,IAAK,GAAG,EAC1B,WAAc,CAAC,IAAK,IAAK,CAAC,EAC1B,UAAa,CAAC,IAAK,IAAK,EAAE,EAC1B,MAAS,CAAC,IAAK,IAAK,EAAE,EACtB,eAAkB,CAAC,IAAK,IAAK,GAAG,EAChC,SAAY,CAAC,IAAK,IAAK,GAAG,EAC1B,QAAW,CAAC,IAAK,GAAI,EAAE,EACvB,KAAQ,CAAC,EAAG,IAAK,GAAG,EACpB,SAAY,CAAC,EAAG,EAAG,GAAG,EACtB,SAAY,CAAC,EAAG,IAAK,GAAG,EACxB,cAAiB,CAAC,IAAK,IAAK,EAAE,EAC9B,SAAY,CAAC,IA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Q,CACN,UAAAD,EACA,YAAAC,EACA,UAAAE,CACF,CACF,EACA,WAAYN,EAAe,SAAS,EACpC,QAAS,CACP,KAAM,EACN,MAAO,EACP,IAAK,EACL,OAAQ,CACV,EACA,UAAAK,CACF,CACF,CASO,SAASsB,GACdC,EACAC,EACAC,EACkB,CAClB,MAAO,CACL,QAAAD,EACA,gBAAiBC,EACjB,GAAGF,CACL,CACF,CASO,SAASG,GACd5B,EACAC,EAC2B,CAC3B,MAAO,CACL,OAAQ,GACR,WAAY,CACV,SAAU,SACV,OAAQ,CACN,UAAAD,EACA,YAAAC,CACF,CACF,CACF,CACF,CASO,SAAS4B,GACd7B,EACAC,EAC2B,CAC3B,MAAO,CACL,OAAQ,GACR,WAAY,CACV,SAAU,UACV,OAAQ,CACN,UAAAD,EACA,YAAAC,CACF,CACF,CACF,CACF", "names": ["require_color_name", "__commonJSMin", "exports", "module", "import_color_name", "color_parse_default", "parse", "baseHues", "cstr", "m", "parts", "alpha", "space", "names", "base", "size", "isShort", "name", "isRGB", "x", "i", "value", "rgb_default", "hsl_default", "hsl", "h", "s", "l", "t1", "t2", "t3", "rgb", "val", "i", "rgb_default", "r", "g", "b", "min", "max", "delta", "rgba", "color", "values", "i", "l", "parsed", "color_parse_default", "min", "hsl_default", "rgb_default", "max", "defaultFontFamily", "shieldFont", "size", "fontFamily", "fontSizeThreshold", "blendedColorVal", "sourceVal", "lightenVal", "darkenVal", "copyPixel", "source", "dest", "sourceOffset", "destOffset", "copyAndRecolorPixel", "colorLighten", "colorDarken", "transposeImageData", "destination", "yOffset", "verticalReflect", "imgData", "pixelCopyFn", "lighten", "rgba", "darken", "y", "x", "destIdx", "srcIdx", "i", "VerticalAlignment", "noPadding", "ellipseScale", "spaceBounds", "textBounds", "a", "b", "x0", "y0", "ellipseTextConstraint", "southHalfEllipseTextConstraint", "rectTextConstraint", "scaleHeight", "scaleWidth", "roundedRectTextConstraint", "options", "constraintRadius", "diamondTextConstraint", "triangleDownTextConstraint", "isRunningInWebKit", "userAgent", "layoutShieldText", "r", "text", "padding", "bounds", "textLayoutDef", "maxFontSize", "padTop", "padBot", "padLeft", "padRight", "maxFont", "ctx", "shieldFont", "fontSizeThreshold", "metrics", "textWidth", "textHeight", "availHeight", "availWidth", "xBaseline", "textLayoutFunc", "drawTextFunctions", "textConstraint", "fontSize", "yBaseline", "defaultDefForLayout", "layoutShieldTextFromDef", "def", "renderShieldText", "textLayout", "configureShieldText", "drawShieldHaloText", "calculateTextWidth", "registerDrawTextFunction", "name", "fxn", "paBelt", "r", "ctx", "params", "roundedRectangle", "fillColor", "lineWidth", "diameter", "bransonRoute", "x", "width", "y", "height", "loadCustomShields", "registerDrawFunction", "minGenericShieldWidth", "maxGenericShieldWidth", "genericShieldFontSize", "computeWidth", "r", "params", "ref", "shape", "fixedWidthDefinitions", "rectWidth", "sideAngle", "tangent", "shieldWidth", "calculateTextWidth", "minWidth", "yOffset", "ellipse", "ctx", "fill", "outline", "width", "lineWidth", "radiusX", "radiusY", "pill", "roundedRectangle", "radius", "outlineWidth", "lineThick", "drawRadius", "x0", "x1", "x2", "x3", "y0", "y1", "y2", "y3", "escutcheon", "drawOffset", "x5", "y5", "x4", "y4", "fishhead", "pointUp", "angleSign", "x8", "y6", "x6", "x7", "triangle", "angle", "sine", "cosine", "halfTangent", "halfComplementTangent", "trapezoid", "shortSideUp", "x9", "diamond", "height", "shapeHeight", "y8", "y7", "pentagon", "radius1", "radius2", "drawRadius1", "drawRadius2", "offsetAngle", "halfComplementAngle1", "halfComplementTangent1", "halfComplementAngle2", "halfComplementTangent2", "hexagonVertical", "drawOffsetTangent", "hexagonHorizontal", "octagonVertical", "x10", "y10", "offsetSine", "offsetCosine", "halfComplementAngle", "halfComplementCosine", "dx", "dy", "y9", "name", "draw", "drawFunctions", "registerDrawFunction", "fxn", "fixedWidth", "loadCustomShields", "bannerLayout", "drawBanners", "r", "ctx", "shieldDef", "drawBannerPart", "drawBannerText", "drawBannerHalos", "drawBannerHaloText", "drawFunc", "i", "getBannerCount", "shield", "text", "bannerIndex", "drawBannerTextComponent", "textComponent", "bannerPadding", "bannerBounds", "textLayout", "layoutShieldText", "shieldFont", "narrowCharacters", "maxRefLength", "isValidRef", "ref", "maxRefLength", "getRasterShieldBlank", "r", "shieldDef", "routeDef", "_a", "shieldArtwork", "textPlacement", "bannerCount", "bounds", "narrowCharacterCount", "narrowCharacters", "refLength", "finalIndex", "optimalCharacters", "blank", "spriteIndex", "textColor", "getDrawFunc", "ctx", "draw", "getDrawHeight", "shapeHeight", "drawShieldText", "shieldBounds", "_b", "textLayout", "layoutShieldTextFromDef", "drawShieldHaloText", "renderShieldText", "missingIconLoader", "spriteID", "update", "generateShieldCtx", "storeSprite", "id", "imgData", "storeNoShield", "refForDefs", "getShieldDef", "shields", "romanizeRef", "number", "roman", "getDrawnShieldBounds", "width", "computeWidth", "height", "bannerAreaHeight", "getBannerCount", "sourceSprite", "bannerHeight", "drawBannerHalos", "transposeImageData", "drawBanners", "getDOMPixelRatio", "DOMGraphicsFactory", "bounds", "ctx", "ShieldRenderingContext", "pixels", "MaplibreGLSpriteRepository", "map", "spriteID", "image", "options", "update", "AbstractShieldRenderer", "routeParser", "DOMGraphicsFactory", "shieldSpec", "key", "shieldDef", "bannerKey", "banners", "banneredShieldDef", "callback", "id", "routeDef", "missingIconLoader", "debugOptions", "shieldPredicate", "networkPredicate", "gfxFactory", "repo", "storeNoShield", "err", "network", "ref", "name", "generateShieldCtx", "bounds", "ShieldRenderer", "URLShieldRenderer", "shieldsURL", "res", "json", "InMemorySpriteRepository", "localRepo", "roundedRectTextConstraint", "radius", "textConstraint", "fxn", "ovalShield", "fillColor", "strokeColor", "textColor", "rectWidth", "circleShield", "roundedRectShield", "escutcheonDownShield", "yOffset", "fishheadDownShield", "triangleDownShield", "trapezoidDownShield", "sideAngle", "angleInRadians", "trapezoidUpShield", "diamondShield", "pentagonUpShield", "radius1", "radius2", "homePlateDownShield", "homePlateUpShield", "hexagonVerticalShield", "hexagonHorizontalShield", "octagonVerticalShield", "pillShield", "banneredShield", "baseDef", "banners", "bannerColor", "paBeltShield", "bransonRouteShield"] }