# shellcheck shell=dash disable=1091,2034

___x_cmd_theme_prompt_format(){
    ___x_cmd_theme_ice "$@"
}

___x_cmd_theme_ice(){
   case "$1" in
        mini)   ___x_cmd_theme_ice_mini      ;;
        *)      ___x_cmd_theme_ice_normal    ;;
   esac
}

___x_cmd_theme_ice_mini(){
    XTW_cwd1_style_tail="${XTW_cwd_style_tail}"
    ___x_cmd_theme_mini
}

xrc:theme:widget msg symbol
___x_cmd_theme_ice_normal(){
    local x_;
    ___x_cmd_theme_headline_print

    ___x_cmd_theme_ice_left
    ___x_cmd_theme_ice_right
    local X_prompt="${X_left} ${X_right}"

    ______x_cmd_theme_prompt_remove_escapes_ "$X_prompt"
    if [ -n "$COLUMNS" ] && [ "${#x_}" -gt "$((  COLUMNS - COLUMNS / 3 ))" ]; then
        printf "%s\n"   "$X_right"
        printf "%s"     "$X_left"
    else
        printf "%s"     "$X_prompt"     # Using double column as a flavour
    fi

    ___x_cmd_theme_widget_symbol "ᐅ" "ᐅ" "ᐅ"
    printf "\n%s " "${X_symbol}"
}

XT_transient_ps1(){
    local x_=""
    theme:feature:get transient_time
    case "$x_" in
        always)
            ___x_cmd_theme_comp_transient time
            ___X_CMD_THEME_TIME_H_M_S="$x_"
            ___x_cmd_theme_widget_hms 2>/dev/null
            [ -z "$X_hms" ] || X_ps1="${X_hms} " ;;
    esac

    ___x_cmd_theme_widget_symbol "ᐅ" "ᐅ" "ᐅ" 2>/dev/null
    [ -z "$X_symbol" ] || X_ps1="${X_ps1}${X_symbol} "
}

xrc:theme:widget cwd vcml username emoji
___x_cmd_theme_ice_left(){
    ___x_cmd_theme_widget_username
    ___x_cmd_theme_widget_cwd
    ___x_cmd_theme_widget_vcml
    ___x_cmd_theme_widget_emoji
    X_emoji="${X_emoji:-"$XT_ICE_PRE_ICON"}"
    X_left="${X_emoji} ${X_username} ${X_cwd} ${X_vcml}"
}
xrc:theme:widget hms
___x_cmd_theme_ice_right(){
    ___x_cmd_theme_widget_hms
    X_right="${X_hms}"
}


XTW_hms_style_true=""
XTW_hms_style_false=""
XTW_hms_text_prefix="["
XTW_hms_text_suffix="]"

XTW_vcml_prefix="on "
XTW_vcml_left_label_clean="git:"
XTW_vcml_left_label_dirty="git:"

XT_ICE_PRE_ICON='💠'

___x_cmd_theme_linecount_ps1=3
