<div class="media-search-item-summary">
  <!-- показываем саммари от Гугл -->
  <div ng-if="item._documentMeta && item._documentMeta._descriptionHtml">
    <div ng-bind-html="item._documentMeta._descriptionHtml"></div>
  </div>

  <!-- если саммари от Гугл нет - показызываем саммари от MediaPy-->
  <div ng-if="!(item._documentMeta && item._documentMeta._descriptionHtml)">
    <div ng-bind-html="item._mediaPyDocumentMeta._descriptionHtml"></div>
  </div>

  <div ng-if="item._isOpened">
    <br />
    <br />

    <!-- если саммари от Гугл есть - показызываем саммари от MediaPy-->
    <div ng-if="item._documentMeta && item._documentMeta._descriptionHtml">
      <div ng-bind-html="item._mediaPyDocumentMeta._descriptionHtml"></div>

      <br />
      <br />
    </div>

    <!-- если у нас не были загружены персоны от GPT - показываем от обычного MediaPy -->
    <div
      ng-if="item._mediaPyEntitiesMeta
             && item._mediaPyEntitiesMeta._persons
             && item._mediaPyEntitiesMeta._persons.length"
      class="items-container"
    >
      <div class="item-label">
        <label>{{ 'MEDIA_SEARCH_RELATED_PERSONS' | translate }}:</label>
      </div>
      <div class="list-items-container">
        <div
          ng-repeat="mentionedPerson in item._mediaPyEntitiesMeta._persons | limitTo: item._mediaPyEntitiesMeta._shownPersonsCount"
          style="display: inline"
        >
          <div class="list-item">
            <a
              class="no-link-link"
              ng-click="vm.openNamecheckMediaSearchTabs(mentionedPerson.name)"
              >{{mentionedPerson.name.length ? mentionedPerson.name[0] : ''
              }}</a
            >
          </div>
          <span ng-show="!$last">,</span>
        </div>
        <span
          ng-hide="!item._mediaPyEntitiesMeta._persons.length || item._mediaPyEntitiesMeta._shownPersonsCount >= item._mediaPyEntitiesMeta._persons.length"
          ng-click="item._mediaPyEntitiesMeta.setShownPersonsCount($event, item._mediaPyEntitiesMeta._persons.length)"
          class="show-more"
        >
          ({{ 'MEDIA_SEARCH_SHOW_MORE' | translate}}..)
        </span>
      </div>
    </div>

    <div
      ng-if="item._mediaPyRiskEntitiesMeta && item._mediaPyRiskEntitiesMeta._persons"
      class="items-container"
    >
      <div class="item-label">
        <label>{{ 'MEDIA_SEARCH_RISK_PERSONS' | translate }}:</label>
      </div>
      <div class="list-items-container">
        <div
          ng-repeat="riskPerson in item._mediaPyRiskEntitiesMeta._persons"
          style="display: inline"
        >
          <div class="list-item">
            <a
              class="no-link-link"
              ng-click="vm.openNamecheckMediaSearchTabs(riskPerson.name)"
              >{{riskPerson.name.length ? riskPerson.name[0] : ''}}</a
            >
            <a
              class="no-link-link"
              ng-if="riskPerson.db_id"
              ng-click="vm.openListItemModalInfo($event, riskPerson.db_id)"
              title="{{ 'ID: ' + riskPerson.db_id.join(', ') }}"
            >
              <i class="material-icons" style="font-size: 20px">info_outline</i>
            </a>
          </div>
          <span ng-show="!$last">,</span>
        </div>
      </div>
    </div>

    <!-- если у нас не были загружены компании от GPT - показываем от обычного MediaPy -->
    <div
      ng-if="item._mediaPyEntitiesMeta
             && item._mediaPyEntitiesMeta._organizations
             && item._mediaPyEntitiesMeta._organizations.length"
      class="items-container"
    >
      <div class="item-label">
        <label>{{ 'MEDIA_SEARCH_RELATED_ORGS' | translate }}:</label>
      </div>
      <div class="list-items-container">
        <div
          ng-repeat="mentionedOrg in item._mediaPyEntitiesMeta._organizations | limitTo: item._mediaPyEntitiesMeta._shownOrganizationsCount"
          style="display: inline"
        >
          <div class="list-item">
            <a
              class="no-link-link"
              ng-click="vm.openNamecheckMediaSearchTabs(mentionedOrg.name)"
              >{{mentionedOrg.name.length ? mentionedOrg.name[0] : ''}}</a
            >
          </div>
          <span ng-show="!$last">,</span>
        </div>
        <span
          ng-hide="!item._mediaPyEntitiesMeta._organizations.length || item._mediaPyEntitiesMeta._shownOrganizationsCount >= item._mediaPyEntitiesMeta._organizations.length"
          ng-click="item._mediaPyEntitiesMeta.setShownOrganizationsCount($event, item._mediaPyEntitiesMeta._organizations.length)"
          class="show-more"
        >
          ({{ 'MEDIA_SEARCH_SHOW_MORE' | translate}}..)
        </span>
      </div>
    </div>

    <div
      ng-if="item._mediaPyRiskEntitiesMeta && item._mediaPyRiskEntitiesMeta._organizations"
      class="items-container"
    >
      <div class="item-label">
        <label>{{ 'MEDIA_SEARCH_RISK_ORGS' | translate }}:</label>
      </div>
      <div class="list-items-container">
        <div
          ng-repeat="riskOrg in item._mediaPyRiskEntitiesMeta._organizations"
          style="display: inline"
        >
          <div class="list-item">
            <a
              class="no-link-link"
              ng-click="vm.openNamecheckMediaSearchTabs(riskOrg.name)"
              >{{riskOrg.name.length ? riskOrg.name[0] : ''}}</a
            >
            <a
              class="no-link-link"
              ng-if="riskOrg.db_id"
              ng-click="vm.openListItemModalInfo($event, riskOrg.db_id)"
              title="{{ 'ID: ' + riskOrg.db_id.join(', ') }}"
            >
              <i class="material-icons" style="font-size: 20px">info_outline</i>
            </a>
          </div>
          <span ng-show="!$last">,</span>
        </div>
      </div>
    </div>

    <div
      ng-if="item._mediaPyEntitiesMeta
             && item._mediaPyEntitiesMeta._locations
             && item._mediaPyEntitiesMeta._locations.length"
      class="items-container"
    >
      <div class="item-label">
        <label>{{ 'MEDIA_SEARCH_LOCATIONS' | translate }}:</label>
      </div>
      <div class="list-items-container">
        <div
          ng-repeat="mentionedLocation in item._mediaPyEntitiesMeta._locations | limitTo: item._mediaPyEntitiesMeta._shownLocationsCount"
          style="display: inline"
        >
          <div class="list-item">
            <span class="mentioned-item"
              >{{mentionedLocation.name.length ? mentionedLocation.name[0] :
              ''}}</span
            >
          </div>
          <!-- <span ng-show="!$last">,</span> -->
        </div>
        <span
          ng-hide="!item._mediaPyEntitiesMeta._locations.length || item._mediaPyEntitiesMeta._shownLocationsCount >= item._mediaPyEntitiesMeta._locations.length"
          ng-click="item._mediaPyEntitiesMeta.setShownLocationsCount($event, item._mediaPyEntitiesMeta._locations.length)"
          class="show-more"
        >
          ({{ 'MEDIA_SEARCH_SHOW_MORE' | translate}}..)
        </span>
      </div>
    </div>

    <div
      ng-if="item._mediaPyKeywordsMeta && item._mediaPyKeywordsMeta._keywords && item._mediaPyKeywordsMeta._keywords.length"
      class="items-container"
    >
      <div class="item-label">
        <label>{{ 'MEDIA_SEARCH_NGRAMS' | translate }}:</label>
      </div>

      <div class="list-items-container">
        <div
          ng-repeat="keyword in item._mediaPyKeywordsMeta._keywords | limitTo: item._mediaPyKeywordsMeta._shownKeywordsCount"
          style="display: inline"
        >
          <div class="list-item">
            <span class="keyword">{{keyword}}</span>
          </div>
        </div>
        <span
          ng-hide="!item._mediaPyKeywordsMeta._keywords.length || item._mediaPyKeywordsMeta._shownKeywordsCount >= item._mediaPyKeywordsMeta._keywords.length"
          ng-click="item._mediaPyKeywordsMeta.setShownKeywordsCount($event, item._mediaPyKeywordsMeta._keywords.length)"
          class="show-more"
        >
          ({{ 'MEDIA_SEARCH_SHOW_MORE' | translate}}..)
        </span>
      </div>
    </div>
  </div>
</div>
