TvBox/jav/lib/sessions-6652689d63d9.js

2 lines
14 KiB
JavaScript
Raw Permalink Normal View History

2025-07-03 20:15:22 +08:00
"use strict";(globalThis.webpackChunk=globalThis.webpackChunk||[]).push([["sessions"],{52734:(e,t,n)=>{n.d(t,{Cg:()=>s,R1:()=>m,s:()=>c});var o=n(78134),r=n(21403),i=n(26559);let a="github-mobile-auth-flash";function u(){let e=document.querySelector("#js-flash-container");if(e)for(let t of e.children)!t.classList.contains("js-flash-template")&&t.classList.contains(a)&&e.removeChild(t)}function s(){let e=document.getElementById("github-mobile-authenticate-prompt");e&&(e.hidden=!0);let t=document.getElementById("github-mobile-authenticate-error-and-retry");t&&(t.hidden=!1)}function c(){u();let e=document.getElementById("github-mobile-authenticate-prompt");e&&(e.hidden=!1);let t=document.getElementById("github-mobile-authenticate-error-and-retry");t&&(t.hidden=!0)}function l(e){e&&function(e){let t=new o.i4(document.querySelector("template.js-flash-template"),{className:`flash-error ${a}`,message:e}),n=document.importNode(t,!0),r=document.querySelector("#js-flash-container");r&&(u(),r.appendChild(n))}(e),s()}function d(e){return document.getElementById("github-mobile-authenticate-error-and-retry").getAttribute(e)}async function m(e,t,n,o){try{var r;await (r=e.getAttribute("data-poll-url"),async function e(a){let u,s,c;if(o&&o())return;let m="STATUS_UNKNOWN";try{let e=document.getElementById("github-mobile-authenticate-form"),t=e.querySelector(".js-data-url-csrf"),n=await self.fetch(new Request(r,{method:"POST",body:new FormData(e),mode:"same-origin",headers:{Accept:"application/json","Scoped-CSRF-Token":t.value,...(0,i.kt)()}}));if(n.ok){let e=await n.json();m=e.status,u=e.token}else m="STATUS_ERROR"}catch{m="STATUS_ERROR"}switch(m){case"STATUS_APPROVED":var f;return t?t():void((c=(f=u)?new URL(`password_reset/${encodeURIComponent(f)}`,window.location.origin):new URL("",window.location.href)).searchParams.set("redirect","true"),window.location.assign(c));case"STATUS_EXPIRED":return s=d("timeout-flash"),n?n(s):l(s);case"STATUS_ACTIVE":case"STATUS_ERROR":case"STATUS_UNKNOWN":break;case"STATUS_REJECTED":return s=d("error-flash"),n?n(s):void document.getElementById("github-mobile-rejected-redirect").click();default:return s=d("error-flash"),n?n(s):l(s)}await new Promise(e=>setTimeout(e,3e3)),e(a)}(0))}catch{return l(d("error-flash"))}}(0,r.lB)(".js-poll-github-mobile-two-factor-authenticate",function(e){m(e)}),(0,r.lB)(".js-poll-github-mobile-verified-device-authenticate",function(e){m(e)}),(0,r.lB)(".js-poll-github-mobile-two-factor-password-reset-authenticate",function(e){m(e)})},68551:(e,t,n)=>{var o=n(8367),r=n(21403);(0,r.lB)(".js-transform-notice",{constructor:HTMLElement,add(e){for(let t of(0,o.OR)("org_transform_notice")){let n=document.createElement("span");try{n.textContent=atob(decodeURIComponent(t.value)),(0,o.Yj)(t.key),e.appendChild(n),e.hidden=!1}catch{}return}}});var i=n(97797),a=n(36175),u=n(12559),s=n(97325);(0,u.JW)(".js-send-auth-code",async(e,t)=>{let n;document.body.classList.add("is-sending"),document.body.classList.remove("is-sent","is-not-sent");try{n=await t.text()}catch(e){!function(e){e&&(document.querySelector(".js-sms-error").textContent=e),document.body.classList.add("is-not-sent"),document.body.classList.remove("is-sending")}(e.response.text)}n&&(document.body.classList.add("is-sent"),document.body.classList.remove("is-sending"))}),(0,u.JW)(".js-two-factor-set-sms-fallback",async(e,t)=>{let n;try{n=await t.text()}catch(r){let t=e.querySelector(".js-configure-sms-fallback"),n=e.querySelector(".js-verify-sms-fallback"),o=(t.hidden?n:t).querySelector(".flash");switch(r.response.status){case 404:case 422:case 429:o.textContent=JSON.parse(r.response.text).error,o.hidden=!1}}if(n)switch(n.status){case 200:case 201:window.location.reload();break;case 202:e.querySelector(".js-configure-sms-fallback").hidden=!0,e.querySelector(".js-verify-sms-fallback").hidden=!1,e.querySelector(".js-fallback-otp").focus()}}),(0,a.eC)(".js-verification-code-input-auto-submit",function(e){let t=e.currentTarget,n=t.pattern||"[0-9]{6}";RegExp(`^(${n})$`).test(t.value)&&(0,s.k_)(t.form)}),(0,i.on)("click",".js-toggle-redacte
//# sourceMappingURL=sessions-c3d32e6abb6e.js.map