_dalfox() {
    local i cur prev opts cmd
    COMPREPLY=()
    if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
        cur="$2"
    else
        cur="${COMP_WORDS[COMP_CWORD]}"
    fi
    prev="$3"
    cmd=""
    opts=""

    for i in "${COMP_WORDS[@]:0:COMP_CWORD}"
    do
        case "${cmd},${i}" in
            ",$1")
                cmd="dalfox"
                ;;
            dalfox,completion)
                cmd="dalfox__subcmd__completion"
                ;;
            dalfox,help)
                cmd="dalfox__subcmd__help"
                ;;
            dalfox,mcp)
                cmd="dalfox__subcmd__mcp"
                ;;
            dalfox,payload)
                cmd="dalfox__subcmd__payload"
                ;;
            dalfox,scan)
                cmd="dalfox__subcmd__scan"
                ;;
            dalfox,server)
                cmd="dalfox__subcmd__server"
                ;;
            dalfox__subcmd__help,completion)
                cmd="dalfox__subcmd__help__subcmd__completion"
                ;;
            dalfox__subcmd__help,help)
                cmd="dalfox__subcmd__help__subcmd__help"
                ;;
            dalfox__subcmd__help,mcp)
                cmd="dalfox__subcmd__help__subcmd__mcp"
                ;;
            dalfox__subcmd__help,payload)
                cmd="dalfox__subcmd__help__subcmd__payload"
                ;;
            dalfox__subcmd__help,scan)
                cmd="dalfox__subcmd__help__subcmd__scan"
                ;;
            dalfox__subcmd__help,server)
                cmd="dalfox__subcmd__help__subcmd__server"
                ;;
            *)
                ;;
        esac
    done

    case "${cmd}" in
        dalfox)
            opts="-S -h -V --config --debug --no-color --silence --help --version scan server payload mcp completion help"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --config)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        dalfox__subcmd__completion)
            opts="-S -h --config --debug --no-color --silence --help bash elvish fish powershell zsh"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --config)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        dalfox__subcmd__help)
            opts="scan server payload mcp completion help"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        dalfox__subcmd__help__subcmd__completion)
            opts=""
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        dalfox__subcmd__help__subcmd__help)
            opts=""
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        dalfox__subcmd__help__subcmd__mcp)
            opts=""
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        dalfox__subcmd__help__subcmd__payload)
            opts=""
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        dalfox__subcmd__help__subcmd__scan)
            opts=""
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        dalfox__subcmd__help__subcmd__server)
            opts=""
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        dalfox__subcmd__mcp)
            opts="-S -h --config --debug --no-color --silence --help"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --config)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        dalfox__subcmd__payload)
            opts="-S -h --json --config --debug --no-color --silence --help"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --config)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        dalfox__subcmd__scan)
            opts="-i -f -o -S -p -d -H -X -W -r -F -e -b -h --input-type --dedup-urls --format --output --include-request --include-response --include-all --no-color --silence --dry-run --stream-findings --poc-type --limit --limit-result-type --only-poc --state-file --baseline --baseline-mode --param --data --headers --cookies --method --user-agent --cookie-from-raw --session-check --session-check-url --on-session-loss --include-url --exclude-url --ignore-param --out-of-scope --out-of-scope-file --only-discovery --skip-discovery --skip-reflection-header --skip-reflection-cookie --skip-reflection-path --mining-dict-word --remote-wordlists --skip-mining --skip-mining-dict --skip-mining-dom --timeout --scan-timeout --delay --rl --rate-limit --retries --retry-delay --proxy --insecure --follow-redirects --ignore-return --workers --max-concurrent-targets --max-targets-per-host --encoders --remote-payloads --custom-blind-xss-payload --blind --blind-oob --blind-oob-secret --blind-oob-wait --custom-payload --only-custom-payload --custom-alert-value --custom-alert-type --inject-marker --skip-xss-scanning --max-payloads-per-param --deep-scan --sxss --sxss-url --sxss-method --sxss-retries --skip-ast-analysis --analyze-external-js --hpp --detect-outdated-libs --waf-bypass --skip-waf-probe --force-waf --waf-evasion --waf-min-confidence --config --debug --help"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --input-type)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                -i)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --dedup-urls)
                    COMPREPLY=($(compgen -W "exact signature off" -- "${cur}"))
                    return 0
                    ;;
                --format)
                    COMPREPLY=($(compgen -W "plain json jsonl markdown sarif toml" -- "${cur}"))
                    return 0
                    ;;
                -f)
                    COMPREPLY=($(compgen -W "plain json jsonl markdown sarif toml" -- "${cur}"))
                    return 0
                    ;;
                --output)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                -o)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --poc-type)
                    COMPREPLY=($(compgen -W "plain curl httpie http-request" -- "${cur}"))
                    return 0
                    ;;
                --limit)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --limit-result-type)
                    COMPREPLY=($(compgen -W "all v r a i V R A I" -- "${cur}"))
                    return 0
                    ;;
                --only-poc)
                    COMPREPLY=($(compgen -W "v r a i V R A I" -- "${cur}"))
                    return 0
                    ;;
                --state-file)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --baseline)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --baseline-mode)
                    COMPREPLY=($(compgen -W "filter annotate" -- "${cur}"))
                    return 0
                    ;;
                --param)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                -p)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --data)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                -d)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --headers)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                -H)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --cookies)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --method)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                -X)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --user-agent)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --cookie-from-raw)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --session-check)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --session-check-url)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --on-session-loss)
                    COMPREPLY=($(compgen -W "abort continue" -- "${cur}"))
                    return 0
                    ;;
                --include-url)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --exclude-url)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --ignore-param)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --out-of-scope)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --out-of-scope-file)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --mining-dict-word)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                -W)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --remote-wordlists)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --timeout)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --scan-timeout)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --delay)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --rate-limit)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --rl)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                -r)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --retries)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --retry-delay)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --proxy)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --insecure)
                    COMPREPLY=($(compgen -W "true false" -- "${cur}"))
                    return 0
                    ;;
                --ignore-return)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --workers)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --max-concurrent-targets)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --max-targets-per-host)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --encoders)
                    COMPREPLY=($(compgen -W "none url 2url 3url 4url html htmlpad base64 unicode zwsp" -- "${cur}"))
                    return 0
                    ;;
                -e)
                    COMPREPLY=($(compgen -W "none url 2url 3url 4url html htmlpad base64 unicode zwsp" -- "${cur}"))
                    return 0
                    ;;
                --remote-payloads)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --custom-blind-xss-payload)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --blind)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                -b)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --blind-oob)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --blind-oob-secret)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --blind-oob-wait)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --custom-payload)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --custom-alert-value)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --custom-alert-type)
                    COMPREPLY=($(compgen -W "none str" -- "${cur}"))
                    return 0
                    ;;
                --inject-marker)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --max-payloads-per-param)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --sxss-url)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --sxss-method)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --sxss-retries)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --waf-bypass)
                    COMPREPLY=($(compgen -W "auto force off" -- "${cur}"))
                    return 0
                    ;;
                --force-waf)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --waf-min-confidence)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --config)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        dalfox__subcmd__server)
            opts="-p -H -S -h --port --host --api-key --log-file --rate-limit --scan-timeout --max-concurrent-scans --allowed-hosts --max-retained-scans --max-body-bytes --allowed-origins --jsonp --callback-param-name --cors-allow-methods --cors-allow-headers --config --debug --no-color --silence --help"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --port)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                -p)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --host)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                -H)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --api-key)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --log-file)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --rate-limit)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --scan-timeout)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --max-concurrent-scans)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --allowed-hosts)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --max-retained-scans)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --max-body-bytes)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --allowed-origins)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --callback-param-name)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --cors-allow-methods)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --cors-allow-headers)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --config)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
    esac
}

if [[ "${BASH_VERSINFO[0]}" -eq 4 && "${BASH_VERSINFO[1]}" -ge 4 || "${BASH_VERSINFO[0]}" -gt 4 ]]; then
    complete -F _dalfox -o nosort -o bashdefault -o default dalfox
else
    complete -F _dalfox -o bashdefault -o default dalfox
fi
