import{i as r,g as B,d as w,_ as I,s as F}from"./index-EwE51S_X.js";import{d as S,v as T,r as V,x as g,e as s,f as l,i,t as p,u,ae as j,F as _,B as k,m as L,G as y,n as N,p as R,l as $,j as z,af as D}from"./vue-A59npLRR.js";const x=o=>(R("data-v-c6505233"),o=o(),$(),o),E=["id"],G={key:0,class:"loading"},M={key:1,class:"captcha-img-box"},P=["src","alt"],U=["onClick"],X={key:2,class:"captcha-prompt"},Y={key:3,class:"captcha-prompt"},q={class:"captcha-refresh-box"},A=x(()=>i("div",{class:"captcha-refresh-line captcha-refresh-line-l"},null,-1)),H=["title"],J=x(()=>i("div",{class:"captcha-refresh-line captcha-refresh-line-r"},null,-1)),K=S({__name:"index",props:{uuid:{default:""},callback:{type:Function,default:()=>{}},class:{default:""},unset:{type:Boolean,default:!1},error:{default:r.global.t("validate.The correct area is not clicked, please try again!")},success:{default:r.global.t("validate.Verification is successful!")}},setup(o){T(a=>({d12e9cce:C.value,"384b94fa":b.value,"91648b58":t.captcha.width,"189a9659":t.captcha.height}));const e=o,t=V({loading:!0,xy:[],tip:"",captcha:{id:"",text:"",base64:"",width:350,height:200}}),n=()=>{t.loading=!0,B(e.uuid).then(a=>{t.xy=[],t.tip="",t.loading=!1,t.captcha=a.data})},m=a=>{if(t.xy.length{t.tip=e.success,setTimeout(()=>{var c;(c=e.callback)==null||c.call(e,h),f()},1500)}).catch(()=>{t.tip=e.error,setTimeout(()=>{n()},1500)})}},v=a=>{t.xy.splice(a,1)},f=()=>{var a;(a=document.getElementById(e.uuid))==null||a.remove()},b=g(()=>(t.captcha.height+200)/2+"px"),C=g(()=>(t.captcha.width+24)/2+"px");return n(),(a,h)=>(s(),l("div",{id:a.uuid},[i("div",{class:y(["ba-click-captcha",e.class])},[t.loading?(s(),l("div",G,p(u(r).global.t("utils.Loading")),1)):(s(),l("div",M,[i("img",{class:"captcha-img",onClick:h[0]||(h[0]=j(c=>m(c),["prevent"])),src:t.captcha.base64,alt:u(r).global.t("validate.Captcha loading failed, please click refresh button")},null,8,P),(s(!0),l(_,null,k(t.xy,(c,d)=>(s(),l("span",{key:d,class:"step",onClick:Q=>v(d),style:N(`left:${parseFloat(c.split(",")[0])-13}px;top:${parseFloat(c.split(",")[1])-13}px`)},p(d+1),13,U))),128))])),t.tip?(s(),l("div",X,p(t.tip),1)):(s(),l("div",Y,[L(p(u(r).global.t("validate.Please click"))+" ",1),(s(!0),l(_,null,k(t.captcha.text,(c,d)=>(s(),l("span",{key:d,class:y(t.xy.length>d?"clicaptcha-clicked":"")},p(c),3))),128))])),i("div",q,[A,i("i",{class:"fa fa-refresh captcha-refresh-btn",title:u(r).global.t("Refresh"),onClick:n},null,8,H),J])],2),i("div",{class:"ba-layout-shade",onClick:f})],8,E))}}),O=I(K,[["__scopeId","data-v-c6505233"]]),tt=(o,e,t={})=>{let n=z(O,{uuid:o,callback:e,...t,key:F()});D(n,document.body),n=null};export{tt as c};