<!DOCTYPE html>
{{ $root := . }}
<html lang="en">
<head>
  <meta charset="utf-8" />
  <meta name="description" content="A directory of content-addressed files hosted on IPFS.">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="shortcut icon" href="data:image/x-icon;base64, " />
  <title>{{ .Path }}</title>
  <link rel="stylesheet">
</head>
<body>
  <header></header>
  <main id="main">
    <header class="flex flex-wrap">
      <div>
        <strong>
          Index of
          {{ range .Breadcrumbs -}}
          /{{ if .Path }}<a href="{{ $root.GatewayURL }}{{ .Path | urlEscape }}">{{ .Name }}</a>{{ else }}{{ .Name }}{{ end }}
          {{- else }}
          {{ .Path }}
          {{ end }}
        </strong>
        {{ if .Hash }}
        <div class="ipfs-hash" translate="no">
          {{- .Hash -}}
          <div class="type-icon copy-button" title="Copy CID">
            <div class="ipfs-copy" onclick="navigator.clipboard.writeText('{{ .Hash }}')">&nbsp;</div>
          </div>
        </div>
        {{ end }}
      </div>
      {{ if .Size }}
      <div class="nowrap flex-shrink ml-auto">
        <strong title="Cumulative size of IPFS DAG (data + metadata)">&nbsp;{{ .Size }}</strong>
      </div>
      {{ end }}
    </header>
    <section>
      <div class="grid dir">
        {{ if .BackLink }}
          <div class="type-icon">
            <div class="ipfs-_blank">&nbsp;</div>
          </div>
          <div>
            <a href="{{.BackLink | urlEscape}}">..</a>
          </div>
          <div></div>
          <div></div>
        </tr>
        {{ end }}
        {{ range .Listing }}
          <div class="type-icon">
            <div class="{{iconFromExt .Name}}">&nbsp;</div>
          </div>
          <div>
            <a href="{{ .Path | urlEscape }}">{{ .Name }}</a>
          </div>
          <div class="nowrap">
            {{ if .Hash }}
            <div>
              <a class="ipfs-hash" translate="no" href={{ if $root.DNSLink }}"https://cid.ipfs.tech/#{{ .Hash | urlEscape}}" target="_blank" rel="noreferrer noopener"{{ else }}"{{ $root.GatewayURL }}/ipfs/{{ .Hash | urlEscape}}?filename={{ .Name | urlEscape }}"{{ end }}>
              {{- .ShortHash -}}
              </a>
              <div class="type-icon copy-button" title="Copy CID">
                <div class="ipfs-copy" onclick="navigator.clipboard.writeText('{{ .Hash }}')">&nbsp;</div>
              </div>
            </div>
            {{ end }}
          </div>
          <div class="nowrap" title="Cumulative size of IPFS DAG (data + metadata)">{{ .Size }}</div>
        {{ end }}
      </div>
    </section>
  </main>
</body>
</html>
