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

  <div ng-if="!(item._documentMeta && item._documentMeta._descriptionHtml)">
    <div ng-bind-html="item._mediaPyDocumentMeta._descriptionHtml"></div>
  </div>

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

    <div ng-show="item._mediaPyGptDocumentAnalysisMeta">
      <label>{{ 'MEDIA_SEARCH_SUMMARY' | translate }}:&nbsp;</label>
      <span>{{item._mediaPyGptDocumentAnalysisMeta._summary}}</span>
    </div>

    <div
      ng-show="!item._mediaPyGptDocumentAnalysisMeta && item._mediaPyDocumentMeta && item._mediaPyDocumentMeta._descriptionHtml"
      style="display: grid; grid-template-columns: auto 1fr; align-items: start"
    >
      <label>{{ 'MEDIA_SEARCH_SUMMARY' | translate }}:&nbsp;</label>
      <div
        ng-bind-html="item._mediaPyDocumentMeta._descriptionHtml"
        style="margin-left: -70px; text-indent: 80px; flex: 1"
      ></div>
      <!-- <span>{{item._mediaPyDocumentMeta._descriptionHtml}}</span> -->
    </div>

    <div ng-if="item._mediaPyGptEntitySummaryMeta">
      <label>{{ 'MEDIA_SEARCH_PERSON_DESCRIPTION' | translate }}:&nbsp;</label>
      <span>{{item._mediaPyGptEntitySummaryMeta._summary}}</span>
    </div>

    <br />
    <br />

    <div ng-if="item._mediaPyGptDocumentAnalysisMeta">
      <label>{{ 'MEDIA_SEARCH_TOPIC' | translate }}:&nbsp;</label>
      <span>{{item._mediaPyGptDocumentAnalysisMeta._topic}}</span>
    </div>

    <div ng-if="item._mediaPyGptDocumentAnalysisMeta">
      <label>{{ 'MEDIA_SEARCH_PUBLICATION_TYPE' | translate }}:&nbsp;</label>
      <span>{{item._mediaPyGptDocumentAnalysisMeta._publicationType}}</span>
    </div>

    <div ng-if="item._mediaPyGptChainRiskAssessmentMeta">
      <label>{{ 'MEDIA_SEARCH_RISK_EVALUATION' | translate }}:&nbsp;</label>
      <span>{{item._mediaPyGptChainRiskAssessmentMeta._score}}&nbsp;</span>
      <span>({{item._mediaPyGptChainRiskAssessmentMeta._explanation}})</span>
    </div>

    <div ng-if="item._mediaPyGptDocumentAnalysisMeta">
      <label>{{ 'MEDIA_SEARCH_SENTIMENT' | translate }}:&nbsp;</label
      ><span>{{item._mediaPyGptDocumentAnalysisMeta._sentiment}}</span>
    </div>

    <!-- <div ng-if="item._mediaPyGptDocumentAnalysisMeta">
      <label>{{ 'MEDIA_SEARCH_TRUSTWORTHINESS_SCORE' | translate }}:&nbsp;</label
      ><span
        >{{item._mediaPyGptDocumentAnalysisMeta._trustworthinessScore}}</span
      >
    </div> -->

    <!-- если у нас загружены ключевые слова от GPT - показываем их -->
    <div
      ng-if="item._mediaPyGptDocumentAnalysisMeta
                && item._mediaPyGptDocumentAnalysisMeta._keywords
                && item._mediaPyGptDocumentAnalysisMeta._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._mediaPyGptDocumentAnalysisMeta._keywords"
          style="display: inline"
        >
          <div class="list-item">
            <span class="keyword">{{keyword}}</span>
          </div>
          <!-- <span ng-show="!$last">,</span> -->
        </div>
      </div>
    </div>

    <div
      ng-if="!(item._mediaPyGptDocumentAnalysisMeta
                && item._mediaPyGptDocumentAnalysisMeta._keywords
                && item._mediaPyGptDocumentAnalysisMeta._keywords.length)
                && 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>

    <br />
    <br />

    <!-- если у нас загружены персоны от GPT - показываем их -->
    <div
      ng-if="item._mediaPyGptEntitiesMeta
                && item._mediaPyGptEntitiesMeta._persons
                && item._mediaPyGptEntitiesMeta._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="relatedPerson in item._mediaPyGptEntitiesMeta._persons | limitTo: item._mediaPyGptEntitiesMeta._shownPersonsCount"
          style="display: inline"
        >
          <div class="list-item">
            <a
              class="no-link-link"
              ng-click="vm.openNamecheckMediaSearchTabs(relatedPerson)"
              >{{relatedPerson}}</a
            >
          </div>
          <span ng-show="!$last">,</span>
        </div>
        <span
          ng-hide="!item._mediaPyGptEntitiesMeta._persons.length || item._mediaPyGptEntitiesMeta._shownPersonsCount >= item._mediaPyGptEntitiesMeta._persons.length"
          ng-click="item._mediaPyGptEntitiesMeta.setShownPersonsCount($event, item._mediaPyGptEntitiesMeta._persons.length)"
          class="show-more"
        >
          ({{ 'MEDIA_SEARCH_SHOW_MORE' | translate}}..)
        </span>
      </div>
    </div>

    <!-- если у нас не были загружены персоны от GPT - показываем от обычного MediaPy -->
    <div
      ng-if="!(item._mediaPyGptEntitiesMeta
                && item._mediaPyGptEntitiesMeta._persons
                && item._mediaPyGptEntitiesMeta._persons.length)
                && 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 - показываем их -->
    <div
      ng-if="item._mediaPyGptEntitiesMeta
                && item._mediaPyGptEntitiesMeta._organizations
                && item._mediaPyGptEntitiesMeta._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="relatedOrg in item._mediaPyGptEntitiesMeta._organizations | limitTo: item._mediaPyGptEntitiesMeta._shownOrganizationsCount"
          style="display: inline"
        >
          <div class="list-item">
            <a
              class="no-link-link"
              ng-click="vm.openNamecheckMediaSearchTabs(relatedOrg)"
              >{{relatedOrg}}</a
            >
          </div>
          <span ng-show="!$last">,</span>
        </div>
        <span
          ng-hide="!item._mediaPyGptEntitiesMeta._organizations.length || item._mediaPyGptEntitiesMeta._shownOrganizationsCount >= item._mediaPyGptEntitiesMeta._organizations.length"
          ng-click="item._mediaPyGptEntitiesMeta.setShownOrganizationsCount($event, item._mediaPyGptEntitiesMeta._organizations.length)"
          class="show-more"
        >
          ({{ 'MEDIA_SEARCH_SHOW_MORE' | translate}}..)
        </span>
      </div>
    </div>

    <!-- если у нас не были загружены компании от GPT - показываем от обычного MediaPy -->
    <div
      ng-if="!(item._mediaPyGptEntitiesMeta
                && item._mediaPyGptEntitiesMeta._organizations
                && item._mediaPyGptEntitiesMeta._organizations.length)
                && 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>
</div>
