1import{a_ as me,b2 as ye,aW as ge,cK as j,bc as we,b9 as f,ci as he,cL as ve,aZ as S,cM as Pe,aY as _,cN as be,cO as Ce,b3 as Le,cP as Se,cQ as _e,cR as Ee,cS as Te,cj as xe}from"./BmkDhhVo.js";import"./B8lHQ1lq.js";import"./CQTxGmQt.js";import"./CEby-PfJ.js";import{E as k}from"./JNfB5aq7.js";import{g as Re}from"./4sncJOGE.js";import{b as Ie,c as Ue,u as Me,d as Ge,e as Ne,p as Oe,a as De,f as Ae,h as Ke,i as Be}from"./BPqASODF.js";import{u as Ye}from"./DCmRDfD4.js";import{u as Ve}from"./Did5O9fY.js";import{u as je}from"./CgzmriOM.js";import{s as ke}from"./Dgw6E_wp.js";import{k as p,r as qe,w as We,j as U}from"./B1uYiZar.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};r.SENTRY_RELEASE={id:"986cca00884a0638cc380a0acfcc65740a0a6c89"};var u=new r.Error().stack;u&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[u]="e1604922-43f4-4a43-b534-d75d3f6895f6",r._sentryDebugIdIdentifier="sentry-dbid-e1604922-43f4-4a43-b534-d75d3f6895f6")}catch{}})();const v=async({encryptKey:r,encryptText:u})=>{const P=(await me(async()=>{const{default:a}=await import("./CC3w6P0A.js");return{default:a}},[],import.meta.url)).default;try{const a=await Ie({key:r.trim().toLowerCase()}),{data:d}=a,E=d||null;if(!E)return null;const b=new P;return b.setPublicKey(E),b.encrypt(u)}catch{return null}},Fe=r=>{if(Ee(r)){const d=new URL(r,window.location.origin).hostname;if(!Te.includes(d))return console.warn("Invalid external URL detected:",r),!1}const u=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/i;return/^(javascript:|data:|vbscript:|file:|about:)/i.test(r)||u.test(r)?(console.warn("Invalid URL detected:",r),!1):!0},He=["/admin/home","/admin/profile","/admin/profile/account","/admin/profile/social","/admin/profile/addressinfo","/login","/register"],ut=(r={})=>{const{getDefaultHomePage:u}=Ye(),{getUserProfileData:P}=Ve(),a=ye(),d=U(()=>a.isMobile),E=U(()=>a.loginMethod),b=U(()=>a.oldLoginInfo),{callbackFn:i,pageSource:N}=r,O=ge(),T=p(null),{query:q,path:W,fullPath:F}=O,{scene:D,redirect_url:H,clientId:J}=q,x=p(null),C=p(d.value?1:E.value),L=p(!1),m=p(null),R=p(null),A=p([]),Q=j(),{geetestID:Z,enableGeetest:z=!0}=Q,{isEnabled:X}=je(),$=U(()=>X("features.auth.enableGeetest",z)),g=p(!1),w=we(),n=qe({email:"",code:"",phoneNumber:"",countryIso2:"US",areaPrefix:"+1",verificationCode:"",userPwd:"",...b.value}),ee=(e={})=>{n.phoneNumber=e.phoneNumber||"",n.areaPrefix=e.areaPrefix||"+1",n.countryIso2=e.countryIso2||"US"};We(()=>b.value,e=>{ee(e||{})},{deep:!0,immediate:!0});const te=async()=>{const e=j(),{deployEnv:t}=e;let s=Se()||[];return s.length||await Re().then(o=>{_e(o.data),s=o.data||[]}),t==="production"&&(s=s.filter(o=>o.countryIso2!=="CN")),s},se=e=>{C.value=e,window.clearInterval(R.value),m.value=null,a.setOldLoginInfo({phoneNumber:"",areaPrefix:"+1",countryIso2:"US"}),n.phoneNumber="",n.areaPrefix="+1",n.countryIso2="US",Le({spmc:C.value?"phone":"email"})},oe=e=>{n.verificationCode=(e==null?void 0:e.verificationCode)||"",B(!0)},M=()=>{n.verificationCode="",g.value=!1},ne=()=>{M()},re=()=>{M()},K=()=>{M(),x.value&&x.value.reset()},B=e=>{T.value.validateField(["phoneNumber"],async t=>{if(t){if(g.value=!0,!n.verificationCode||!e)return x.value.verify(),!1;try{if(await ae({phoneNumber:n.phoneNumber,areaPrefix:n.areaPrefix,validateCode:n.verificationCode,userType:"CREATOR"}))g.value=!1,ie(60);else return g.value=!1,K()}catch{g.value=!1,K()}}})},ae=async e=>{let t=!1;const{phoneNumber:s,areaPrefix:o,countryIso2:l}=n;try{const y=await(N=="login"?Ke:Be)(e),{code:h}=y;h==200?(f.success("Verification code has been sent"),t=!0):t=!1}catch(c){const{code:y,message:h}=c;y=="100000075"?(k.confirm("This mobile phone number has already been registered. Would you like to log in directly using this number?","Message",{confirmButtonText:"Yes",showCancelButton:!1,type:"warning"}).then(()=>{a.setOldLoginInfo({phoneNumber:s,areaPrefix:o,countryIso2:l}),d.value?_("/login"):(a.setLoginMethod(1),i==null||i(S.LOGIN))}),t=!1):y=="100000076"?(k.confirm("The mobile phone number has not been registered yet. Do you want to register MyyShop account with this mobile phone number?","Message",{confirmButtonText:"Yes",showCancelButton:!1,type:"warning"}).then(()=>{a.setOldLoginInfo({phoneNumber:s,areaPrefix:o,countryIso2:l}),d.value?_("/register"):(a.setLoginMethod(1),i==null||i(S.REGISTER))}),t=!1):y=="100000077"?(f.error(h||"The SMS sending triggered frequency control restrictions."),t=!1):(f.error(h||"Failed to send the verification code"),t=!1),t=!1}return t},ie=e=>{m.value=e,R.value=ke(()=>{m.value=--m.value,m.value===0&&(clearInterval(R.value),window.clearInterval(R.value),m.value=null)},1e3)},ce=e=>{const t=A.value.find(s=>
1s.countryIso2===e)||{};n.areaPrefix=t.areaPrefix||"+1"},le=async()=>{const e=await v({encryptText:n.userPwd,encryptKey:n.email.trim()}),t={username:n.email.trim(),password:e,grant_type:"password",scope:"all"};G(t)},ue=e=>{const t={code:e,grant_type:"pin_code",scope:"all"};J===be.tiktoker&&w.setUserType(Ce.tiktoker),G(t)},G=async e=>{const t=xe(e);De(t).then(async s=>{const{data:o}=s;Y(o)}).catch(async s=>{const{code:o,message:l,data:c={}}=s;return[401,403].includes(s.status)&&w.logoutLocal(),o==10001008||o==10001013?(f.warning(l||"Error"),i==null||i(S.CLOSE),await _({path:"/regActivated",query:{email:(e==null?void 0:e.username)||(c==null?void 0:c.email)}})):o!==10000045&&f.error(l||"Error"),!1}).finally(()=>{L.value=!1})},de=e=>e?["/restrict"].includes(e)?"/admin/home":e:"",Y=async e=>{let t="";a.setLoginMethod(0),w.setToken(e==null?void 0:e.access_token,e==null?void 0:e.expires_in);const s=await he({credential:e==null?void 0:e.access_token}),o=s==null?void 0:s.userId,l=(s==null?void 0:s.redirectUrl)||"";ve(o),i==null||i(S.CLOSE),w.setUserInfo(s);const c=await Ge({userId:o});if(w.setUserFeatureSwitch((c==null?void 0:c.data)||[]),!He.includes(O.path))try{await P()}catch{console.log("getUserProfileData error")}const y=await Ne(),{data:h}=y||{};h?t=l||de(H)||(Pe(W)?F:"")||u():t="/onboarding",Fe(t)||(t=u()),window.location.replace(t)},I=()=>"10086",fe=async e=>{const t=await v({encryptText:e.newPwd.trim(),encryptKey:I()});let s=!0;return await Oe({...e,newPwd:t}).then(()=>{f.success("You've successfully changed your password!"),_({path:"/login"})}).catch(o=>{o.code===100000012&&_({path:"/pwdActivated",query:{email:e.email}})}).finally(()=>{s=!1}),s},pe=async()=>{const e=n.email.trim().toLowerCase(),t=await v({encryptText:n.userPwd,encryptKey:e}),s={sceneCode:D||"",email:e,userPwd:t,userType:w.userType};Ae(s).then(o=>{o.data&&o.code==200&&(i==null||i(S.VERIFYEMAIL,n.email))}).finally(()=>{L.value=!1})},V=async()=>{const e={sceneCode:D||"",username:n.phoneNumber,password:n.code,areaPrefix:n.areaPrefix,grant_type:"verification_code",smsType:N=="login"?"LOGIN":"REGISTER"};G(e)};return{getCountryList:te,handleUsePhone:se,formRef:T,isMobile:d,isPhone:C,btnLoading:L,sendCode:B,times:m,changeCountry:ce,countryList:A,geetestID:Z,enableGeetest:$,onGeetestSuccess:oe,geetestRef:x,ruleForm:n,submitForm:()=>{T.value.validate(e=>{if(e)L.value=!0,C.value?V():pe();else return console.log("error submit!"),!1})},loginSubmitForm:()=>{T.value.validate(e=>{if(e)L.value=!0,C.value?V():le();else return console.log("error submit!"),!1})},pinCodeLogin:ue,resetPwdSubmit:fe,loginSuceessCallBack:Y,updatePwdSubmit:async e=>{const t=await v({encryptText:e.newPwd.trim(),encryptKey:I()}),s=await v({encryptText:e.oldPwd.trim(),encryptKey:I()});return new Promise((o,l)=>{Me({newPwd:t,oldPwd:s}).then(()=>{f.success("success"),o()}).catch(c=>{l(c)})})},createPwdSubmit:async e=>{const t=await v({encryptText:e.newPwd.trim(),encryptKey:I()});return new Promise((s,o)=>{Ue({password:t}).then(()=>{f.success("You've successfully create a password!"),s()}).catch(l=>{o(l)})})},sendBtnLoading:g,onGeetestClose:ne,onGeetestError:re}};export{ut as u};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.