{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "windsock",
  "type": "registry:component",
  "title": "Windsock",
  "description": "Helideck windsock on a tilting galvanised mast: gusseted base plate with anchors, hinge with pivot and locking bolts, swivel head with mouth hoop and internal floodlight (or two external floodlights), red obstruction lamp, and a hollow banded sock (1.2 m colour/white/colour by default, 5 bands when longer) that droops in light air and stands out from about 12 m/s. windFrom turns the head downwind; flutter animates it.",
  "dependencies": [
    "three",
    "@react-three/fiber",
    "@react-three/drei"
  ],
  "registryDependencies": [
    "https://deck-twin-library.demoareeb.workers.dev/r/core.json"
  ],
  "files": [
    {
      "path": "safety/windsock.tsx",
      "type": "registry:file",
      "target": "components/deck-twin/safety/windsock.tsx",
      "content": "// Lit windsock: tilting galvanised mast on a gusseted base plate, swivel head with mouth hoop, banded orange/white sock that stiffens with wind speed, floodlights and red obstruction lamp. ICAO Annex 14, CAP 437.\nimport { useFrame } from '@react-three/fiber'\nimport { useRef } from 'react'\nimport * as THREE from 'three'\nimport { Kit, sweepGeometry } from '../lib/kit'\nimport { paint } from '../lib/materials'\nimport { KitMesh, useKit, type GroupProps } from '../lib/mesh'\nimport { tagPlate } from '../lib/parts'\nimport { pipeOD } from '../lib/standards'\nimport { deg } from './_fg'\n\nexport interface WindsockProps {\n  /** mast height to the swivel, m */\n  height?: number\n  /** direction the wind blows FROM, degrees clockwise from north (-Z) */\n  windFrom?: number\n  /** m/s; the sock is horizontal from about 12 m/s */\n  windSpeed?: number\n  /** sock length, m */\n  length?: number\n  lit?: boolean\n  /** internal floodlight in the head (CAP 437 style) or two external floodlights on a cross-arm */\n  lighting?: 'internal' | 'external'\n  /** band colour with white */\n  colour?: 'orange' | 'red'\n  flutter?: boolean\n  tag?: string\n}\n\nexport const defaults = { height: 4, windFrom: 270, windSpeed: 8, length: 1.2, lit: true, lighting: 'internal' as 'internal' | 'external', colour: 'orange' as 'orange' | 'red', flutter: true, tag: 'WS-01' }\n\nconst ORANGE = paint('#ff5a14', { roughness: 0.75, side: THREE.DoubleSide })\nconst WHITE = paint('#f2f2ee', { roughness: 0.75, side: THREE.DoubleSide })\nconst RED = paint('#d81e1e', { roughness: 0.75, side: THREE.DoubleSide })\nconst RED_LAMP = paint('#ff2a1a', { emissive: '#ff2a1a', emissiveIntensity: 1.6, roughness: 0.2 })\nconst MAST_R = pipeOD(3) / 2\nconst MOUTH = 0.45 // swivel axis to the mouth hoop, m\n\nclass Part extends THREE.Curve<THREE.Vector3> {\n  c: THREE.Curve<THREE.Vector3>\n  a: number\n  b: number\n  constructor(c: THREE.Curve<THREE.Vector3>, a: number, b: number) {\n    super()\n    this.c = c\n    this.a = a\n    this.b = b\n  }\n  getPoint(t: number, out = new THREE.Vector3()) {\n    return this.c.getPoint(this.a + (this.b - this.a) * t, out)\n  }\n}\n\nexport function Windsock(props: WindsockProps & GroupProps) {\n  const { height, windFrom, windSpeed, length, lit, lighting, colour, flutter, tag, ...group } = { ...defaults, ...props }\n  const H = Math.max(2, height)\n  const mast = useKit((k) => buildMast(k, H, lit, lighting, tag), [H, lit, lighting, tag])\n  const sock = useKit((k) => buildSock(k, Math.max(0, windSpeed), Math.max(1, length), lit && lighting === 'internal', colour), [windSpeed, length, lit, lighting, colour])\n  const f = deg(windFrom)\n  const yaw = Math.atan2(-Math.cos(f), -Math.sin(f)) // turns +X onto the downwind direction\n  const inner = useRef<THREE.Group>(null)\n  useFrame(({ clock }) => {\n    if (!inner.current) return\n    const w = flutter ? (0.03 + 0.012 * windSpeed) * Math.sin(clock.elapsedTime * (2.6 + 0.35 * windSpeed)) : 0\n    inner.current.rotation.set(0, w, w * 0.4)\n  })\n  return (\n    <group {...group}>\n      <KitMesh data={mast} />\n      <group position={[0, H, 0]} rotation-y={yaw}>\n        <group ref={inner}>\n          <KitMesh data={sock} />\n        </group>\n      </group>\n    </group>\n  )\n}\n\nexport default Windsock\n\nfunction buildMast(k: Kit, H: number, lit: boolean, lighting: 'internal' | 'external', tag: string) {\n  // base plate, anchor bolts, gussets\n  const B = 0.4\n  k.box('galvanised', [B, 0.02, B], [0, 0.01, 0])\n  for (const sx of [-1, 1])\n    for (const sz of [-1, 1]) {\n      k.cyl('galvanised', 0.011, 0.07, [sx * 0.15, 0.045, sz * 0.15], 'y', 8)\n      k.hex('nut', 0.036, 0.018, [sx * 0.15, 0.029, sz * 0.15], 'y')\n    }\n  for (let i = 0; i < 4; i++) {\n    const a = (i * Math.PI) / 2\n    const q = new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0, 1, 0), a)\n    const sh = new THREE.Shape().moveTo(0, 0).lineTo(0.13, 0).lineTo(0, 0.25).closePath()\n    k.extrude('galvanised', sh, 0.01, new THREE.Matrix4().compose(new THREE.Vector3(MAST_R, 0.02, -0.005).applyQuaternion(q), q, new THREE.Vector3(1, 1, 1)))\n  }\n  // tilting hinge: stub, cheek plates, pivot and locking bolts\n  const yh = 0.7\n  k.cyl('galvanised', MAST_R, yh - 0.02, [0, 0.02 + (yh - 0.02) / 2, 0], 'y', 24)\n  for (const s of [-1, 1]) {\n    k.box('galvanised', [0.012, 0.42, 0.16], [s * (MAST_R + 0.006), yh, 0])\n    k.cyl('boltXylan', 0.01, 2 * MAST_R + 0.06, [0, yh + s * 0.15, 0], 'x', 8)\n    for (const sx of [-1, 1]) k.hex('nut', 0.03, 0.014, [sx * (MAST_R + 0.025), yh + s * 0.15, 0], 'x')\n  }\n  k.cyl('galvanised', MAST_R, H - yh - 0.08, [0, yh + (H - yh - 0.08) / 2, 0], 'y', 24)\n  // swivel bearing housing\n  k.cyl('castIron', MAST_R + 0.02, 0.1, [0, H - 0.05, 0], 'y', 24)\n  k.cyl('galvanised', MAST_R + 0.03, 0.012, [0, H - 0.1, 0], 'y', 24)\n  // floodlights on a cross-arm below the head, aimed up at the sock\n  const ya = H - 0.45\n  if (lighting === 'external') k.box('galvanised', [1.0, 0.05, 0.05], [0, ya, 0])\n  for (const s of lighting === 'external' ? [-1, 1] : []) {\n    const x = s * 0.48\n    k.box('galvanised', [0.03, 0.08, 0.03], [x, ya + 0.065, 0])\n    k.with(new THREE.Matrix4().makeTranslation(x, ya + 0.15, 0).multiply(new THREE.Matrix4().makeRotationZ(-s * 0.5)), () => {\n      k.rbox('castIron', [0.16, 0.12, 0.2], 0.015, [0, 0, 0])\n      k.box(lit ? 'lampLens' : 'glass', [0.13, 0.004, 0.17], [0, 0.062, 0])\n      for (let i = 0; i < 5; i++) k.box('castIron', [0.16, 0.025, 0.004], [0, -0.02, -0.08 + i * 0.04])\n    })\n  }\n  // junction box and conduit\n  k.rbox('stainless', [0.16, 0.2, 0.1], 0.01, [0, 1.3, MAST_R + 0.05])\n  k.cyl('cable', 0.012, H - 1.6, [0.04, 1.4 + (H - 1.6) / 2, MAST_R + 0.012], 'y', 8)\n  tagPlate(k, tag, [0, 1.1, MAST_R + 0.002], 'z', 0.1)\n}\n\n/** Head in the swivel frame: +X downwind. Frame, hoop, obstruction lamp and the sock. */\nfunction buildSock(k: Kit, speed: number, L: number, lamp: boolean, colour: 'orange' | 'red') {\n  const r0 = 0.3 * Math.min(1.5, Math.max(0.6, L / 2.4))\n  k.cyl('galvanised', MAST_R + 0.012, 0.12, [0, 0.06, 0], 'y', 24)\n  k.cyl('galvanised', 0.014, 0.4, [0, 0.32, 0], 'y', 10)\n  k.dome('castIron', 0.05, [0, 0.52, 0], 'y', Math.PI / 2, 1, 16)\n  k.cyl('castIron', 0.05, 0.03, [0, 0.505, 0], 'y', 16)\n  k.cyl(RED_LAMP, 0.04, 0.08, [0, 0.6, 0], 'y', 16)\n  k.dome(RED_LAMP, 0.04, [0, 0.64, 0], 'y', Math.PI / 2, 0.6, 16)\n  const yc = 0.12 + r0\n  // frame arms from the swivel to the mouth hoop, hoop in the YZ plane\n  for (const [y, z] of [[yc + r0, 0], [yc - r0, 0], [yc, r0], [yc, -r0]] as [number, number][]) k.rod('galvanised', [0.03, y > yc ? 0.3 : 0.08, 0], [MOUTH, y, z], 0.01, 8)\n  k.torus('galvanised', r0 + 0.008, 0.012, [MOUTH, yc, 0], 'x', 8, 36)\n  k.rod('galvanised', [0, 0.1, 0], [MOUTH, yc, 0], 0.015, 8)\n  // internal floodlight on the head spar, shining into the mouth\n  k.cyl('castIron', 0.045, 0.1, [MOUTH - 0.1, yc, 0], 'x', 20)\n  k.disc(lamp ? 'lampLens' : 'glass', 0.04, [MOUTH - 0.0495, yc, 0], 'x', 20)\n  k.rod('galvanised', [MOUTH - 0.1, yc - 0.045, 0], [MOUTH - 0.1, 0.1, 0], 0.01, 8)\n  // sock centreline: bends down progressively as the wind drops\n  const stiff = Math.min(1, speed / 12)\n  const droop = (1 - stiff) * 1.25 + 0.04\n  const pts: THREE.Vector3[] = []\n  const p = new THREE.Vector3(MOUTH, yc, 0)\n  const n = 10\n  for (let i = 0; i <= n; i++) {\n    pts.push(p.clone())\n    const a = droop * Math.pow(i / n, 1.4)\n    p.add(new THREE.Vector3(Math.cos(a), -Math.sin(a), 0).multiplyScalar(L / n))\n  }\n  const c = new THREE.CatmullRomCurve3(pts)\n  const bands = L <= 1.5 ? 3 : 5 // short helideck socks are colour/white/colour\n  for (let i = 0; i < bands; i++) {\n    const a = i / bands\n    const b = (i + 1) / bands\n    const rad = (t: number): [number, number] => {\n      const r = r0 * (1 - 0.5 * (a + (b - a) * t)) * (1 - (1 - stiff) * 0.25 * (a + (b - a) * t))\n      return [r, r]\n    }\n    k.add(i % 2 ? WHITE : colour === 'red' ? RED : ORANGE, sweepGeometry(new Part(c, a, b), rad, 8, 24))\n  }\n  // stitched seam rings at band joints\n  for (let i = 1; i < bands; i++) {\n    const t = i / bands\n    const q = c.getPoint(t)\n    const d = c.getTangent(t)\n    k.torus('castIron', r0 * (1 - 0.5 * t) * (1 - (1 - stiff) * 0.25 * t), 0.004, [q.x, q.y, q.z], [d.x, d.y, d.z], 4, 28)\n  }\n}\n"
    },
    {
      "path": "safety/_fg.ts",
      "type": "registry:file",
      "target": "components/deck-twin/safety/_fg.ts",
      "content": "// Shared fire & gas hardware: galvanised pole stanchion, pole and wall brackets, field cable, LEDs, lenses and canvas faces.\nimport * as THREE from 'three'\nimport { Kit, type MatKey, type V3 } from '../lib/kit'\nimport { paint, weather } from '../lib/materials'\nimport { pipeOD } from '../lib/standards'\n\nexport type Mount = 'pole' | 'wall'\n\nexport const LENS: MatKey = paint('#15202b', { metalness: 0.3, roughness: 0.06 })\nexport const WHITE: MatKey = paint('#eceae4', { metalness: 0.05, roughness: 0.55 })\nexport const LED_GREEN: MatKey = paint('#2bff6e', { emissive: '#2bff6e', emissiveIntensity: 0.9, roughness: 0.3 })\nexport const LED_RED: MatKey = paint('#ff3b30', { emissive: '#ff3b30', emissiveIntensity: 0.9, roughness: 0.3 })\n\n/** 2\" galvanised stanchion pipe */\nexport const POLE_R = pipeOD(2) / 2\nconst PLATE_T = 0.006\n\nconst deg = (d: number) => (d * Math.PI) / 180\nexport { deg }\n\n/** Free-standing stanchion: base plate with four anchor bolts and gussets, 2\" pole to `top`, welded cap. Pole on the origin. */\nexport function poleStanchion(k: Kit, top: number, mat: MatKey = 'galvanised') {\n  const B = 0.26\n  k.box(mat, [B, 0.016, B], [0, 0.008, 0])\n  for (const sx of [-1, 1])\n    for (const sz of [-1, 1]) {\n      const p: V3 = [sx * (B / 2 - 0.035), 0, sz * (B / 2 - 0.035)]\n      k.cyl('galvanised', 0.008, 0.05, [p[0], 0.035, p[2]], 'y', 8)\n      k.hex('nut', 0.03, 0.014, [p[0], 0.023, p[2]], 'y')\n      k.cyl('galvanised', 0.017, 0.003, [p[0], 0.0175, p[2]], 'y', 12)\n    }\n  k.cyl(mat, POLE_R, top - 0.016, [0, 0.016 + (top - 0.016) / 2, 0], 'y', 20)\n  k.cyl(mat, POLE_R + 0.004, 0.008, [0, top + 0.004, 0], 'y', 20)\n  const g = new THREE.Shape()\n  g.moveTo(0, 0).lineTo(0.09, 0).lineTo(0, 0.16).closePath()\n  for (let i = 0; i < 4; i++) {\n    const a = (i * Math.PI) / 2 + Math.PI / 4\n    const q = new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0, 1, 0), a)\n    const m = new THREE.Matrix4().compose(new THREE.Vector3(0, 0.016, 0).add(new THREE.Vector3(POLE_R, 0, -0.004).applyQuaternion(q)), q, new THREE.Vector3(1, 1, 1))\n    k.extrude(mat, g, 0.008, m)\n  }\n}\n\n/** Plate clamped to the front (+Z) of the pole by two U-bolts. Returns the z of the plate front face. */\nexport function polePlate(k: Kit, y: number, w: number, h: number, mat: MatKey = 'stainless') {\n  const z0 = POLE_R + 0.004\n  k.box(mat, [w, h, PLATE_T], [0, y, z0 + PLATE_T / 2])\n  for (const s of [-1, 1]) {\n    const yy = y + s * (h / 2 - 0.025)\n    k.torus('galvanised', POLE_R + 0.006, 0.005, [0, yy, 0], 'y', 6, 20, Math.PI)\n    k.rod('galvanised', [-(POLE_R + 0.006), yy, 0], [-(POLE_R + 0.006), yy, z0 + PLATE_T + 0.012], 0.005, 6)\n    k.rod('galvanised', [POLE_R + 0.006, yy, 0], [POLE_R + 0.006, yy, z0 + PLATE_T + 0.012], 0.005, 6)\n    for (const sx of [-1, 1]) k.hex('nut', 0.017, 0.008, [sx * (POLE_R + 0.006), yy, z0 + PLATE_T + 0.005], 'z')\n  }\n  // the U-bolt arcs sit behind the pole (torus half facing -Z)\n  return z0 + PLATE_T\n}\n\n/** Stainless wall plate in the XY plane (back face on z = 0), four fixings. Returns the front face z. */\nexport function wallPlate(k: Kit, y: number, w: number, h: number) {\n  k.box('stainless', [w, h, 0.008], [0, y, 0.004])\n  for (const sx of [-1, 1]) for (const sy of [-1, 1]) k.hex('nut', 0.016, 0.008, [sx * (w / 2 - 0.014), y + sy * (h / 2 - 0.014), 0.012], 'z')\n  return 0.008\n}\n\n/** z of the bracket face that mounted() builds on. */\nexport const faceZ = (mount: Mount) => (mount === 'pole' ? POLE_R + 0.004 + PLATE_T : 0.008)\n\n/** Builds the stanchion (pole) or wall plate, then runs `fn` with the origin on the bracket face at `y`, +Z out of the bracket. */\nexport function mounted(k: Kit, mount: Mount, y: number, plate: [number, number], fn: (zFace: number) => void, poleTop = y + plate[1] / 2 + 0.05) {\n  let zf: number\n  if (mount === 'pole') {\n    poleStanchion(k, poleTop)\n    zf = polePlate(k, y, plate[0], plate[1])\n  } else zf = wallPlate(k, y, plate[0], plate[1])\n  k.at([0, y, zf], undefined, () => fn(zf))\n  return zf\n}\n\n/** Armoured field cable (SWA, black sheath). */\nexport function cable(k: Kit, pts: V3[], r = 0.0065) {\n  k.spline('cable', pts, r, 6, Math.max(16, pts.length * 8))\n}\n\n/** Cable from `from` down the left side of the pole (or the wall) to the deck, cleated every ~0.5 m. */\nexport function cableToDeck(k: Kit, mount: Mount, from: V3, r = 0.0065) {\n  const x = mount === 'pole' ? -(POLE_R + r + 0.001) : from[0]\n  const z = mount === 'pole' ? 0 : r + 0.009\n  const yTop = Math.min(from[1] - 0.08, from[1])\n  cable(k, [from, [from[0], from[1] - 0.05, from[2]], [(from[0] + x) / 2, yTop - 0.05, (from[2] + z) / 2], [x, yTop - 0.14, z], [x, 0.2, z]], r)\n  k.tube('cable', [[x, 0.2, z], [x, 0.03, z], mount === 'pole' ? [x - 0.2, 0.03, z] : [x, 0.03, z + 0.2]], r, 6, 0.06)\n  for (let y = 0.4; y < yTop - 0.2; y += 0.5) {\n    if (mount === 'pole') k.torus('stainless', POLE_R + 0.002, 0.003, [0, y, 0], 'y', 4, 18)\n    else k.box('stainless', [0.03, 0.012, 0.004], [x, y, 2 * r + 0.011])\n  }\n}\n\n// ------------------------------------------------------------------ canvas faces (created lazily, browser only)\n\nconst texCache = new Map<string, THREE.MeshStandardMaterial>()\n\nexport function canvasMat(key: string, w: number, h: number, draw: (g: CanvasRenderingContext2D) => void, opts: { emissive?: number; roughness?: number } = {}) {\n  let m = texCache.get(key)\n  if (m) return m\n  const c = document.createElement('canvas')\n  c.width = w\n  c.height = h\n  draw(c.getContext('2d')!)\n  const tex = new THREE.CanvasTexture(c)\n  tex.colorSpace = THREE.SRGBColorSpace\n  tex.anisotropy = 4\n  m = new THREE.MeshStandardMaterial({ map: tex, metalness: 0.1, roughness: opts.roughness ?? 0.45 })\n  if (opts.emissive) {\n    m.emissive = new THREE.Color('#ffffff')\n    m.emissiveMap = tex\n    m.emissiveIntensity = opts.emissive\n  }\n  m.name = key\n  weather(m, 0.3)\n  texCache.set(key, m)\n  return m\n}\n\nfunction fit(g: CanvasRenderingContext2D, text: string, max: number, size: number, weight = 'bold') {\n  g.font = `${weight} ${size}px Arial, sans-serif`\n  while (g.measureText(text).width > max && size > 10) g.font = `${weight} ${(size -= 2)}px Arial, sans-serif`\n}\n\n/** ISO 7010-style sign: coloured field, white border, optional pictogram square on the left, one or two text lines. */\nexport function signMat(lines: string[], bg: string, fg = '#ffffff', icon?: (g: CanvasRenderingContext2D, s: number) => void) {\n  return canvasMat(`fgsign-${lines.join('|')}-${bg}-${fg}-${icon ? 1 : 0}`, 512, 256, (g) => {\n    g.fillStyle = bg\n    g.fillRect(0, 0, 512, 256)\n    g.strokeStyle = fg\n    g.lineWidth = 8\n    g.strokeRect(10, 10, 492, 236)\n    let x0 = 256\n    let w = 460\n    if (icon) {\n      g.save()\n      g.translate(28, 28)\n      icon(g, 200)\n      g.restore()\n      x0 = 370\n      w = 250\n    }\n    g.fillStyle = fg\n    g.textAlign = 'center'\n    g.textBaseline = 'middle'\n    const n = lines.length\n    lines.forEach((t, i) => {\n      fit(g, t, w, n > 2 ? 46 : 60)\n      g.fillText(t, x0, 128 + (i - (n - 1) / 2) * (n > 2 ? 58 : 72))\n    })\n  })\n}\n\n/** Black/yellow hazard-bordered warning plate. */\nexport function warnMat(lines: string[]) {\n  return canvasMat(`fgwarn-${lines.join('|')}`, 512, 256, (g) => {\n    g.fillStyle = '#f2c318'\n    g.fillRect(0, 0, 512, 256)\n    g.save()\n    g.beginPath()\n    g.rect(0, 0, 512, 256)\n    g.rect(22, 22, 468, 212)\n    g.clip('evenodd')\n    g.fillStyle = '#141414'\n    for (let x = -256; x < 768; x += 44) {\n      g.beginPath()\n      g.moveTo(x, 0)\n      g.lineTo(x + 22, 0)\n      g.lineTo(x - 234, 256)\n      g.lineTo(x - 256, 256)\n      g.closePath()\n      g.fill()\n    }\n    g.restore()\n    g.fillStyle = '#141414'\n    g.textAlign = 'center'\n    g.textBaseline = 'middle'\n    lines.forEach((t, i) => {\n      fit(g, t, 440, i === 0 ? 70 : 44)\n      g.fillText(t, 256, lines.length === 1 ? 128 : i === 0 ? 100 : 176)\n    })\n  })\n}\n\n/** White pictogram helpers drawn into an s × s square. */\nexport const ICON = {\n  flame(g: CanvasRenderingContext2D, s: number) {\n    g.fillStyle = '#ffffff'\n    g.beginPath()\n    g.moveTo(s * 0.5, s * 0.08)\n    g.bezierCurveTo(s * 0.85, s * 0.4, s * 0.82, s * 0.7, s * 0.5, s * 0.9)\n    g.bezierCurveTo(s * 0.18, s * 0.7, s * 0.2, s * 0.45, s * 0.38, s * 0.3)\n    g.bezierCurveTo(s * 0.4, s * 0.45, s * 0.48, s * 0.5, s * 0.52, s * 0.42)\n    g.closePath()\n    g.fill()\n  },\n  shower(g: CanvasRenderingContext2D, s: number) {\n    g.fillStyle = '#ffffff'\n    g.strokeStyle = '#ffffff'\n    g.lineWidth = s * 0.04\n    g.beginPath()\n    g.arc(s * 0.62, s * 0.18, s * 0.12, Math.PI, 0)\n    g.fill()\n    for (let i = 0; i < 5; i++) {\n      g.beginPath()\n      g.moveTo(s * (0.52 + i * 0.05), s * 0.24)\n      g.lineTo(s * (0.48 + i * 0.05), s * 0.42)\n      g.stroke()\n    }\n    g.beginPath()\n    g.arc(s * 0.4, s * 0.38, s * 0.07, 0, Math.PI * 2)\n    g.fill()\n    g.fillRect(s * 0.34, s * 0.47, s * 0.12, s * 0.28)\n    g.fillRect(s * 0.34, s * 0.75, s * 0.05, s * 0.18)\n    g.fillRect(s * 0.41, s * 0.75, s * 0.05, s * 0.18)\n  },\n  extinguisher(g: CanvasRenderingContext2D, s: number) {\n    g.fillStyle = '#ffffff'\n    g.fillRect(s * 0.36, s * 0.3, s * 0.28, s * 0.6)\n    g.beginPath()\n    g.arc(s * 0.5, s * 0.3, s * 0.14, Math.PI, 0)\n    g.fill()\n    g.fillRect(s * 0.45, s * 0.1, s * 0.1, s * 0.08)\n    g.lineWidth = s * 0.04\n    g.strokeStyle = '#ffffff'\n    g.beginPath()\n    g.moveTo(s * 0.55, s * 0.14)\n    g.quadraticCurveTo(s * 0.85, s * 0.18, s * 0.8, s * 0.5)\n    g.stroke()\n  },\n  hose(g: CanvasRenderingContext2D, s: number) {\n    g.strokeStyle = '#ffffff'\n    g.lineWidth = s * 0.06\n    for (const r of [0.14, 0.24, 0.34]) {\n      g.beginPath()\n      g.arc(s * 0.45, s * 0.5, s * r, 0, Math.PI * 2)\n      g.stroke()\n    }\n    g.beginPath()\n    g.moveTo(s * 0.79, s * 0.5)\n    g.lineTo(s * 0.92, s * 0.85)\n    g.stroke()\n  },\n}\n\n/** Ex d stopping (blanking) plug in an unused cable entry, axis out of the entry. */\nexport function stopPlug(k: Kit, pos: V3, axis: 'x' | '-x' | 'y' | '-y' | 'z' | '-z', d = 0.026) {\n  k.hex('castIron', d, 0.006, pos, axis)\n  const v = { x: [1, 0, 0], '-x': [-1, 0, 0], y: [0, 1, 0], '-y': [0, -1, 0], z: [0, 0, 1], '-z': [0, 0, -1] }[axis]\n  k.cyl('castIron', d * 0.36, 0.006, [pos[0] + v[0] * 0.006, pos[1] + v[1] * 0.006, pos[2] + v[2] * 0.006], axis, 12)\n}\n\n/**\n * Flameproof (Ex d) cast junction box: body with a wide flamepath flange, bolted lid, earth stud and bottom entries.\n * Back face at `pos`, lid facing +Z. `used` entries get brass glands, the rest stopping plugs. Returns the entry centres (bottom face).\n */\nexport function exdBox(k: Kit, pos: V3, size: V3 = [0.18, 0.18, 0.12], entries = 2, used = 1, mat: MatKey = 'castIron'): V3[] {\n  const [w, h, d] = size\n  const [x, y, z] = pos\n  k.rbox(mat, [w, h, d * 0.62], 0.01, [x, y, z + d * 0.31])\n  k.rbox(mat, [w + 0.024, h + 0.024, d * 0.12], 0.006, [x, y, z + d * 0.68])\n  k.rbox(mat, [w, h, d * 0.26], 0.012, [x, y, z + d * 0.87])\n  // cover bolts round the flamepath flange\n  const nx = Math.max(2, Math.round(w / 0.05))\n  const ny = Math.max(2, Math.round(h / 0.05))\n  for (let i = 0; i <= nx; i++)\n    for (const s of [-1, 1]) k.cyl('stainless', 0.006, 0.006, [x - w / 2 + (w * i) / nx, y + s * (h / 2 + 0.006), z + d * 0.74 + 0.003], 'z', 8)\n  for (let i = 1; i < ny; i++)\n    for (const s of [-1, 1]) k.cyl('stainless', 0.006, 0.006, [x + s * (w / 2 + 0.006), y - h / 2 + (h * i) / ny, z + d * 0.74 + 0.003], 'z', 8)\n  // mounting lugs, earth stud\n  for (const s of [-1, 1]) {\n    k.box(mat, [0.03, 0.03, 0.012], [x + s * (w / 2 + 0.012), y + s * (h / 2 - 0.02), z + 0.006])\n    k.hex('nut', 0.014, 0.007, [x + s * (w / 2 + 0.014), y + s * (h / 2 - 0.02), z + 0.0155], 'z')\n  }\n  k.cyl('brass', 0.004, 0.025, [x + w / 2 + 0.012, y - h * 0.25, z + d * 0.35], 'x', 8)\n  k.hex('brass', 0.012, 0.006, [x + w / 2 + 0.018, y - h * 0.25, z + d * 0.35], 'x')\n  const out: V3[] = []\n  for (let i = 0; i < entries; i++) {\n    const ex = x + (entries === 1 ? 0 : -w * 0.3 + (w * 0.6 * i) / (entries - 1))\n    const p: V3 = [ex, y - h / 2, z + d * 0.31]\n    k.cyl(mat, 0.016, 0.008, [p[0], p[1] - 0.004, p[2]], 'y', 14)\n    if (i < used) {\n      k.hex('brass', 0.03, 0.014, [p[0], p[1] - 0.015, p[2]], 'y')\n      k.cyl('brass', 0.012, 0.02, [p[0], p[1] - 0.032, p[2]], 'y', 12)\n      k.cyl('rubberBlack', 0.0085, 0.012, [p[0], p[1] - 0.046, p[2]], 'y', 10)\n    } else stopPlug(k, [p[0], p[1] - 0.011, p[2]], '-y')\n    out.push([p[0], p[1] - 0.05, p[2]])\n  }\n  return out\n}\n"
    }
  ],
  "categories": [
    "safety"
  ],
  "meta": {
    "export": "Windsock",
    "anchor": "base",
    "standards": [
      "ICAO Annex 14 Vol II",
      "CAP 437",
      "FAA AC 150/5345-27"
    ]
  }
}