";
        $showAvatar = false;
        if ($this->options->thread_layouts["showAvatars"] && $this->options->wp["showAvatars"]) {
            $authorAvatar = $trackOrPingback ? "
 . ")
" : $user["avatar"];
            if (isset($user["authorAvatarSprintf"])) {
                $authorAvatar = sprintf($user["authorAvatarSprintf"], $authorAvatar);
            }
            if (isset($user["socIcon"])) {
                $authorAvatar .= $user["socIcon"];
            }
            $showAvatar = true;
            $search[]   = "{AVATAR_WRAPPER_CLASSES}";
            $search[]   = "{AVATAR}";
            $replace[]  = "wpd-avatar " . apply_filters("wpdiscuz_avatar_classes", "");
            $replace[]  = $authorAvatar;
        }
        $showLabel = false;
        if (!$trackOrPingback) {
            $user["author_title"] = apply_filters("wpdiscuz_author_title", $user["author_title"], $comment);
            if ($user["author_title"]) {
                $showLabel = true;
                $search[]  = "{LABEL_WRAPPER_CLASSES}";
                $search[]  = "{LABEL_TOOLTIP_POSITION}";
                $search[]  = "{LABEL}";
                $replace[] = "wpd-comment-label";
                $replace[] = $args["layout"] == 1 ? "right" : "top";
                $replace[] = esc_html($user["author_title"]);
            }
        }
        $showFollow = false;
        if ($args["can_user_follow"] && $args["current_user_email"] !== $comment->comment_author_email) {
            if (is_array($args["user_follows"]) && in_array($comment->comment_author_email, $args["user_follows"])) {
                $followClass = "wpd-unfollow wpd-follow-active";
                $followTip   = esc_html($this->options->getPhrase("wc_unfollow_user", ["comment" => $comment]));
            } else {
                $followClass = "wpd-follow";
                $followTip   = esc_html($this->options->getPhrase("wc_follow_user", ["comment" => $comment]));
            }
            $showFollow = true;
            $search[]   = "{FOLLOW_WRAPPER_CLASSES}";
            $search[]   = "{FOLLOW_TOOLTIP_TEXT}";
            $search[]   = "{FOLLOW_TOOLTIP_POSITION}";
            $search[]   = "{FOLLOW_ICON}";
            $replace[]  = "wpd-follow-link wpd_not_clicked " . $followClass;
            $replace[]  = esc_attr($followTip);
            $replace[]  = $args["follow_tooltip_position"];
            $replace[]  = "";
        }
        $commentLeftClass = apply_filters("wpdiscuz_comment_left_class", "");
        $uNameClasses           = apply_filters("wpdiscuz_username_classes", "");
        $user["authorNameHtml"] .= apply_filters("wpdiscuz_after_comment_author", "", $comment, $user["user"]);
        $search[]  = "{AUTHOR_WRAPPER_CLASSES}";
        $search[]  = "{AUTHOR}";
        $replace[] = "wpd-comment-author " . esc_attr($uNameClasses);
        $replace[] = $user["authorNameHtml"];
        $showStatus  = false;
        $statusIcons .= apply_filters("wpdiscuz_comment_type_icon", "", $comment, $user["user"], $args["current_user"]);
        if ($statusIcons) {
            $search[]   = "{STATUS_WRAPPER_CLASSES}";
            $search[]   = "{STATUS_ICONS}";
            $replace[]  = "wpd-comment-status";
            $replace[]  = $statusIcons;
            $showStatus = true;
        }
        $showLink          = false;
        $beforeCommentLink = apply_filters("wpdiscuz_before_comment_link", "", $comment, $user["user"], $args["current_user"]);
        $afterCommentLink  = apply_filters("wpdiscuz_after_comment_link", "", $comment, $user["user"], $args["current_user"]);
        if ($this->options->thread_layouts["showCommentLink"] || $beforeCommentLink || $afterCommentLink) {
            $commentLinkIcon = "";
            if ($beforeCommentLink) {
                $commentLinkIcon = $beforeCommentLink;
            }
            if ($this->options->thread_layouts["showCommentLink"]) {
                $commentLinkIcon .= apply_filters("wpdiscuz_comment_link_img", "
", $comment);
            }
            if ($afterCommentLink) {
                $commentLinkIcon .= $afterCommentLink;
            }
            $showLink  = true;
            $search[]  = "{LINK_WRAPPER_CLASSES}";
            $search[]  = "{LINK_ICON}";
            $replace[] = "wpd-comment-link wpd-hidden";
            $replace[] = $commentLinkIcon;
        }
        $showVote = false;
        if ($this->options->thread_layouts["showVotingButtons"] && $isApproved) {
            if ($this->options->thread_layouts["votingButtonsStyle"]) {
                $voteCount  = isset($commentMetas[self::META_KEY_VOTES_SEPARATE]) ? maybe_unserialize($commentMetas[self::META_KEY_VOTES_SEPARATE][0]) : ["like" => 0, "dislike" => 0];
                $like       = !empty($voteCount["like"]) ? intval($voteCount["like"]) : 0;
                $voteResult = "
" . esc_html($this->helper->getNumber($like)) . "
";
                if ($this->options->thread_layouts["enableDislikeButton"]) {
                    $dislike    = !empty($voteCount["dislike"]) ? intval($voteCount["dislike"]) : 0;
                    $voteResult .= "
";
                    $voteResult .= "
" . esc_html($this->helper->getNumber(-$dislike)) . "
";
                }
            } else {
                $votes      = isset($commentMetas[self::META_KEY_VOTES]) ? intval($commentMetas[self::META_KEY_VOTES][0]) : 0;
                $voteResult = "
" . esc_html($this->helper->getNumber($votes)) . "
";
            }
            $wpdUpClass   = "";
            $wpdDownClass = "";
            if (isset($args["user_votes"][$comment->comment_ID])) {
                if ($args["user_votes"][$comment->comment_ID] > 0) {
                    $wpdUpClass = " wpd-up";
                } else if ($args["user_votes"][$comment->comment_ID] < 0) {
                    $wpdDownClass = " wpd-down";
                }
            }
            $search[]  = "{VOTE_WRAPPER_CLASSES}";
            $search[]  = "{VOTE_UP_CLASSES}";
            $search[]  = "{VOTE_DOWN_CLASSES}";
            $search[]  = "{VOTE_UP_ICON}";
            $search[]  = "{VOTE_RESULT}";
            $search[]  = "{VOTE_DOWN_ICON}";
            $replace[] = "wpd-vote";
            $replace[] = "wpd-vote-up wpd_not_clicked" . $wpdUpClass;
            $replace[] = "wpd-vote-down wpd_not_clicked" . ($this->options->thread_layouts["enableDislikeButton"] ? "" : " wpd-dislike-hidden") . $wpdDownClass;
            $replace[] = $args["voting_icons"][0];
            $replace[] = $voteResult;
            $replace[] = $args["voting_icons"][1];
            $showVote  = true;
        }
        $showReply = false;
        if (!$isClosed) {
            if ($args["high_level_user"] || ($this->helper->isCommentEditable($comment) && $this->helper->canUserEditComment($comment, $args["current_user"], $args))) {
                $toolsActions = "" . $toolsActions;
            }
            if ($args["can_user_reply"] && $isApproved) {
                $showReply = true;
                $search[]  = "{REPLY_WRAPPER_CLASSES}";
                $search[]  = "{REPLY_ICON}";
                $search[]  = "{REPLY_TEXT}";
                $replace[] = "wpd-reply-button";
                $replace[] = "
";
                $replace[] = esc_html($this->options->getPhrase("wc_reply_text", ["comment" => $comment]));
                $search[]  = "{PANEL}";
                if ($args["layout"] == 3 && !$comment->comment_parent) {
                    $replace[] = "
";
                } else {
                    $replace[] = "";
                }
            }
        }
        $afterReplyButton = apply_filters("wpdiscuz_after_reply_button", "", $comment, $user["user"], $args["current_user"]);
        $showToggle = false;
        if ($this->options->wp["threadComments"] && $depth < $this->options->wp["threadCommentsDepth"]) {
            if (isset($args["wpdiscuz_child_count_" . $comment->comment_ID])) {
                if ($countChildren = $args["wpdiscuz_child_count_" . $comment->comment_ID]) {
                    $commentWrapClass[] = "wpd-hidden-replies";
                    $search[]           = "{TOGGLE_WRAPPER_CLASSES}";
                    $search[]           = "{TOGGLE_TOOLTIP_TEXT}";
                    $search[]           = "{TOGGLE_ICON}";
                    $replace[]          = "wpd-toggle wpd-hidden wpd_not_clicked";
                    $replace[]          = esc_html($this->options->getPhrase("wc_show_replies_text", ["comment" => $comment]));
                    $replace[]          = "
" . esc_html($this->options->getPhrase("wc_show_replies_text", ["comment" => $comment])) . " ($countChildren)";
                    $showToggle         = true;
                }
            } else if ($comment->get_children(["post_id" => $args["post_id"]])) {
                $search[]   = "{TOGGLE_WRAPPER_CLASSES}";
                $search[]   = "{TOGGLE_TOOLTIP_TEXT}";
                $search[]   = "{TOGGLE_ICON}";
                $replace[]  = "wpd-toggle wpd-hidden wpd_not_clicked";
                $replace[]  = esc_html($this->options->getPhrase("wc_hide_replies_text", ["comment" => $comment]));
                $replace[]  = "
";
                $showToggle = true;
            }
        }
        $toolsActions .= apply_filters("wpdiscuz_comment_buttons", "", $comment, $user["user"], $args["current_user"]);
        $showTools    = false;
        if ($toolsActions) {
            $search[]  = "{TOOLS_WRAPPER_CLASSES}";
            $search[]  = "{TOOLS_TOOLTIP_TEXT}";
            $search[]  = "{TOOLS_ICON}";
            $search[]  = "{TOOLS_ACTIONS}";
            $replace[] = "wpd-tools wpd-hidden";
            $replace[] = esc_attr($this->options->getPhrase("wc_manage_comment", ["comment" => $comment]));
            $replace[] = "
";
            $replace[] = "
" . $toolsActions . "
";
            $search[]  = "{SEPARATOR}";
            $replace[] = $showToggle ? "
" : "";
            $showTools = true;
        }
        $lastEdited = "";
        if ($this->options->moderation["displayEditingInfo"] && isset($commentMetas[self::META_KEY_LAST_EDITED_AT]) && isset($commentMetas[self::META_KEY_LAST_EDITED_BY])) {
            $lastEditUser = get_user_by(is_numeric($commentMetas[self::META_KEY_LAST_EDITED_BY][0]) ? "id" : "email", $commentMetas[self::META_KEY_LAST_EDITED_BY][0]);
            $username     = $lastEditUser ? $lastEditUser->display_name : $comment->comment_author;
            $lastEdited   = "";
        }
        $commentWrapClass = array_merge($commentWrapClass, $user["commentWrapClass"], $user["commentWrapRoleClass"]);
        if ($args["layout"] == 1) {
            $search[]  = "{WRAPPER_CLASSES}";
            $search[]  = "{HEADER_WRAPPER_CLASSES}";
            $search[]  = "{FOOTER_WRAPPER_CLASSES}";
            $search[]  = "{RIGHT_WRAPPER_ID}";
            $search[]  = "{RIGHT_WRAPPER_CLASSES}";
            $search[]  = "{TEXT_WRAPPER_CLASSES}";
            $search[]  = "{TEXT}";
            $search[]  = "{LEFT_WRAPPER_CLASSES}";
            $replace[] = esc_attr(implode(' ', $commentWrapClass));
            $replace[] = "wpd-comment-header";
            $replace[] = "wpd-comment-footer";
            $replace[] = esc_attr("comment-" . $comment->comment_ID);
            $replace[] = "wpd-comment-right";
            $replace[] = "wpd-comment-text";
            $content   = "";
            if ($isInline) {
                $content = "
";
            }
            $replace[]        = $content . $comment->comment_content;
            $replace[]        = "wpd-comment-left " . esc_attr($commentLeftClass);
            $leftComponent    = $showAvatar || $showLabel || $showFollow ? str_replace(["{AVATAR}", "{LABEL}", "{FOLLOW}"], [$showAvatar ? $args["components"]["avatar.html"] : "", ($showLabel ? $args["components"]["label.html"] : "") . apply_filters("wpdiscuz_after_label", "", $comment), $showFollow ? $args["components"]["follow.html"] : ""], $args["components"]["left.html"]) : "";
            $headerComponent  = str_replace(["{AUTHOR}", "{DATE}", "{STATUS}", "{SHARE}", "{LINK}"], [$args["components"]["author.html"], $showDate ? $args["components"]["date.html"] : "", $showStatus ? $args["components"]["status.html"] : "", $showShare ? $args["components"]["share.html"] : "", $showLink ? $args["components"]["link.html"] : ""], $args["components"]["header.html"]);
            $footerComponent  = $showVote || $showReply || $afterReplyButton || $showTools || $showToggle ? str_replace(["{VOTE}", "{REPLY}", "{TOOLS}", "{TOGGLE}"], [$showVote ? $args["components"]["vote.html"] : "", ($showReply ? $args["components"]["reply.html"] : "") . $afterReplyButton, $showTools ? $args["components"]["tools.html"] : "", $showToggle ? $args["components"]["toggle.html"] : ""], $args["components"]["footer.html"]) : "";
            $rightComponent   = str_replace(["{HEADER}", "{REPLY_TO}", "{TEXT}", "{FOOTER}"], [$headerComponent, $showReplyTo ? $args["components"]["reply_to.html"] : "", $args["components"]["text.html"] . $lastEdited, $footerComponent], $args["components"]["right.html"]);
            $wrapperComponent = str_replace(["{LEFT}", "{RIGHT}"], [$leftComponent, $rightComponent], $args["components"]["wrapper.html"]);
            $commentOutput    .= str_replace($search, $replace, $wrapperComponent);
        } else if ($args["layout"] == 2) {
            $search[]  = "{WRAPPER_CLASSES}";
            $search[]  = "{HEADER_WRAPPER_CLASSES}";
            $search[]  = "{FOOTER_WRAPPER_CLASSES}";
            $search[]  = "{RIGHT_WRAPPER_ID}";
            $search[]  = "{RIGHT_WRAPPER_CLASSES}";
            $search[]  = "{TEXT_WRAPPER_CLASSES}";
            $search[]  = "{TEXT}";
            $search[]  = "{USER_INFO_WRAPPER_CLASSES}";
            $search[]  = "{USER_INFO_TOP_WRAPPER_CLASSES}";
            $search[]  = "{USER_INFO_BOTTOM_WRAPPER_CLASSES}";
            $replace[] = esc_attr(implode(' ', $commentWrapClass));
            $replace[] = "wpd-comment-header";
            $replace[] = "wpd-comment-footer";
            $replace[] = esc_attr("comment-" . $comment->comment_ID);
            $replace[] = "wpd-comment-right";
            $replace[] = "wpd-comment-text";
            $content   = "";
            if ($isInline) {
                $content = "
";
            }
            $replace[]               = $content . $comment->comment_content;
            $replace[]               = "wpd-user-info";
            $replace[]               = "wpd-uinfo-top";
            $replace[]               = "wpd-uinfo-bottom";
            $userInfoTopComponent    = str_replace(["{AUTHOR}", "{LABEL}", "{STATUS}", "{SHARE}"], [$args["components"]["author.html"], ($showLabel ? $args["components"]["label.html"] : "") . apply_filters("wpdiscuz_after_label", "", $comment), $showStatus ? $args["components"]["status.html"] : "", $showShare ? $args["components"]["share.html"] : ""], $args["components"]["user_info_top.html"]);
            $userInfoBottomComponent = $showFollow || $showReplyTo || $showDate ? str_replace(["{FOLLOW}", "{REPLY_TO}", "{DATE}"], [$showFollow ? $args["components"]["follow.html"] : "", $showReplyTo ? $args["components"]["reply_to.html"] : "", $showDate ? $args["components"]["date.html"] : ""], $args["components"]["user_info_bottom.html"]) : "";
            $userInfoComponent       = str_replace(["{TOP}", "{BOTTOM}"], [$userInfoTopComponent, $userInfoBottomComponent], $args["components"]["user_info.html"]);
            $headerComponent         = str_replace(["{AVATAR}", "{USER_INFO}", "{LINK}"], [$showAvatar ? $args["components"]["avatar.html"] : "", $userInfoComponent, $showLink ? $args["components"]["link.html"] : ""], $args["components"]["header.html"]);
            $footerComponent         = $showVote || $showReply || $afterReplyButton || $showTools || $showToggle ? str_replace(["{VOTE}", "{REPLY}", "{TOOLS}", "{TOGGLE}"], [$showVote ? $args["components"]["vote.html"] : "", ($showReply ? $args["components"]["reply.html"] : "") . $afterReplyButton, $showTools ? $args["components"]["tools.html"] : "", $showToggle ? $args["components"]["toggle.html"] : ""], $args["components"]["footer.html"]) : "";
            $rightComponent          = str_replace(["{HEADER}", "{TEXT}", "{FOOTER}"], [$headerComponent, $args["components"]["text.html"] . $lastEdited, $footerComponent], $args["components"]["right.html"]);
            $wrapperComponent        = str_replace(["{RIGHT}"], [$rightComponent], $args["components"]["wrapper.html"]);
            $commentOutput           .= str_replace($search, $replace, $wrapperComponent);
        } else if ($args["layout"] == 3) {
            $search[]  = "{WRAPPER_CLASSES}";
            $search[]  = "{HEADER_WRAPPER_CLASSES}";
            $search[]  = "{FOOTER_WRAPPER_CLASSES}";
            $search[]  = "{RIGHT_WRAPPER_ID}";
            $search[]  = "{RIGHT_WRAPPER_CLASSES}";
            $search[]  = "{TEXT_WRAPPER_CLASSES}";
            $search[]  = "{TEXT}";
            $search[]  = "{LEFT_WRAPPER_CLASSES}";
            $search[]  = "{SUBHEADER_WRAPPER_CLASSES}";
            $search[]  = "{TOOLS_WRAP_WRAPPER_CLASSES}";
            $replace[] = esc_attr(implode(' ', $commentWrapClass));
            $replace[] = "wpd-comment-header";
            $replace[] = "wpd-comment-footer";
            $replace[] = esc_attr("comment-" . $comment->comment_ID);
            $replace[] = "wpd-comment-right";
            $replace[] = "wpd-comment-text";
            $content   = "";
            if ($isInline) {
                $content = "
";
            }
            $replace[]          = $content . $comment->comment_content;
            $replace[]          = "wpd-comment-left " . esc_attr($commentLeftClass);
            $replace[]          = "wpd-comment-subheader";
            $replace[]          = "wpd-tool-wrap";
            $subheaderComponent = !$comment->comment_parent && ($showLabel || $showDate || $showStatus) ? str_replace(["{LABEL}", "{DATE}", "{STATUS}"], [($showLabel ? $args["components"]["label.html"] : "") . apply_filters("wpdiscuz_after_label", "", $comment), $showDate ? $args["components"]["date.html"] : "", $showStatus ? $args["components"]["status.html"] : ""], $args["components"]["subheader.html"]) : "";
            $leftComponent      = $showAvatar ? str_replace(["{AVATAR}"], [$args["components"]["avatar.html"]], $args["components"]["left.html"]) : "";
            $headerComponent    = str_replace(["{AUTHOR}", "{LABEL}", "{FOLLOW}", "{SHARE}", "{STATUS}", "{LINK}"], [$args["components"]["author.html"], $comment->comment_parent ? ($showLabel ? $args["components"]["label.html"] : "") . apply_filters("wpdiscuz_after_label", "", $comment) : "", $showFollow ? $args["components"]["follow.html"] : "", $showShare ? $args["components"]["share.html"] : "", $comment->comment_parent && $showStatus ? $args["components"]["status.html"] : "", $showLink ? $args["components"]["link.html"] : ""], $args["components"]["header.html"]);
            $toolsWrapComponent = $showTools || $showToggle ? str_replace(["{TOOLS}", "{TOGGLE}"], [$showTools ? $args["components"]["tools.html"] : "", $showToggle ? $args["components"]["toggle.html"] : ""], $args["components"]["tools_wrap.html"]) : "";
            $replyToComponent   = str_replace(["{DATE}"], [$showDate ? $args["components"]["date.html"] : ""], $args["components"]["reply_to.html"]);
            $footerComponent    = $showVote || $showReply || $afterReplyButton || $toolsWrapComponent ? str_replace(["{VOTE}", "{REPLY}", "{TOOLS_WRAP}"], [$showVote ? $args["components"]["vote.html"] : "", ($showReply ? $args["components"]["reply.html"] : "") . $afterReplyButton, $toolsWrapComponent], $args["components"]["footer.html"]) : "";
            $rightComponent     = str_replace(["{HEADER}", "{SUBHEADER}", "{REPLY_TO}", "{TEXT}", "{FOOTER}"], [$headerComponent, $subheaderComponent, $showReplyTo ? $replyToComponent : "", $args["components"]["text.html"] . $lastEdited, $footerComponent], $args["components"]["right.html"]);
            $wrapperComponent   = str_replace(["{LEFT}", "{RIGHT}"], [$leftComponent, $rightComponent], $args["components"]["wrapper.html"]);
            $commentOutput      .= str_replace($search, $replace, $wrapperComponent);
        }
        $commentOutput .= "
";
        $output        .= apply_filters("wpdiscuz_comment_end", $commentOutput, $comment, $depth, $args);
    }
    public function end_el(&$output, $comment, $depth = 0, $args = []) {
        $output = apply_filters("wpdiscuz_thread_end", $output, $comment, $depth, $args);
        $output .= "
 ";
        if (!empty($args["lastCommentIdInList"]) && !empty($args["commentsArgs"]) && $args["lastCommentIdInList"] === $comment->comment_ID && $this->extra) {
            $this->cache->setExtraCache($args["commentsArgs"], $this->extra);
        }
        return $output;
    }
}