"use strict";(self["webpackChunkaida"]=self["webpackChunkaida"]||[]).push([[2933,2698],{12698:function(t,e,a){a.r(e),a.d(e,{default:function(){return l}});var i=a(66252),s=a(49963);const n={id:"app"},r={class:"captcha"},o=["onUpdate:modelValue","onInput","onKeydown","disabled"];function h(t,e,a,h,u,c){return(0,i.wg)(),(0,i.iD)("div",n,[(0,i._)("div",r,[((0,i.wg)(!0),(0,i.iD)(i.HY,null,(0,i.Ko)(t.getCtData,((a,n)=>(0,i.wy)(((0,i.wg)(),(0,i.iD)("input",{key:n,type:"number","onUpdate:modelValue":e=>t.getCtData[n]=e,ref_for:!0,ref:"input",onInput:e=>{t.onInput(e.target.value,n)},onKeydown:(0,s.D2)((e=>{t.onKeydown(e.target.value,n)}),["delete"]),onFocus:e[0]||(e[0]=(...e)=>t.onFocus&&t.onFocus(...e)),disabled:t.loading},null,40,o)),[[s.nr,t.getCtData[n]]]))),128))])])}var u=(0,i.aZ)({props:["ct"],data(){return{loading:!1}},computed:{getCtData(){return this.ct},ctSize(){return this.getCtData.length},cIndex(){let t=this.getCtData.findIndex((t=>""===t));return t=(t+this.ctSize)%this.ctSize,t},lastCode(){return this.getCtData[this.ctSize-1]}},watch:{cIndex(){this.resetCaret()},lastCode(t,e){t&&t!=e&&(this.$refs.input[this.ctSize-1].blur(),this.sendCaptcha())}},mounted(){this.resetCaret()},methods:{onInput(t,e){if(t=t.replace(/\D/g,""),e==this.ctSize-1)this.getCtData[this.ctSize-1]=t[0];else if(t.length>1){let a=e;for(a=e;a<this.ctSize&&a-e<t.length;a++)this.getCtData[a]=t[a];this.resetCaret()}else t+""||(this.getCtData[e]="")},resetCaret(){this.$refs.input[this.ctSize-1].focus()},onFocus(){let t=this.getCtData.findIndex((t=>""===t));t=(t+this.ctSize)%this.ctSize,this.$refs.input[t].focus()},onKeydown(t,e){""===t&&e>0&&(this.getCtData[e-1]="",this.$refs.input[e-1].focus())},sendCaptcha(){let t=this.getCtData.map((t=>t)).join("");this.$emit("sendCaptcha",t)},reset(){this.getCtData=this.getCtData.map((t=>"")),this.resetCaret()}}}),c=a(83744);const d=(0,c.Z)(u,[["render",h],["__scopeId","data-v-3866a989"]]);var l=d}}]);