function renderOtp(otp) {
  const otpElement = document.querySelector(".otp");

  if (!otpElement) {
    return;
  }

  const value = String(otp ?? "").trim();
  otpElement.textContent = "";

  for (const char of value) {
    const otpChar = document.createElement("span");
    otpChar.className = "otp-char";

    if (/\d/.test(char)) {
      otpChar.classList.add("otp-char--number");
    }

    otpChar.textContent = char;
    otpElement.appendChild(otpChar);
  }
}

window.addEventListener("DOMContentLoaded", function () {
  renderOtp(localStorage.getItem("otp"));

  if (typeof loaderManager !== "undefined") {
    loaderManager.hide(200);
  }
});
