<div class='tracked-resource {{#unless name}}inactive{{/unless}}' data-gurps-resource='{{name}}'>
  {{> resource-controls}}

  <div class='condition-block tooltip-wrapper'>
    {{#if thresholds}}
      {{#if breakpoints}}
        {{#with (lookup thresholds (breakpointIndex-of thresholds max value))}}
          <div class='tooltip condition' style='background-color: {{color}} {{! concat color "80"}};'>{{{gurpslink condition}}}
            <span class="tooltiptext">
              <div style="display: grid; grid-template-columns: min-content min-content auto;">
                {{#each (controlBreakpoints ../this)}}
                  {{#unless (eq @index 0)}}
                  <div class="field condensed noedit">{{comparison}}</div>
                  <div class="field condensed noedit">{{breakpoint}}</div>
                  <div class="label">{{label}}</div>
                  {{/unless}}
                {{/each}}
              </div>
            </span>
          </div>
          <div style='display: grid; grid-template-columns: auto auto;'>
            <div style='font-size: 100%;'>{{{pdflink ../pdf}}}</div>
            <div class='max'>{{../alias}} ({{../min}}/{{../max}})</div>
          </div>
        {{/with}}
      {{else}}
        {{#with (lookup thresholds (threshold-of thresholds max value))}}
          <div class='tooltip condition' style='background-color: {{concat color "80"}};'>{{{gurpslink condition}}}
            <span class="tooltiptext">
              <div style="display: grid; grid-template-columns: min-content min-content auto;">
                {{#each (thresholdBreakpoints ../this)}}
                  <div class="field condensed noedit">{{threshold.comparison}}</div>
                  <div class="field condensed noedit">{{breakpoint}}</div>
                  <div class="label">{{threshold.condition}}</div>
                {{/each}}
              </div>
            </span>
          </div>
          <div style='display: grid; grid-template-columns: auto auto;'>
            <div style='font-size: 100%;'>{{{pdflink ../pdf}}}</div>
            <div class='max'>{{../alias}} ({{../min}}/{{../max}})</div>
          </div>
        {{/with}}
      {{/if}}
    {{else}}
      <div class='condition {{#if (gt value max)}}above{{else}}{{#if (lt value min)}}below{{/if}}{{/if}}'>
        {{#if
        (gt value max)}}Over
        {{else}}{{#if (lt value min)}}Below{{else}}Normal{{/if}}{{/if}}
      </div>
      <div class='max'>({{min}}/{{max}})</div>
    {{/if}}
  </div>
</div> <!-- end of resource -->