1import{hN as R,bA as $,ci as F,a as W,b as ee,rG as te,rH as re,aQ as ne,ii as oe,e0 as se}from"./commonChunk.Dhe5lqYh.js";import{a as i}from"./enum.BEBvq45N.js";import{dm as ie}from"./0_EntryLoginRegisterChunk.CH23XrmN.js";import{w as J,d as ae,r as A,c as w,D as H,n as ce}from"../vendors/vendor-stable.B8ub4Ug6.js";import{useComplianceCheck as le}from"./index.D54SUN5b.js";import{t as K}from"./vendorChunk.BdsO83GQ.js";import"../vendors/vendor-swiper.T_wbf2QY.js";const x=["mousemove","click","keydown","scroll","touchstart"],ue=1e3;function me(E,u){let m,a,f=!1;const L=()=>{m&&(clearTimeout(m),m=void 0)},d=()=>{L();const n=E.timeout.value;n<=0||(m=setTimeout(()=>{u(),d()},n))},p=()=>{a||(a=setTimeout(()=>{a=void 0},ue),d())},N=()=>{x.forEach(n=>{document.addEventListener(n,p,{passive:!0})})},h=()=>{x.forEach(n=>{document.removeEventListener(n,p)}),a&&(clearTimeout(a),a=void 0)},g=()=>{f||(f=!0,N(),d())},s=()=>{f&&(f=!1,L(),h())};return J(E.enabled,n=>{n?g():s()},{immediate:!0}),{start:g,stop:s,reset:d}}const Te=ae("intelligent-recharge",()=>{const E=[R.Normal,R.Demo,R.Promote,R.NormalMember],u=A(),m=A(),a=$(),f=le(),L=F(),d=A(),p=A(),N=A(""),h=W(),g=ee();let s;const n=w(()=>{var T,y,I;const t=((T=h.systemInfos)==null?void 0:T.rechargeSmartPopupScenes)||"",e=Number(((y=h.systemInfos)==null?void 0:y.rechargeSmartHallStayTime)||0),r=(I=h.systemInfos)==null?void 0:I.rechargeSmartPopupConditions;if(!t)return;let o=t.split(",").map(l=>l.trim()).filter(Boolean);e||(o=o.filter(l=>l!==i.STAY));let c=[];try{typeof r=="string"?c=JSON.parse(r):Array.isArray(r)&&(c=r)}catch(l){console.error("SmartRecharge parse config error:",l)}const G=c.filter(Boolean).map(l=>({currency:l.currencyCode,amount:Number(l.term)}));return{enable:{value:!!o.length,[i.LOGIN]:o.includes(i.LOGIN),[i.BACK_TO_LOBBY]:o.includes(i.BACK_TO_LOBBY),[i.STAY]:o.includes(i.STAY)},options:{scenes:o,stayTime:e,thresholds:G}}}),Q=()=>{var o;if(!((o=n.value)!=null&&o.options.thresholds)||!g.userInfos||!se().isGameScoreSettled)return!1;const t=g.userInfos.currency,e=Number(g.userInfos.game_gold||0),r=n.value.options.thresholds.find(c=>c.currency===t);return!!(r&&e<=r.amount)},_=()=>{var t,e;return!(!g.hasLoginedComponent||!E.includes((t=g.userInfos)==null?void 0:t.account_type)||!((e=n.value)!=null&&e.enable.value))},O=async t=>{var e,r,o,c;if(_()&&(e=n.value)!=null&&e.enable[t]&&Q()&&!((r=a.stateMap.intelligentRecharge)!=null&&r.visible)&&!((o=a.stateMap.recharge)!=null&&o.visible)&&(c=u.value)!=null&&c.showDlg&&L.route.name!==ne.LOGIN_REGISTER_UPGRADE_GUIDE){if(oe()){a.close("intelligentRecharge");return}f.getIsInComplianceFlow()||(m.value=t,await a.open("intelligentRecharge",{openType:"insert"}))}};let S;const b=()=>_()?S||(S=K(te()).then(([t,e])=>{if(!t&&e){let r={};try{r=e!=null&&e.activeList?JSON.parse(e.activeList):{}}catch(o){}u.value={...e,registerSuccessInfo:r},j()}else u.value=void 0}).finally(()=>{S=void 0}),S):Promise.resolve(),j=async()=>{var G,T,y,I,l,D,M,P,Y,k,U;let t=[],e="0";const r=(T=(G=u.value)==null?void 0:G.registerSuccessInfo)==null?void 0:T.activeList;if(r!=null&&r.length){let v=r[0];for(const V of r)((y=V.rule)==null?void 0:y.condVal)<((I=v.rule)==null?void 0:I.condVal)&&(v=V);p.value=v;const B=(D=(l=v.rule)==null?void 0:l.pay_type)!=null?D:[];t=B.length===1&&B[0]===0?[]:B,e=String((P=(M=v.rule)==null?void 0:M.condVal)!=null?P:"")}const[o,c]=await K(ie({payTypeIds:t,rechargeScore:e,calMode:re.RECOMMEND}));if(!o&&c){d.value=c.data.data;const v=(U=(k=(Y=d.value)==null?void 0:Y.recommendMoneyGiftList)==null?void 0:k[0])==null?void 0:U.amount;v&&(N.value=v)}},q={enabled:w(()=>{var t,e;return!!((t=n.value)!=null&&t.enable[i.STAY])&&!!((e=u.value)!=null&&e.showDlg)}),timeout:w(()=>{var t,e;return((e=(t=n.value)==null?void 0:t.options.stayTime)!=null?e:0)*60*1e3})},C=me(q,()=>O(i.STAY)),z=()=>{C.reset(),O(i.BACK_TO_LOBBY)},X=async()=>{if(C.reset(),await b(),await ce(),s==null||s(),s=void 0,!f.getIsInComplianceFlow()){await O(i.LOGIN);return}s=f.watchComplianceFlow((t,e)=>{!t&&e&&(s==null||s(),s=void 0,O(i.LOGIN))})},Z=()=>{const t=m.value===i.LOGIN;return m.value=void 0,t};return J(()=>_(),t=>{t?b():u.value=void 0},{immediate:!0}),H(()=>{s==null||s()}),H(C.stop),{idle:C,value:u,config:n,fetch:b,gameLogout:z,loginSuccess:X,consumeLoginDownloadFollowup:Z,payChannelInfo:d,minActiveItem:p,selectedRecommendAmount:N}});export{Te as useIntelligentRechargeStore};
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.