{%- macro show_value(value) -%}
  {{ value | default('<i>No information provided</i>', true) | safe }}
{%- endmacro -%}

{%- macro urlize_with_default(value) -%}
  {%- if value -%}
    {{ value | urlize | safe }}
  {%- else -%}
    <i>No information provided</i>
  {%- endif -%}
{%- endmacro -%}

<div><b>Contact emails</b></div>
{%- if not feature.browsers.chrome.owners -%}
  <i>No information provided</i>
{%- else -%}
  {%- for owner in feature.browsers.chrome.owners -%}
    <a href="mailto:{{owner}}">{{owner}}</a>{%- if not loop.last -%}, {% endif %}
  {%- endfor -%}
{%- endif -%}

{%- if feature.explainer_links or (feature.feature_type_int != 1 and feature.feature_type_int != 2) -%}
<br>
<br>
<div><b>Explainer</b></div>
  {%- if not feature.explainer_links -%}
    <i>No information provided</i>
  {%- else -%}
    {%- for link in feature.explainer_links -%}
      {% if loop.index0 %}<br>{% endif %}<a href="{{link}}">{{link}}</a>
    {%- endfor -%}
  {%- endif -%}
{%- endif -%}
<br>
<br>

<div><b>Specification</b></div>
{{ urlize_with_default(feature.standards.spec) }}

{% if feature.resources and feature.resources.docs -%}
<br>
<br>
<div><b>Design docs</b></div>
  {%- if not feature.explainer_links -%}
    <i>No information provided</i>
  {%- endif -%}
  {%- for link in feature.resources.docs -%}
    <br><a href="{{link}}">{{link}}</a>
  {%- endfor -%}
{%- endif -%}
<br>
<br>
<div><b>Summary</b></div>
{{ urlize_with_default(feature.summary) }}

<br>
<br>
<div><b>Blink component</b></div>
{% for c in feature.browsers.chrome.blink_components -%}
  <a href="https://issues.chromium.org/issues?q=customfield1222907:%22{{ c | urlencode | default('', true) }}%22" target="_blank" rel="noopener">{{ show_value(c) }}</a>
{%- endfor -%}

<br>
<br>
<div><b>Web Feature ID</b></div>
{% if feature.is_official_web_feature -%}
  <a href="https://webstatus.dev/features/{{ feature.web_feature | default('', true) }}">{{ show_value(feature.web_feature) }}</a>
{%- elif feature.web_feature -%}
  {{ show_value(feature.web_feature) }}
{%- else -%}
  <i>No information provided</i>
{%- endif %}

{% if intent_type in ['prototype', 'deprecate', 'ship'] -%}
<br>
<br>
<div><b>Motivation</b></div>
  {{ urlize_with_default(feature.motivation) }}
<br>
<br>
<div><b>Initial public proposal</b></div>
  {{ urlize_with_default(feature.initial_public_proposal_url) }}
{%- endif -%}

{% if feature.tags -%}
<br>
<br>
<div><b>Search tags</b></div>
  {%- for tag in feature.tags -%}
    <a href="/features#tags:{{tag}}">{{tag}}</a>{%- if not loop.last -%}, {% endif %}
  {%- endfor -%}
{%- endif -%}

{%- if intent_type in ['experiment', 'extend_experiment', 'ship'] -%}
<br>
<br>
<div><b>TAG review</b></div>
{{ urlize_with_default(feature.tag_review) }}

{% if feature.tag_review_status -%}
<br>
<br>
<div><b>TAG review status</b></div>
  {{ show_value(feature.tag_review_status) }}
{%- endif -%}
{%- endif -%}

{% for stage in stage_info.ot_stages -%}
  {%- if stage.ot_display_name -%}
<br>
<br>
<div><b>Origin Trial Name</b></div>
    {{stage.ot_display_name}}
  {%- endif -%}
<br>
<br>
<div><b>Goals for experimentation</b></div>
    {{stage.experiment_goals}}
  {%- if stage.ot_chromium_trial_name -%}
