{{ define "repo/fragments/splitDiff" }}
{{ $name := .Id }}
{{- $lineNrStyle := "min-w-[3.5rem] flex-shrink-0 select-none text-right bg-white dark:bg-gray-800 group-target/line:bg-yellow-200/30 group-target/line:dark:bg-yellow-600/30" -}}
{{- $linkStyle := "text-gray-400 dark:text-gray-500 hover:underline group-target/line:text-black group-target/line:dark:text-white" -}}
{{- $lineNrSepStyle := "pr-2 border-r border-gray-200 dark:border-gray-700" -}}
{{- $containerStyle := "inline-flex w-full items-center target:bg-yellow-200/50 target:dark:bg-yellow-700/50 scroll-mt-48 group/line" -}}
{{- $emptyStyle := "bg-gray-200/30 dark:bg-gray-700/30" -}}
{{- $addStyle := "bg-green-100 dark:bg-green-800/30 text-green-700 dark:text-green-400" -}}
{{- $delStyle := "bg-red-100 dark:bg-red-800/30 text-red-700 dark:text-red-400 " -}}
{{- $ctxStyle := "bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400" -}}
{{- $opStyle := "w-5 flex-shrink-0 select-none text-center" -}}
<div class="grid grid-cols-2 divide-x divide-gray-200 dark:divide-gray-700">
<div class="overflow-x-auto col-span-1 font-mono leading-normal"><div class="overflow-x-auto"><div class="inline-flex flex-col min-w-full">{{- range .TextFragments -}}<span class="block bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400 select-none text-center">&middot;&middot;&middot;</span>
 {{- range .LeftLines -}}
   {{- if .IsEmpty -}}
     <span class="{{ $emptyStyle }} {{ $containerStyle }}">
       <span class="{{$lineNrStyle}} {{$lineNrSepStyle}}"><span aria-hidden="true" class="invisible">{{.LineNumber}}</span></span>
       <span class="{{ $opStyle }}"><span aria-hidden="true" class="invisible">{{ .Op.String }}</span></span>
       <span class="px-2 invisible" aria-hidden="true">{{ .Content }}</span>
     </span>
   {{- else if eq .Op.String "-" -}}
    <span class="{{ $delStyle }} {{ $containerStyle }}" id="{{$name}}-O{{.LineNumber}}">
      <span class="{{ $lineNrStyle }} {{ $lineNrSepStyle }}"><a class="{{$linkStyle}}" href="#{{$name}}-O{{.LineNumber}}">{{ .LineNumber }}</a></span>
      <span class="{{ $opStyle }}">{{ .Op.String }}</span>
      <span class="px-2 whitespace-pre">{{ .Content }}</span>
    </span>
   {{- else if eq .Op.String " " -}}
    <span class="{{ $ctxStyle }} {{ $containerStyle }}" id="{{$name}}-O{{.LineNumber}}">
      <span class="{{ $lineNrStyle }} {{ $lineNrSepStyle }}"><a class="{{$linkStyle}}" href="#{{$name}}-O{{.LineNumber}}">{{ .LineNumber }}</a></span>
      <span class="{{ $opStyle }}">{{ .Op.String }}</span>
      <span class="px-2 whitespace-pre">{{ .Content }}</span>
    </span>
   {{- end -}}
 {{- end -}}
 {{- end -}}</div></div></div>

<div class="overflow-x-auto col-span-1 font-mono leading-normal"><div class="overflow-x-auto"><div class="inline-flex flex-col min-w-full">{{- range .TextFragments -}}<span class="block bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400 select-none text-center">&middot;&middot;&middot;</span>
 {{- range .RightLines -}}
   {{- if .IsEmpty -}}
     <span class="{{ $emptyStyle }} {{ $containerStyle }}">
       <span class="{{$lineNrStyle}} {{$lineNrSepStyle}}"><span aria-hidden="true" class="invisible">{{.LineNumber}}</span></span>
       <span class="{{ $opStyle }}"><span aria-hidden="true" class="invisible">{{ .Op.String }}</span></span>
       <span class="px-2 invisible" aria-hidden="true">{{ .Content }}</span>
     </span>
   {{- else if eq .Op.String "+" -}}
     <span class="{{ $addStyle }} {{ $containerStyle }}" id="{{$name}}-N{{.LineNumber}}">
       <span class="{{$lineNrStyle}} {{$lineNrSepStyle}}"><a class="{{$linkStyle}}" href="#{{$name}}-N{{.LineNumber}}">{{ .LineNumber }}</a></span>
       <span class="{{ $opStyle }}">{{ .Op.String }}</span>
       <span class="px-2 whitespace-pre">{{ .Content }}</span>
     </span>
   {{- else if eq .Op.String " " -}}
     <span class="{{ $ctxStyle }} {{ $containerStyle }}" id="{{$name}}-N{{.LineNumber}}">
       <span class="{{$lineNrStyle}} {{$lineNrSepStyle}}"><a class="{{$linkStyle}}" href="#{{$name}}-N{{.LineNumber}}">{{ .LineNumber }}</a> </span>
       <span class="{{ $opStyle }}">{{ .Op.String }}</span>
       <span class="px-2 whitespace-pre">{{ .Content }}</span>
     </span>
   {{- end -}}
 {{- end -}}
 {{- end -}}</div></div></div>
</div>
{{ end }}
