<script lang="ts">
  import type { Deps, Position, Vertex } from './Types';
  export let c: Position | Vertex;
  export let deps: Deps;

  let d: string | null = null;
  if (deps && deps.hashes[c.change]) {
    d = deps.hashes[c.change];
  }
</script>

{#if 'start' in c}
  {#if d}
    [<a href={d}>{c.change}</a>.{c.start}:{c.end}]
  {:else}
    [{c.change}.{c.start}:{c.end}]
  {/if}
{:else if d}
  [<a href={d}>{c.change}</a>.{c.pos}]
{:else}
  [{c.change}.{c.pos}]
{/if}