<br>
<br>
<div><b>Chromium Trial Name</b></div>
    {{stage.ot_chromium_trial_name}}
  {%- endif -%}
  {%- if stage.origin_trial_feedback_url -%}
<br>
<br>
<div><b>Link to origin trial feedback summary</b></div>
    {{stage.origin_trial_feedback_url}}
  {%- endif -%}
  {%- if stage.ot_documentation_url -%}
<br>
<br>
<div><b>Origin Trial documentation link</b></div>
    {{stage.ot_documentation_url}}
  {%- endif -%}
  {%- if stage.ot_webfeature_use_counter -%}
<br>
<br>
<div><b>WebFeature UseCounter name</b></div>
    {{stage.ot_webfeature_use_counter}}
  {%- endif -%}
{%- endfor -%}
{%- if intent_type in ['developer_testing', 'experiment', 'extend_experiment', 'ship', 'psa'] %}
<!-- Begin risks section --><br>
<br>
<div><b>Risks</b></div>
<div style="margin-left: 4em;">
<br>
<br>
<div><b>Interoperability and Compatibility</b></div>
  {{ urlize_with_default(feature.interop_compat_risks) }}
<br>
<br>
<i>Gecko</i>: {{ show_value(feature.browsers.ff.view.text) }}
  {%- if feature.browsers.ff.view.url -%}
    &nbsp;(<a href="{{ feature.browsers.ff.view.url | default('#', true) }}">{{ show_value(feature.browsers.ff.view.url) }}</a>)
  {%- endif -%}
  {%- if feature.browsers.ff.view.notes -%}
    &nbsp;{{ urlize_with_default(feature.browsers.ff.view.notes) }}
  {%- endif -%}
<br>
<br>
<i>WebKit</i>: {{ show_value(feature.browsers.safari.view.text) }}
  {%- if feature.browsers.safari.view.url -%}
    &nbsp;(<a href="{{ feature.browsers.safari.view.url | default('#', true) }}">{{ show_value(feature.browsers.safari.view.url) }}</a>)
  {%- endif -%}
  {%- if feature.browsers.safari.view.notes -%}
    &nbsp;{{ urlize_with_default(feature.browsers.safari.view.notes) }}
  {%- endif -%}

<br>
<br>
<i>Web developers</i>: {{ show_value(feature.browsers.webdev.view.text) }}
  {%- if feature.browsers.webdev.view.url -%}
    &nbsp;(<a href="{{ feature.browsers.webdev.view.url | default('#', true) }}">{{ show_value(feature.browsers.webdev.view.url) }}</a>)
  {%- endif -%}
  {%- if feature.browsers.webdev.view.notes -%}
    &nbsp;{{ urlize_with_default(feature.browsers.webdev.view.notes) }}
  {%- endif -%}

<br>
<br>
<i>Other signals</i>:
  {%- if feature.browsers.other.view.notes -%}
    &nbsp;{{ urlize_with_default(feature.browsers.other.view.notes) }}
  {%- endif -%}

  {%- if feature.ergonomics_risks -%}
<br>
<br>
<div><b>Ergonomics</b></div>
    {{ urlize_with_default(feature.ergonomics_risks) }}
  {%- endif -%}

  {%- if feature.activation_risks -%}
<br>
<br>
<div><b>Activation</b></div>
    {{ urlize_with_default(feature.activation_risks) }}
  {%- endif -%}

  {%- if feature.security_risks -%}
<br>
<br>
<div><b>Security</b></div>
    {{ urlize_with_default(feature.security_risks) }}
  {%- endif -%}

<br>
<br>
<div><b>WebView application risks</b></div>
  <p style="font-style: italic">
    Does this intent deprecate or change behavior of existing APIs,
    such that it has potentially high risk for Android WebView-based
    applications?
  </p>
  {{ urlize_with_default(feature.webview_risks) }}

