import{a as e}from"./index-n5dZU89t.js";const t="docking_user_cache_v1:",a=t=>e.post({url:"/api/docking/auth/register",data:t}),o=()=>e.get({url:"/api/docking/auth/config",skipUnauthorizedHandler:!0}),r=()=>e.get({url:"/api/docking/auth/captcha",params:{_t:Date.now()}}),n=(t,a)=>e.post({url:"/api/docking/auth/sendMobileCode",data:{mobile:t,captcha_key:a}}),i=(t,a)=>e.post({url:"/api/docking/auth/sendEmailCode",data:{email:t,captcha_key:a}}),s=t=>e.post({url:"/api/docking/auth/resetPassword",data:t}),c=t=>e.post({url:"/api/docking/auth/login",data:t}),g=e=>{e&&localStorage.removeItem(t+e)},l=()=>{const e=localStorage.getItem("docking_token");g(e)},u=a=>{const o=localStorage.getItem("docking_token");if(!!(null==a?void 0:a.forceRefresh))g(o);else{const e=(e=>{if(!e)return null;const a=localStorage.getItem(t+e);if(!a)return null;try{const e=JSON.parse(a);if(Date.now()-e.t<6e4)return e.d}catch(o){localStorage.removeItem(t+e)}return null})(o);if(e)return Promise.resolve(e)}return e.get({url:"/api/docking/user/info",headers:{Authorization:o?`Bearer ${o}`:""},skipUnauthorizedHandler:!0}).then(e=>(e&&o&&((e,a)=>{if(e)try{localStorage.setItem(t+e,JSON.stringify({t:Date.now(),d:a}))}catch(o){localStorage.removeItem(t+e)}})(o,e),e))},d=t=>{const a=localStorage.getItem("docking_token");return e.post({url:"/api/docking/user/updateProfile",data:t,headers:{Authorization:a?`Bearer ${a}`:""}})},k=t=>{const a=localStorage.getItem("docking_token");return e.post({url:"/api/docking/user/changePassword",data:t,headers:{Authorization:a?`Bearer ${a}`:""}})},h=t=>{const a=localStorage.getItem("docking_token");return e.post({url:"/api/docking/user/changeAccount",data:t,headers:{Authorization:a?`Bearer ${a}`:""}})},p=t=>{const a=localStorage.getItem("docking_token");return e.post({url:"/api/docking/user/recharge",data:t,headers:{Authorization:a?`Bearer ${a}`:""}})},m=()=>{const t=localStorage.getItem("docking_token");return e.get({url:"/api/docking/user/paymentMethods",headers:{Authorization:t?`Bearer ${t}`:""}})},S=t=>{const a=localStorage.getItem("docking_token");return e.get({url:"/api/docking/user/orders",params:t,headers:{Authorization:a?`Bearer ${a}`:""}})},_=t=>{const a=localStorage.getItem("docking_token");return e.get({url:"/api/docking/user/balance_logs",params:t,headers:{Authorization:a?`Bearer ${a}`:""}})};export{u as a,r as b,l as c,k as d,h as e,n as f,o as g,s as h,a as i,S as j,_ as k,c as l,m,p as r,i as s,d as u};
