{{- /*
  Encrypted content renderer.
  - Renders template placeholder for post-build AES-256-GCM encryption.
  - Supports full-page mode and partial mode with isolated target container.
  @param {String} .Password - Encryption password
  @param {String} .Content - Plaintext content (encrypted by post-build script)
  @param {String} [.Message] - Custom input placeholder message
  @param {Boolean} [.IsPartial] - Whether current render is partial mode
  @param {Object} [.Page] - Current page context (required when IsPartial is true)
*/ -}}

{{- if .Password -}}
  {{- /* Generating fixit-encryptor DOM */ -}}
  {{- $message := .Message | default (T "single.encryptedMessage") -}}
  {{- $id := "fixit-decryptor-input" -}}
  {{- if .IsPartial -}}
    {{- $id = dict "Page" .Page | partial "function/id.html" -}}
  {{- end -}}
  <fixit-encryptor data-pagefind-ignore="all">
    <div class="fixit-decryptor-container">
      <div class="fixit-decryptor-form">
        <div class="fixit-decryptor-header">
          <i class="fixit-decryptor-icon fa-solid fa-lock"></i>
        </div>
        <label for="{{ $id }}" class="sr-only">{{ T `single.password` }}</label>
        <div class="fixit-decryptor-field">
          <i class="fa-solid fa-key"></i>
          <input type="password" id="{{ $id }}" class="fixit-decryptor-input max-sm:w-full" placeholder="{{ $message }}" />
        </div>
        <button class="fixit-decryptor-btn">
          {{- dict "Class" "fa-solid fa-unlock-keyhole me-1.5" | partial "plugin/icon.html" }}{{ T "single.enterBtn" -}}
        </button>
      </div>
      {{- if not .IsPartial -}}
        <button class="fixit-encryptor-btn" title="{{ T `single.encryptyAgain` }}">
          {{- dict "Class" "fa-solid fa-lock" | partial "plugin/icon.html" -}}
        </button>
      {{- end -}}
    </div>
    {{- if .IsPartial }}<div class="decryptor-content"></div>{{ end -}}
    <template data-password="{{ sha256 .Password }}">{{ .Content }}</template>
  </fixit-encryptor>
{{- end -}}