</div> <!-- end risks -->
{%- endif -%}
{%- if intent_type in ['experiment', 'extend_experiment'] -%}
{%- if feature.experiment_timeline -%}
<br>
<br>
<div><b>Experimental timeline</b></div>
    {{ urlize_with_default(feature.experiment_timeline) }}
  {%- endif -%}

  {%- if intent_type in ['experiment', 'extend_experiment'] -%}
    {%- for stage in stage_info.extension_stages -%}
      {%- if stage.experiment_extension_reason -%}
<br>
<br>
<div><b>Reason this experiment is being extended</b></div>
        {{ urlize_with_default(stage.experiment_extension_reason) }}
      {%- endif -%}
    {%- endfor -%}
  {%- endif -%}

<br>
<br>
<div><b>Ongoing technical constraints</b></div>
  {{ urlize_with_default(feature.ongoing_constraints) }}

{%- endif -%}
{%- if intent_type in ['developer_testing', 'experiment', 'extend_experiment', 'ship', 'psa', 'deprecate'] -%}
<br>
<br>
<div><b>Debuggability</b></div>
{{ urlize_with_default(feature.debuggability) }}
{% endif -%}
{% if intent_type in ['developer_testing', 'experiment', 'extend_experiment', 'psa', 'ship'] -%}
<br>
<br>
<div><b>Will this feature be supported on all six Blink platforms
      (Windows, Mac, Linux, ChromeOS, Android, and Android WebView)?</b></div>
  {%- if feature.all_platforms -%}Yes{%- else -%}No{%- endif -%}
  {%- if feature.all_platforms_descr %}
    <br>
    {{ urlize_with_default(feature.all_platforms_descr) }}
  {% endif -%}

<br>
<br>
<div><b>Is this feature fully tested by <a href="https://chromium.googlesource.com/chromium/src/+/main/docs/testing/web_platform_tests.md">web-platform-tests</a>?</b></div>
{% if feature.wpt -%}Yes{%- else -%}No{%- endif %}
<br>
{% if feature.wpt_descr -%}
  {{ urlize_with_default(feature.wpt_descr) }}
{%- endif -%}
{%- endif -%}

{% if feature.devtrial_instructions -%}
<br>
<br>
<div><b>DevTrial instructions</b></div>
  <a href="{{ feature.devtrial_instructions | default('#', true) }}"
      >{{ show_value(feature.devtrial_instructions) }}</a>
{%- endif -%}

{%- if intent_type in ['developer_testing', 'experiment', 'extend_experiment', 'ship'] -%}
<br>
<br>
<div><b>Flag name on about://flags</b></div>
{{ show_value(feature.flag_name) }}

<br>
<br>
<div><b>Finch feature name</b></div>
{{ show_value(feature.finch_name) }}

{% if feature.non_finch_justification -%}
<br>
<br>
<div><b>Non-finch justification</b></div>
  {{ urlize_with_default(feature.non_finch_justification) }}
{%- elif not feature.finch_name -%}
<br>
<br>
<div><b>Non-finch justification</b></div>
  <i>No information provided</i>
{%- endif -%}
{%- endif -%}

{%- if intent_type == 'ship' -%}
<br>
<br>
<div><b>Rollout plan</b></div>
  {{ show_value(feature.rollout_plan_displayname) }}
{%- endif -%}

<br>
<br>
{%- if feature.feature_type_int != 2 %}
<div><b>Requires code in //chrome?</b></div>
{{feature.requires_embedder_support}}
{%- endif -%}

{%- if feature.browsers.chrome.bug -%}
<br>
<br>
<div><b>Tracking bug</b></div>
  <a href="{{ feature.browsers.chrome.bug | default('#', true) }}">{{ show_value(feature.browsers.chrome.bug) }}</a>
{%- endif -%}

{%- if feature.launch_bug_url -%}
<br>
<br>
<div><b>Launch bug</b></div>
  <a href="{{ feature.launch_bug_url | default('#', true) }}">{{ show_value(feature.launch_bug_url) }}</a>
{%- endif -%}

