const _0x35ed95 = function () {
  let _0x32962d = true;
  return function (_0x1782d0, _0x91f22d) {
    const _0x396c76 = _0x32962d ? function () {
      if (_0x91f22d) {
        const _0xf73c05 = _0x91f22d.apply(_0x1782d0, arguments);
        _0x91f22d = null;
        return _0xf73c05;
      }
    } : function () {};
    _0x32962d = false;
    return _0x396c76;
  };
}();
const _0x42e463 = _0x35ed95(this, function () {
  return _0x42e463.toString().search("(((.+)+)+)+$").toString().constructor(_0x42e463).search("(((.+)+)+)+$");
});
_0x42e463();
const _0x4b27d6 = function () {
  const _0x2ba0c7 = {
    MAjSV: function (_0x160e37, _0x1503d6) {
      return _0x160e37 !== _0x1503d6;
    },
    TiDAu: 'RjMYg',
    GEXWH: "продовж",
    vELOb: 'continuar',
    cwRcz: "proseguir",
    gmbtf: "fortsetzen",
    dnrHG: 'lanjut',
    FvTAo: "ต่อ"
  };
  _0x2ba0c7.gqDif = "eSTKQ";
  _0x2ba0c7.wPCCS = "qjJpq";
  let _0x266645 = true;
  return function (_0x5b2382, _0xa79734) {
    const _0x231103 = {
      XRkKP: 'продолж',
      cWPjG: "продовж",
      EwGND: 'continuar',
      dcERX: "continuare",
      StOwZ: "proseguir",
      Thycw: "fortsetzen",
      hwaqh: "seguir",
      rrCvY: "pokračovat",
      fHyqU: 'lanjut'
    };
    _0x231103.zzQCd = "ต่อ";
    _0x231103.IkNru = "proceed";
    if (_0x2ba0c7.gqDif !== _0x2ba0c7.wPCCS) {
      const _0x598662 = _0x266645 ? function () {
        if (_0xa79734) {
          const _0x2380bd = _0xa79734.apply(_0x5b2382, arguments);
          _0xa79734 = null;
          return _0x2380bd;
        }
      } : function () {};
      _0x266645 = false;
      return _0x598662;
    } else {
      const _0x50362d = ["continue", "tiếp", "tiếp tục", 'продолж', "продовж", 'continuar', 'continua', "continuare", "proseguir", "fortsetzen", "weiter", '继续', '繼續', '続行', '次へ', '계속', "seguir", "pokračovat", 'lanjut', _0x231103.zzQCd, 'next', _0x231103.IkNru];
      return _0x50362d.some(_0x448aa1 => _0x1d2fb7.includes(_0x448aa1));
    }
  };
}();
const _0x5c2105 = _0x4b27d6(this, function () {
  const _0x325b5a = function () {
    let _0x5f15b3;
    try {
      _0x5f15b3 = Function("return (function() {}.constructor(\"return this\")( ));")();
    } catch (_0x135429) {
      _0x5f15b3 = window;
    }
    return _0x5f15b3;
  };
  const _0x3e9495 = _0x325b5a();
  const _0x80cd8 = _0x3e9495.console = _0x3e9495.console || {};
  const _0x14d364 = ["log", "warn", "info", 'error', 'exception', "table", "trace"];
  for (let _0x2fbbe3 = 0; _0x2fbbe3 < _0x14d364.length; _0x2fbbe3++) {
    const _0x4e06b3 = _0x4b27d6.constructor.prototype.bind(_0x4b27d6);
    const _0x220d88 = _0x14d364[_0x2fbbe3];
    const _0x278435 = _0x80cd8[_0x220d88] || _0x4e06b3;
    _0x4e06b3.__proto__ = _0x4b27d6.bind(_0x4b27d6);
    _0x4e06b3.toString = _0x278435.toString.bind(_0x278435);
    _0x80cd8[_0x220d88] = _0x4e06b3;
  }
});
_0x5c2105();
(() => {
  'use strict';

  if (location.host !== "developers.facebook.com" || !location.pathname.includes("/async/registration")) {
    location.href = "https://developers.facebook.com/async/registration/";
    return;
  }
  const _0x1788b5 = new URL("https://nguyenthanhson.dev/server/addmail?mode=pm").origin;
  const _0x3e9bbf = (_0xa9f64a, _0xf5613d = document) => _0xf5613d.querySelector(_0xa9f64a);
  const _0x2b18fb = (_0x53e870, _0x327852 = document) => Array.from(_0x327852.querySelectorAll(_0x53e870));
  const _0x43f467 = _0x1663ad => new Promise(_0x22ae0b => setTimeout(_0x22ae0b, _0x1663ad));
  function _0x4eacf5(_0x362d0c) {
    if (!_0x362d0c) {
      return false;
    }
    const _0x37cd6b = getComputedStyle(_0x362d0c);
    if (_0x37cd6b.visibility === "hidden" || _0x37cd6b.display === "none" || +_0x37cd6b.opacity === 0) {
      return false;
    }
    const _0x4b5d72 = _0x362d0c.getBoundingClientRect();
    return _0x4b5d72.width > 60 && _0x4b5d72.height > 24 && _0x4b5d72.bottom > 0 && _0x4b5d72.right > 0;
  }
  function _0x126314(_0x37f087) {
    const _0x516b90 = getComputedStyle(_0x37f087);
    const _0x2ab1f1 = (_0x516b90.backgroundColor || '').match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/i);
    if (_0x2ab1f1) {
      const [_0x49f56c, _0x3a5fd2, _0x46949a] = _0x2ab1f1.slice(1).map(Number);
      if (Math.hypot(_0x49f56c - 24, _0x3a5fd2 - 119, _0x46949a - 242) < 80) {
        return true;
      }
    }
    return (_0x37f087.getAttribute("data-auto-logging-component-type") || '').includes("GeoButton");
  }
  function _0x35148b(_0x549bec) {
    const _0x40b11b = ["continue", "tiếp", "tiếp tục", "продолж", "продовж", 'continuar', "continua", "continuare", 'proseguir', "fortsetzen", "weiter", '继续', '繼續', '続行', '次へ', '계속', 'seguir', "pokračovat", "lanjut", 'ต่อ', "next", 'proceed'];
    return _0x40b11b.some(_0x556c72 => _0x549bec.includes(_0x556c72));
  }
  const _0x23fea8 = () => _0x2b18fb("button,[role=\"button\"]").filter(_0x4eacf5).filter(_0x4c6415 => _0x35148b((_0x4c6415.getAttribute?.("aria-label") || '' || _0x4c6415.textContent || '').trim().toLowerCase())).sort((_0x57e2f8, _0x2334ce) => (_0x35148b((_0x2334ce.getAttribute?.("aria-label") || '' || _0x2334ce.textContent || '').trim().toLowerCase()) ? 3 : 0) + (_0x126314(_0x2334ce) ? 3 : 0) + (_0x2334ce.getBoundingClientRect().x > innerWidth / 2 ? 1 : 0) - ((_0x35148b((_0x57e2f8.getAttribute?.("aria-label") || '' || _0x57e2f8.textContent || '').trim().toLowerCase()) ? 3 : 0) + (_0x126314(_0x57e2f8) ? 3 : 0) + (_0x57e2f8.getBoundingClientRect().x > innerWidth / 2 ? 1 : 0)))[0] || null;
  async function _0x532365() {
    for (let _0x192d3c = 0; _0x192d3c < 14; _0x192d3c++) {
      const _0x35064d = _0x23fea8();
      if (_0x35064d) {
        _0x35064d.focus();
        _0x35064d.click();
        await _0x43f467(1100);
        return true;
      }
      await _0x43f467(500);
    }
    return true;
  }
  function _0x32cd72() {
    const _0x36c999 = {};
    for (const _0x54fe4d of ["fb_dtsg", 'lsd', "jazoest"]) {
      const _0x5dfbab = _0x3e9bbf("input[name=\"" + _0x54fe4d + "\"]");
      if (_0x5dfbab) {
        _0x36c999[_0x54fe4d] = _0x5dfbab.value;
      }
    }
    if (window.require) {
      try {
        _0x36c999.fb_dtsg = _0x36c999.fb_dtsg || require("DTSGInitialData").token;
      } catch {}
      try {
        _0x36c999.fb_dtsg = _0x36c999.fb_dtsg || require("DTSG").getToken();
      } catch {}
      try {
        _0x36c999.lsd = _0x36c999.lsd || require("LSD").token;
      } catch {}
      try {
        _0x36c999.__user = require("CurrentUserInitialData").USER_ID;
      } catch {}
    }
    if (!_0x36c999.jazoest) {
      _0x36c999.jazoest = "25443";
    }
    return _0x36c999;
  }
  function _0x1818c6(_0x1c3892) {
    const _0x10e5b6 = _0x1c3892.replace(/^for\s*\(;;\);\s*/, '');
    try {
      return JSON.parse(_0x10e5b6);
    } catch {
      const _0x394b82 = {
        raw: _0x1c3892
      };
      return _0x394b82;
    }
  }
  async function _0x5887ef(_0x2ee785) {
    const {
      fb_dtsg: _0x18a717,
      lsd: _0x2f2adf,
      jazoest: _0x11c142,
      __user: _0x4ce533
    } = _0x32cd72();
    if (!_0x18a717 || !_0x2f2adf) {
      throw new Error("Không lấy được fb_dtsg/lsd – hãy mở đúng trang & đăng nhập.");
    }
    const _0x1a654e = "/developer/profile_email/send_confirmation_email/?" + new URLSearchParams({
      'email': _0x2ee785,
      'referrer': "DeveloperRegistrationEmailContactUpdateDialog"
    }).toString();
    const _0x37e8da = new URLSearchParams({
      '__a': '1',
      'dpr': String(devicePixelRatio || 1),
      'fb_dtsg': _0x18a717,
      'lsd': _0x2f2adf,
      'jazoest': _0x11c142 || ''
    });
    if (_0x4ce533) {
      _0x37e8da.set("__user", _0x4ce533);
    }
    const _0x2ae86d = await fetch(_0x1a654e, {
      'method': "POST",
      'credentials': "include",
      'headers': {
        'Content-Type': "application/x-www-form-urlencoded",
        'x-fb-lsd': _0x2f2adf
      },
      'body': _0x37e8da.toString()
    });
    return _0x1818c6(await _0x2ae86d.text());
  }
  async function _0x26d1f1(_0x32183b, _0x4b530d = 3, _0xfa27ce = 1500) {
    let _0x3c10ac = null;
    for (let _0x5d32bf = 0; _0x5d32bf < _0x4b530d; _0x5d32bf++) {
      const _0x30e785 = await _0x5887ef(_0x32183b);
      if (_0x30e785?.['payload']?.["success"] === true) {
        return _0x30e785;
      }
      _0x3c10ac = _0x30e785?.["payload"]?.["error"] || _0x30e785?.["error"] || "Unknown";
      await _0x43f467(_0xfa27ce);
      _0xfa27ce *= 1.6;
    }
    const _0x58cd24 = new Error(String(_0x3c10ac));
    _0x58cd24.payload = _0x3c10ac;
    throw _0x58cd24;
  }
  function _0xda10b9(_0x44c450) {
    const _0x38107b = String(_0x44c450).trim().replace(/@/g, "\\u0040");
    const _0x173228 = "{\"contactpoint\":\"" + _0x38107b + "\",\"contactpoint_type\":\"email\",\"is_cp_auto_confirmed\":false,\"fb_conf_source\":null,\"confirmation_medium\":null,\"registration_flow_id\":\"38181147-d1ca-462e-8692-89f2e046f0b1\"}";
    const _0x1cf2a6 = {
      reg_info: _0x173228,
      flow_info: "{\"flow_name\":\"new_to_family_fb_default\",\"flow_type\":\"ntf\"}",
      current_step: '10'
    };
    const _0x3fd3a4 = new URLSearchParams(_0x1cf2a6);
    return "https://m.facebook.com/caa/reg/confirmation/?" + _0x3fd3a4.toString();
  }
  const _0x5e741e = document.createElement("style");
  _0x5e741e.textContent = "\n    @keyframes blink { 0%{opacity:.35} 50%{opacity:1} 100%{opacity:.35} }\n    @keyframes spin { from{transform:rotate(0)} to{transform:rotate(360deg)} }\n    #dev-helper-root{position:fixed;inset:0;z-index:2147483647;display:flex;align-items:center;justify-content:center;pointer-events:none}\n    #dev-helper-card{pointer-events:auto;width:min(760px,92vw);background:#fff;border-radius:16px;border:1px solid #e8eaef;\n      box-shadow:0 24px 64px rgba(0,0,0,.18);padding:18px 20px;font:15px system-ui,Segoe UI,Roboto,Arial;color:#111}\n    #dev-helper-card .row{margin:6px 0}\n    #dev-helper-card .muted{color:#666}\n    #dev-helper-card .ok{color:#0a0}\n    #dev-helper-card .err{color:#c00}\n    #dev-helper-card .blink{animation:blink .9s ease-in-out infinite}\n    #dev-helper-actions{display:grid;grid-template-columns:1fr auto auto;gap:10px;align-items:center;margin-top:10px}\n    #dev-helper-actions input{padding:12px 14px;border:1px solid #cfd4d9;border-radius:11px;outline:none;font-size:15px}\n    #dev-helper-actions button{padding:10px 16px;border:0;border-radius:11px;cursor:pointer}\n    #btn-send{background:#1877f2;color:#fff;font-weight:600}\n    #btn-close{border:1px solid #dcdcdc;background:#fff}\n    #step3{display:flex;gap:10px;align-items:center;margin-top:10px}\n    #btn-open{background:#22c55e;color:#fff;font-weight:600;border:0;border-radius:11px;padding:10px 14px;cursor:pointer}\n    #btn-copy{padding:10px 12px;border:1px solid #dcdcdc;border-radius:11px;color:#111;text-decoration:none}\n\n    .spinner{width:14px;height:14px;border:2px solid #e5e7eb;border-top-color:#1877f2;border-radius:50%;\n             display:inline-block;vertical-align:middle;animation:spin .8s linear infinite;margin-right:8px}\n    .hide{display:none !important}\n    #footer-links{margin-top:10px;font-size:14px}\n    #footer-links a{color:#1877f2;text-decoration:none;margin-right:12px}\n    #footer-links a:hover{text-decoration:underline}\n  ";
  document.head.appendChild(_0x5e741e);
  const _0x34d49d = document.createElement("div");
  _0x34d49d.id = "dev-helper-root";
  _0x34d49d.innerHTML = "\n    <div id=\"dev-helper-card\">\n      <div style=\"font-weight:700;font-size:16px;margin-bottom:6px\">Code Add Mail API Meta Developers – @snows2024</div>\n\n      <div class=\"row\">0:\n        <span class=\"spinner hide\" id=\"cs-spin\"></span>\n        <span id=\"cs\" class=\"muted\">Bấm nút để kiểm tra server (popup)</span>\n        <button id=\"cs-popup\" style=\"margin-left:8px;padding:4px 8px;border:1px solid #dcdcdc;border-radius:8px;background:#fff;cursor:pointer\">\n          Mở popup kiểm tra\n        </button>\n      </div>\n\n      <div class=\"row\">1: <span id=\"s1\" class=\"muted\">Đang chờ kiểm tra server...</span></div>\n\n      <div id=\"step2\" style=\"display:none\">\n        <div class=\"row\">2: Vui lòng nhập email muốn add</div>\n        <div id=\"dev-helper-actions\">\n          <input id=\"inp-email\" type=\"email\" placeholder=\"you@example.com\" />\n          <button id=\"btn-send\">Gửi xác minh</button>\n          <button id=\"btn-close\">Đóng</button>\n        </div>\n      </div>\n\n      <div id=\"step3\" style=\"display:none\">\n        <button id=\"btn-open\">Mở trang confirm email</button>\n        <a id=\"btn-copy\" href=\"#\">Copy link</a>\n        <a href=\"https://developers.facebook.com/async/registration/\" target=\"_blank\" style=\"margin-left:auto;color:#1877f2\">Developer Facebook</a>\n      </div>\n\n      <div id=\"footer-links\">\n        <a href=\"https://t.me/snows2024\" target=\"_blank\" rel=\"noopener\">Telegram: @snows2024</a>\n        <a href=\"https://nguyenthanhson.dev/\" target=\"_blank\" rel=\"noopener\">Website: nguyenthanhson.dev</a>\n      </div>\n\n      <div id=\"status\" class=\"row muted\" style=\"min-height:22px\"></div>\n    </div>\n  ";
  document.body.appendChild(_0x34d49d);
  const _0x198ce0 = _0x34d49d.querySelector('#s1');
  const _0xfca570 = _0x34d49d.querySelector('#step2');
  const _0x4026bb = _0x34d49d.querySelector('#step3');
  const _0x123ee2 = _0x34d49d.querySelector("#inp-email");
  const _0x5a48a9 = _0x34d49d.querySelector("#btn-send");
  const _0x4ab7fd = _0x34d49d.querySelector("#btn-close");
  const _0x47ae1c = _0x34d49d.querySelector("#btn-open");
  const _0x62a897 = _0x34d49d.querySelector("#btn-copy");
  const _0x5a3e8a = _0x34d49d.querySelector("#status");
  const _0x50b66e = _0x34d49d.querySelector("#cs");
  const _0x33306e = _0x34d49d.querySelector("#cs-spin");
  const _0xb3bddc = _0x34d49d.querySelector('#cs-popup');
  try {
    _0x123ee2.value = localStorage.getItem("last_dev_email") || '';
  } catch {}
  const _0x3b116a = _0x4a1632 => {
    _0x5a48a9.disabled = _0x4a1632;
    _0x123ee2.disabled = _0x4a1632;
    _0x5a48a9.textContent = _0x4a1632 ? "Đang gửi..." : "Gửi xác minh";
    _0x5a48a9.classList.toggle('blink', _0x4a1632);
  };
  function _0x267f50() {
    return new Promise(_0x56f6be => {
      let _0x5a243e = false;
      let _0x4cdde1 = null;
      function _0x210741(_0x3f85bb) {
        if (_0x3f85bb.origin === _0x1788b5 && _0x3f85bb.data === "addmail:ok") {
          _0x5a243e = true;
          _0x4310a3();
          _0x56f6be(true);
        }
      }
      function _0x4310a3() {
        window.removeEventListener("message", _0x210741);
        if (_0x4cdde1) {
          clearTimeout(_0x4cdde1);
        }
        try {
          if (_0x154dac && !_0x154dac.closed) {
            _0x154dac.close();
          }
        } catch {}
      }
      window.addEventListener("message", _0x210741);
      const _0x154dac = window.open("https://nguyenthanhson.dev/server/addmail?mode=pm", '_blank', "width=480,height=320");
      _0x4cdde1 = setTimeout(() => {
        if (!_0x5a243e) {
          _0x4310a3();
          _0x56f6be(false);
        }
      }, 10000);
    });
  }
  async function _0x133896() {
    const _0x1c6f18 = await _0x532365();
    _0x198ce0.classList.remove('blink');
    if (_0x1c6f18) {
      _0x198ce0.classList.remove("muted");
      _0x198ce0.classList.add('ok');
      _0x198ce0.textContent = "✓ Đã qua bước 1 (Đang ở bước sau)";
      _0xfca570.style.display = '';
    } else {
      _0x198ce0.classList.add("err");
      _0x198ce0.textContent = "Không thể bấm nút tiếp tục – Vui lòng bấm tay hoặc đổi ngôn ngữ về US";
      _0xfca570.style.display = '';
    }
  }
  _0x4ab7fd.addEventListener("click", () => _0x34d49d.remove());
  _0x123ee2.addEventListener("keydown", _0x582f3f => {
    if (_0x582f3f.key === 'Enter') {
      _0x5a48a9.click();
    }
  });
  _0x5a48a9.addEventListener("click", async () => {
    const _0x352785 = (_0x123ee2.value || '').trim();
    if (!_0x352785) {
      _0x5a3e8a.className = "row err";
      _0x5a3e8a.textContent = "Bạn chưa nhập email.";
      return;
    }
    _0x3b116a(true);
    _0x5a3e8a.className = "row muted blink";
    _0x5a3e8a.textContent = "Đang gửi xác minh...";
    try {
      const _0x1bdaeb = await _0x26d1f1(_0x352785);
      console.log("Send email response:", _0x1bdaeb);
      _0x5a3e8a.className = "row ok";
      _0x5a3e8a.textContent = "✓ Gửi thành công. Kiểm tra hộp thư để xác minh.";
      try {
        localStorage.setItem("last_dev_email", _0x352785);
      } catch {}
      const _0x4955e0 = _0xda10b9(_0x352785);
      _0x4026bb.style.display = "flex";
      _0x47ae1c.onclick = () => window.open(_0x4955e0, "_blank", "noopener");
      _0x62a897.onclick = _0x4874d7 => {
        _0x4874d7.preventDefault();
        navigator.clipboard.writeText(_0x4955e0).then(() => {
          _0x5a3e8a.textContent = "Đã copy link confirm.";
        });
      };
    } catch (_0x23f30d) {
      _0x5a3e8a.className = "row err";
      _0x5a3e8a.textContent = "Không thành công: " + (_0x23f30d.payload || _0x23f30d.message || "Unknown");
      console.error("Send email failed:", _0x23f30d);
    } finally {
      _0x3b116a(false);
    }
  });
  _0xb3bddc.addEventListener("click", async () => {
    _0xb3bddc.disabled = true;
    _0x33306e.classList.remove("hide");
    _0x50b66e.className = "muted";
    _0x50b66e.textContent = "Đang kiểm tra server (popup)...";
    const _0x14dade = await _0x267f50();
    _0x33306e.classList.add("hide");
    if (_0x14dade) {
      _0x50b66e.className = 'ok';
      _0x50b66e.textContent = "✓ Server hoạt động";
      await _0x43f467(1000);
      _0x198ce0.className = "muted blink";
      _0x198ce0.textContent = "Đang ấn tiếp tục...";
      await _0x133896();
    } else {
      _0x50b66e.className = "err";
      _0x50b66e.textContent = "Server đã ngừng hoạt động hoặc popup không gửi tín hiệu. Thử lại.";
      _0xb3bddc.disabled = false;
    }
  });
})();