1var D=Object.defineProperty;var F=(o,e,r)=>e in o?D(o,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[e]=r;var u=(o,e,r)=>F(o,typeof e!="symbol"?e+"":e,r);import{h as N,H as U,qP as C,bA as H,hK as A,by as T,bz as b,K as x,z as K,uZ as W,ah as M,u_ as O,u$ as q,n as V,v0 as J,u as Z,v1 as Q,i2 as Y,bd as R,b as X,fJ as ee,v2 as te,v3 as re,v4 as se,bK as E}from"./commonChunk.BIjOjUCX.js";import{w as $,l as ie,e as c,f as I,b as k,c as L}from"./helper.GG_7Pckc.js";import{D as l,v as f}from"../vendors/vendor-stable.BZTOV27i.js";import"./vendorChunk.B6ure_9S.js";class _{static _createTimeout(){let e;return{withTimeout:s=>{const i=()=>new Promise(a=>{e=window.setTimeout(()=>{a([{type:c.Timeout,error:`timeoutError: ${this._timeout}ms`},void 0])},this._timeout)});return Promise.race([i(),s])},closeTimeout:()=>{window.clearTimeout(e),e=void 0}}}static async _createRiskRetryLoading(){const{t:e}=N(),r=await U.loading({message:()=>e("lobby.common.components.geetest.autoSwitching"),duration:3e4,overlay:!0},"overlay");C.set("closeRiskRetryLoading",r.close)}static _clearRiskRetryLoading(){var e;(e=C.get("closeRiskRetryLoading"))==null||e(),C.set("closeRiskRetryLoading",void 0)}static _dialogError(e){H("RESPONSE_ERROR").emit({message:()=>{const{t:r}=N();return[r("lobby.common.components.geetest.error"),e].join(`\r 2`)}})}static _reportError(e,r){const{type:t,dialogMessage:s,error:i}=e;$({event:A.VerificationError,firm:r,type:t,message:i}),s!==!1&&this._dialogError(s)}static _reportTime(e){$({...e,event:A.VerificationTime})}static async _load(e){const[r]=await ie(e);if(r){const t=r.message,s=r.url,i=`${t}; urls<${s}>`;return[{type:c.Load,error:i,dialogMessage:t},void 0]}return[null,void 0]}static _getSymbol(e,r){return l(e,r)}static _codeIncludes(e,r){return e.includes(r)}static async _trigger(e,r,t){var m,g,p;const s="x-behavior",i=!!l(r.headers,s),{msg:a}=T(e);if(!a){const w="No Msg:captchaId";return t.reportError({type:c.Err,error:w,dialogMessage:w},!0),{}}this.Timeout=this._createTimeout();const[n,d]=await this.Timeout.withTimeout(t.validate(a,r));if(this.Timeout.closeTimeout(),n!=null&&n.error)return n.type===c.Close?{geeTestError:n.error}:i?(setTimeout(()=>{this._clearRiskRetryLoading(),t.reportError(n,!0)},1e3),{geeTestError:n.error}):(t.reportError(n,!1),(m=t.onFirstError)==null||m.call(t,n),r.headers||f(r,"headers",{}),f(r.headers,s,t.behaviorValue),this._createRiskRetryLoading(),{geeTestError:n.error,retry:!0});this._clearRiskRetryLoading();let h=(g=this._getSymbol(r,t.symbolKey))!=null?g:0;return++h,f(r,t.symbolKey,h),(p=t.onSuccess)==null||p.call(t,r,d),{retry:!0}}}u(_,"_timeout",2e4),u(_,"Timeout");class S extends _{static log(...e){x.info("@risk","cf@1",...e)}static get domId(){return"_turnstile"}static get uuid(){return K().uuid}static get lang(){return W("Cloudflare",M().language,"en")}static reportError(e,r=!1){this.log("Error",e);const t=r?e.dialogMessage:!1;this._reportError({...e,dialogMessage:t},I.Cloudflare)}static reportTime(e){this.log("Time",e),this._reportTime({...e,firm:I.Cloudflare})}static onClose(){turnstile==null||turnstile.remove(),this.getElement().remove()}static getElement(){let e=document.getElementById(this.domId);return e||(e=document.createElement("div"),e.id=this.domId,e.className=`ui-overlay ${O.FixedNoDesktop}`,e.style.zIndex="2147483646",e)}static load(){return this._load({id:"cf",src:"https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit",globalFn:k.Turnstile,log:this.log})}static setup(e,r,t){return new Promise(s=>{try{let i=document.getElementById(this.domId);i||(i=this.getElement(),document.body.append(i)),i.onclick=()=>{this.onClose(),s([{type:c.Close,error:"closed"},void 0])},turnstile.render(i,{sitekey:e,theme:"light",size:"normal",retry:"auto",language:this.lang,appearance:"always",callback:a=>{this.log(a),s([null,a]),this.onClose()},"expired-callback":()=>{this.log("callback:expired"),this.onClose(),s([{type:c.Err,error:"token expired"},void 0])},"error-callback":a=>{this.log("callback:error",a),this.onClose(),["300010","600010"].includes(a)?(q(),s([{type:c.Err,error:a,dialogMessage:!1},void 0])):s([{type:c.Err,error:a,dialogMessage:a},void 0])},"timeout-callback":()=>{this.log("callback:timeout"),this.onClose(),s([{type:c.Err,error:"timeout"},void 0])},"before-interactive-callback":()=>{var a;this.log("callback:before-interactive"),(a=this.Timeout)==null||a.closeTimeout(),t()},"after-interactive-callback":()=>{this.log("callback:after-interactive")},"unsupported-callback":()=>{this.log("callback:unsupported"),this.onClose(),s([{type:c.Err,error:"unsupported",dialogMessage:"unsupported"},void 0])}}),r(),this._clearRiskRetryLoading()}catch(i){const a=`turnstile.render: ${i}`;s([{type:c.Err,error:a,dialogMessage:a},void 0])}})}static async validate(e){this.log("Use","Cf");const r=performance.now(),[t]=await this.load(),s=performance.now();if(t)return[t,void 0];let i=performance.now(),a=performance.now();const[n,d]=await this.setup(e,()=>i=performance.now(),()=>a=performance.now()),h=performance.now();if(n)return[n,void 0];const m={load:s-r,init:i-s,render:a-i,vaild:h-a};return this.reportTime(L(m)),[null,d]}static codeIncludes(e){return this._codeIncludes(this.codes,e)}
2static hasAbort(e){return this.codeIncludes(T(e).code)}static async trigger(e,r){return this._trigger(e,r,{validate:t=>this.validate(t),onSuccess:(t,s)=>{t.headers||f(t,"headers",{}),f(t.headers,"captcha",s)},symbolKey:this.symbolKey,behaviorValue:3,reportError:(t,s)=>this.reportError(t,s)})}}u(S,"symbolKey","_cfSymbol"),u(S,"codes",[b.TURNSTILE]);const ae=o=>V.request({url:"/api/member/geetest/validate/v4",method:"post",data:o},{oss:{enable:!1},token:{type:"staticOnly"}}),oe=o=>V.request({url:"/api/member/user/geetest/validate/v4",method:"post",data:o},{oss:{enable:!1}});class v extends _{static log(...e){x.info("@risk","gt@4",...e)}static get domId(){return"geetest"}static get uuid(){return K().uuid}static get lang(){return l(J,M().language)}static reportError(e,r=!1){this.log("Error",e);const t=r?e.dialogMessage:!1;this._reportError({...e,dialogMessage:t},I.Geetest)}static reportTime(e){this.log("Time",e),this._reportTime({...e,firm:I.Geetest})}static get asiapacific(){const e=Z();return e.siteCode==="1095"||e.siteCode==="032"||e.deployEnv===Q.AsiaPacific}static get config(){const e=Y(),{apiDomain:r}=e.domainListMap,t={geetest:{id:"gt",initName:k.InitGeetest4,sdk:"/libs/rc/[email protected]/gt.js",getType:{apiServers:R.GeetestApiServers}},botion:{id:"botion",initName:k.InitBotion,sdk:"/libs/rc/[email protected]/boc.js",getType:{apiServers:[...R.BotionApiServers,...r.map(s=>`${s}/botion/api`)],staticServers:[...R.BotionStaticServers,...r.map(s=>`${s}/botion/static`)]}}};return this.asiapacific?t.botion:t.geetest}static load(){return this._load({id:this.config.id,src:this.config.sdk,globalFn:this.config.initName,log:this.log})}static initialize(e){return new Promise(r=>{try{const t=l(window,this.config.initName);if(!t)throw new Error(`${this.config.initName} is not defined`);const s={captchaId:e,product:"bind",hideBar:!1,language:this.lang,getType:this.config.getType,onError:i=>{const a=l(i,"code"),n=l(i,"lot_number"),d=l(i,"desc.detail"),h=[a,n,d].filter(Boolean).join(", ");r([{type:c.Init,error:JSON.stringify(i),dialogMessage:h},void 0])}};t(s,i=>r([null,i]))}catch(t){const s="Init Error: Catch",i=`name: ${l(t,"name")||"-"}`,a=`message: ${l(t,"message")||"-"}`,n=`error: ${JSON.stringify(t)}`;r([{type:c.Init,error:[s,i,a,n].join("; ")},void 0])}})}static render(e){return new Promise(r=>{let t=document.getElementById(this.domId);t||(t=document.createElement("div"),t.id=this.domId,document.body.append(t)),e.onNextReady(()=>{var s;try{if(this.expired)return this.log("expired");e.showCaptcha(),(s=this.Timeout)==null||s.closeTimeout(),this.log("close timeout"),r([null,void 0])}catch(i){const a=l(i,"name")||"Render Error",n=l(i,"message")||"";r([{type:c.Render,error:[a,n].join("; ")},void 0])}}).appendTo(`#${this.domId}`)})}static setup(e){return new Promise(r=>{e.onSuccess(()=>{try{r([null,e.getValidate()])}catch(t){e.destroy();const s=`getValidate: ${l(t,"message")||t}`;r([{type:c.Err,error:s,dialogMessage:s},void 0])}}).onClose(()=>{e.destroy(),r([{type:c.Close,error:c.Close},void 0])}).onError(t=>{e.destroy();const s=l(t,"name")||"Captcha Error",i=l(t,"message")||"",a=[s,i].join("; ");r([{type:c.Err,error:a,dialogMessage:a},void 0])})})}static async syncServer(e){const r={...e,mode:this.asiapacific?1:0};try{return X().hasLogined?await oe(r):await ae(r),[null,void 0]}catch(t){const s="Sync Server Error",i=l(t,"name")||"Render Error",a=l(t,"message")||"";return[{type:c.Err,error:[s,i,a].join("; ")},void 0]}}static async validate(e){const{account:r,captchaId:t,referer:s}=e;this.log("Use",this.asiapacific?"Botion":"Geetest");const i=performance.now(),[a]=await this.load(),n=performance.now();if(a)return[a,void 0];const[d,h]=await this.initialize(t),m=performance.now();if(d)return[d,void 0];const[g]=await this.render(h),p=performance.now();if(g)return[g,void 0];const[w,B]=await this.setup(h),G=performance.now();if(w)return[w,void 0];const z=B.captcha_id||t,[P]=await this.syncServer({account:r,referer:s,...B,captcha_id:z});if(P)return[P,void 0];const j={load:n-i,init:m-n,render:p-m,vaild:G-p};return this.reportTime(L(j)),[null,void 0]}static codeIncludes(e){return this._codeIncludes(this.codes,e)}
2static hasAbort(e){return this.codeIncludes(T(e).code)}static async trigger(e,r){return this._trigger(e,r,{validate:(t,s)=>{if(!s.url){const a="No Referer:url";return Promise.resolve([{type:c.Err,error:a,dialogMessage:a},void 0])}this.expired=!1;const i={account:this.uuid,captchaId:t,referer:s.url};return this.validate(i)},onFirstError:t=>{t.type===c.Timeout&&(this.expired=!0)},symbolKey:this.symbolKey,behaviorValue:1,reportError:(t,s)=>this.reportError(t,s)})}}u(v,"symbolKey","_geeSymbol"),u(v,"codes",[b.FORCE_GEETEST,b.SWIPER_PUZZLE_GEETEST,b.GRAPHIC_CLICK_GEETEST,b.NINE_SQUARE_GEETEST]),u(v,"expired",!1);class y extends _{static log(...e){x.info("@risk","hcaptcha",...e)}static get domId(){return"_hCaptcha"}static get domChildId(){return"_hCaptcha_container"}static get lang(){const e=M().language;return e==="zh_hk"?"zh-TW":e}static reportError(e,r=!1){this.log("Error",e);const t=r?e.dialogMessage:!1;this._reportError({...e,dialogMessage:t},I.Hcaptcha)}static reportTime(e){this.log("Time",e),this._reportTime({...e,firm:I.Hcaptcha})}static getElement(){let e=document.getElementById(this.domId);return e||(e=document.createElement("div"),e.id=this.domId,e.style.zIndex="2147483646",e.onclick=()=>{try{hcaptcha.close(this.hcaptchaId)}catch(r){this.onClosed()}},e.innerHTML=`<div id="${this.domChildId}"></div>`,e)}static onOpened(){this._clearRiskRetryLoading();const e=this.getElement();e.className=`ui-overlay ${O.FixedNoDesktop}`,e.style.setProperty("display","")}static onClosed(){const e=this.getElement();e.className="",e.style.display="none"}static load(){return this._load({id:"hcapLoad",src:"/libs/rc/hcaptcha@1/hcaptcha.js",globalFn:k.Hcaptcha,log:this.log})}static polyfill(){var s;const e=(s=document.getElementById(this.domId))==null?void 0:s.clientWidth;if(!e)return;let r=e/580;r=r>1?1:r,r=r<.2?.2:r,ee().device.isMobile&&(r=1);const t=document.getElementById(this.domChildId);t&&(t.style.transform=`scale(${r})`)}static initialize(e,r){return new Promise(t=>{try{if(this.hcaptchaId){if(this.preSitekey===e){this.log("init","use cache"),t([null,this.hcaptchaId]);return}this.log("init","sitekey change run reset"),hcaptcha.reset(this.hcaptchaId),hcaptcha.remove(this.hcaptchaId)}const s=this.getElement();document.body.append(s),this.preSitekey=e,this.hcaptchaId=hcaptcha.render(s,{theme:"light",size:"invisible",sitekey:e,hl:this.lang,"challenge-container":this.domChildId,"open-callback":()=>{var i;this.polyfill(),(i=this.Timeout)==null||i.closeTimeout(),r(),this.onOpened(),this.log("callback","opened")},"close-callback":()=>{this.onClosed(),this.log("callback","closeed")},callback:i=>{this.log("callback","success",i)},"error-callback":i=>{this.log("callback","error",i)},"chalexpired-callback":()=>{this.log("callback","chalexpired"),hcaptcha.close(this.hcaptchaId)},"expired-callback":()=>{this.log("callback","expired"),hcaptcha.close(this.hcaptchaId)}}),t([null,this.hcaptchaId])}catch(s){const i=`hcaptcha.render: ${s}`;t([{type:c.Err,error:i,dialogMessage:i},void 0])}})}static async setup(e){try{const r=await hcaptcha.execute(e,{async:!0});hcaptcha.close();const t=l(r,"response");if(t)return[null,t];const s="success but token is empty";return[{type:c.Err,error:s,dialogMessage:s},void 0]}catch(r){if(r==="challenge-closed")return[{type:c.Close,error:c.Close},void 0];
2const t=l(r,"name"),s=l(r,"message"),i=[t,s].join(": ");return[{type:c.Err,error:i,dialogMessage:i},void 0]}}static async validate(e){this.log("Use","hcaptcha");const r=performance.now(),[t]=await this.load(),s=performance.now();if(t)return[t,void 0];let i=performance.now();const[a,n]=await this.initialize(e,()=>{i=performance.now()}),d=performance.now();if(i<d&&(i=d),a)return[a,void 0];const[h,m]=await this.setup(n),g=performance.now();if(h)return[h,void 0];const p={load:s-r,init:d-s,render:i-d,vaild:g-i};return this.reportTime(L(p)),[null,m]}static codeIncludes(e){return this._codeIncludes(this.codes,e)}static hasAbort(e){return this.codeIncludes(T(e).code)}static async trigger(e,r){return this._trigger(e,r,{validate:t=>this.validate(t),onSuccess:(t,s)=>{t.headers||f(t,"headers",{}),f(t.headers,"captcha",s)},symbolKey:this.symbolKey,behaviorValue:2,reportError:(t,s)=>this.reportError(t,s)})}}u(y,"symbolKey","_hcaptchaSymbol"),u(y,"codes",[b.HCAPTCHA]),u(y,"preSitekey"),u(y,"hcaptchaId");const ue={hasAbort(o){return[v.hasAbort(o),y.hasAbort(o),S.hasAbort(o)].includes(!0)},trigger(o,e){const{code:r}=T(o);return v.codeIncludes(r)?v.trigger(o,e):y.codeIncludes(r)?y.trigger(o,e):S.codeIncludes(r)?S.trigger(o,e):Promise.resolve({})},stats(o,e,r=!1){const{msg:t}=T(o),s=e.url;if(s&&t){let i=[];s.indexOf(te)>=0&&(i=[()=>E.stats("loginStats","statsApi"),()=>E.stats("loginStats","statsBehaviorVerify")]),s.indexOf(re)>=0&&(i=[()=>E.stats("registerStats","statsCheckApi"),()=>E.stats("registerStats","statsBehaviorVerify")]),s.indexOf(se)>=0&&(i=[()=>E.stats("registerStats","statsApi"),()=>E.stats("registerStats","statsBehaviorVerify")]),r&&(i=i.reverse()),i.forEach(a=>a())}},triggerWithStats(o,e){return new Promise(r=>{this.stats(o,e),this.trigger(o,e).then(t=>{this.stats(o,e,!0),r(t)})})}};export{ue as riskBehavior};
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.