<commit_before>defmodule AsciinemaWeb.AsciicastView do
  use AsciinemaWeb, :view
  import Scrivener.HTML
  alias AsciinemaWeb.Endpoint
  alias AsciinemaWeb.Router.Helpers.Extra, as: RoutesX
  alias AsciinemaWeb.UserView
  import UserView, only: [theme_options: 0]

  def player(src, opts \\ [])

  def player(src, opts) when is_binary(src) do
    if Keyword.get(opts, :player_v3) do
      container_id = Keyword.fetch!(opts, :container_id)

      props =
        [src: src, preload: true]
        |> Keyword.merge(opts)
        |> Ext.Keyword.rename(t: :startAt)
        |> Enum.into(%{})
        |> Map.drop([:container_id, :player_v3])

      content_tag(:script) do
        ~E"""
          window.players ||= new Map();
          window.players.set('<%= container_id %>', <%= {:safe, Jason.encode!(props)} %>);
        """
      end
    else
      opts =<commit_msg>Fix use of logical OR assignment (fixes #387)<commit_after>defmodule AsciinemaWeb.AsciicastView do
  use AsciinemaWeb, :view
  import Scrivener.HTML
  alias AsciinemaWeb.Endpoint
  alias AsciinemaWeb.Router.Helpers.Extra, as: RoutesX
  alias AsciinemaWeb.UserView
  import UserView, only: [theme_options: 0]

  def player(src, opts \\ [])

  def player(src, opts) when is_binary(src) do
    if Keyword.get(opts, :player_v3) do
      container_id = Keyword.fetch!(opts, :container_id)

      props =
        [src: src, preload: true]
        |> Keyword.merge(opts)
        |> Ext.Keyword.rename(t: :startAt)
        |> Enum.into(%{})
        |> Map.drop([:container_id, :player_v3])

      content_tag(:script) do
        ~E"""
          window.players = window.players || new Map();
          window.players.set('<%= container_id %>', <%= {:safe, Jason.encode!(props)} %>);
        """
      end
    else
      opts =
{'fraction_non_alphanumeric': 0.14109742441209405, 'fraction_numerical': 0.005039193729003359, 'mean_word_length': 2.8265524625267666, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3507791', 'n_tokens_mistral': 632, 'n_tokens_neox': 604, 'n_words': 130}