{%- if feature.measurement -%}
<br>
<br>
<div><b>Measurement</b></div>
  {{ urlize_with_default(feature.measurement) }}
{%- endif -%}

{%- if feature.availability_expectation -%}
<br>
<br>
<div><b>Availability expectation</b></div>
  {{ urlize_with_default(feature.availability_expectation) }}
{%- endif -%}

{%- if feature.adoption_expectation -%}
<br>
<br>
<div><b>Adoption expectation</b></div>
  {{ urlize_with_default(feature.adoption_expectation) }}
{%- endif -%}

{%- if feature.adoption_plan -%}
<br>
<br>
<div><b>Adoption plan</b></div>
  {{ urlize_with_default(feature.adoption_plan) }}
{%- endif -%}

{%- if feature.non_oss_deps -%}
<br>
<br>
<div><b>Non-OSS dependencies</b></div>
  <p style="font-style: italic">
    Does the feature depend on any code or APIs outside the Chromium
    open source repository and its open-source dependencies to
    function?
  </p>
  {{ urlize_with_default(feature.non_oss_deps) }}
{%- endif -%}

{%- if intent_type == ['developer_testing', 'experiment', 'extend_experiment', 'ship'] -%}
  {%- if feature.resources and feature.resources.samples -%}
<br>
<br>
<div><b>Sample links</b></div>
    {%- for link in feature.resources.samples -%}
<br>
<a href="{{ link | default('#', true) }}">{{ show_value(link) }}</a>
    {%- endfor -%}
  {%- endif -%}
{%- endif -%}

<br>
<br>
<div><b>Estimated milestones</b></div>
{%- include "estimated-milestones-table.html" -%}

{%- if feature.feature_type_int != 2 -%}
{%- if intent_type == 'ship' or feature.anticipated_spec_changes -%}
<br>
<br>
<div><b>Anticipated spec changes</b></div>
  <p style="font-style: italic">
    Open questions about a feature may be a source of future web compat or
    interop issues. Please list open issues (e.g. links to known github
    issues in the project for the feature specification) whose resolution
    may introduce web compat/interop risk (e.g., changing to naming or
    structure of the API in a non-backward-compatible way).
  </p>
  {{ urlize_with_default(feature.anticipated_spec_changes) }}
{%- endif -%}
{%- endif -%}

<br>
<br>
<div><b>Link to entry on the {{APP_TITLE}}</b></div>
<a href="{{ default_url | default('#', true) }}">{{ show_value(default_url) }}</a>

{%- if should_render_intents -%}
<br>
<br>
<div><b>Links to previous Intent discussions</b></div>
  {%- for stage in stage_info.proto_stages -%}
    {%- if stage.intent_thread_url -%}
      Intent to Prototype: {{ urlize_with_default(stage.intent_thread_url) }}<br>
    {%- endif -%}
  {%- endfor -%}
  {%- for stage in stage_info.dt_stages -%}
    {%- if stage.announcement_url -%}
      Ready for Trial: {{ urlize_with_default(stage.announcement_url) }}<br>
    {%- endif -%}
  {%- endfor -%}
  {%- for stage in stage_info.ot_stages -%}
    {%- if stage.intent_thread_url -%}
      Intent to Experiment: {{ urlize_with_default(stage.intent_thread_url) }}<br>
    {%- endif -%}
  {%- endfor -%}
  {%- for stage in stage_info.extension_stages -%}
    {%- if stage.intent_thread_url -%}
      Intent to Extend Experiment {{loop.index}}: {{ urlize_with_default(stage.intent_thread_url) }}<br>
    {%- endif -%}
  {%- endfor -%}
  {%- for stage in stage_info.ship_stages -%}
    {%- if stage.intent_thread_url -%}
      Intent to Ship: {{ urlize_with_default(stage.intent_thread_url) }}<br>
    {%- endif -%}
  {%- endfor -%}
{%- endif -%}

<br>
<br>
<div><small>
  This intent message was generated by
  <a href="https://chromestatus.com">Chrome Platform Status</a>.
</small></div>

