var te=Object.defineProperty,se=Object.defineProperties;var ie=Object.getOwnPropertyDescriptors;var H=Object.getOwnPropertySymbols;var ne=Object.prototype.hasOwnProperty,ae=Object.prototype.propertyIsEnumerable;var V=(p,l,u)=>l in p?te(p,l,{enumerable:!0,configurable:!0,writable:!0,value:u}):p[l]=u,T=(p,l)=>{for(var u in l||(l={}))ne.call(l,u)&&V(p,u,l[u]);if(H)for(var u of H(l))ae.call(l,u)&&V(p,u,l[u]);return p},A=(p,l)=>se(p,ie(l));var C=(p,l,u)=>new Promise((W,L)=>{var o=y=>{try{S(u.next(y))}catch(t){L(t)}},f=y=>{try{S(u.throw(y))}catch(t){L(t)}},S=y=>y.done?W(y.value):Promise.resolve(y.value).then(o,f);S((u=u.apply(p,l)).next())});import{l as q,ab as oe,W as z,T as G,aH as Z,w as J,__tla as re}from"./index-f0df2f76.js";import{aR as ce,bb as le}from"./antd-057b41b1.js";import{d as K,r as Q,k as N,e as $,w as U,s as ue,f as h,u as g,ac as de}from"./vue-1631514e.js";let Y,ee,ge=Promise.all([(()=>{try{return re}catch(p){}})()]).then(()=>C(void 0,null,function*(){const{t:p}=q(),l={value:{type:Boolean,default:!1},isSlot:{type:Boolean,default:!1},text:{type:[String],default:p("component.verify.dragText")},successText:{type:[String],default:p("component.verify.successText")},height:{type:[Number,String],default:40},width:{type:[Number,String],default:220},circle:{type:Boolean,default:!1},wrapStyle:{type:Object,default:()=>({})},contentStyle:{type:Object,default:()=>({})},barStyle:{type:Object,default:()=>({})},actionStyle:{type:Object,default:()=>({})}},u=A(T({},l),{src:{type:String},imgWidth:{type:Number,default:260},imgWrapStyle:{type:Object,default:()=>({})},minDegree:{type:Number,default:90},maxDegree:{type:Number,default:270},diffDegree:{type:Number,default:20}}),W=K({name:"BaseDargVerify",props:l,emits:["success","update:value","change","start","move","end"],setup(o,{emit:f,slots:S,expose:y}){const t=Q({isMoving:!1,isPassing:!1,moveDistance:0,toLeft:!1,startTime:0,endTime:0}),s=N(null),b=N(null),M=N(null),P=N(null);oe({el:document,name:"mouseup",listener:()=>{t.isMoving&&w()}});const X=$(()=>{const{height:e,actionStyle:n}=o,r=`${parseInt(e)}px`;return T({left:0,width:r,height:r},n)}),F=$(()=>{const{height:e,width:n,circle:r,wrapStyle:i}=o,c=parseInt(e);return T({width:`${parseInt(n)}px`,height:`${c}px`,lineHeight:`${c}px`,borderRadius:r?c/2+"px":0},i)}),j=$(()=>{const{height:e,circle:n,barStyle:r}=o,i=parseInt(e);return T({height:`${i}px`,borderRadius:n?i/2+"px 0 0 "+i/2+"px":0},r)}),B=$(()=>{const{height:e,width:n,contentStyle:r}=o,i=`${parseInt(e)}px`,c=`${parseInt(n)}px`;return T({height:i,width:c},r)});U(()=>t.isPassing,e=>{if(e){const{startTime:n,endTime:r}=t,i=(r-n)/1e3;f("success",{isPassing:e,time:i.toFixed(1)}),f("update:value",e),f("change",e)}}),ue(()=>{t.isPassing=!!o.value});function I(e){return e.pageX||e.touches[0].pageX}function R(e){if(t.isPassing)return;const n=g(P);n&&(f("start",e),t.moveDistance=I(e)-parseInt(n.style.left.replace("px",""),10),t.startTime=new Date().getTime(),t.isMoving=!0)}function a(e){const n=parseInt(e.style.width),{width:r}=o,i=parseInt(r);return{offset:i-n-6,widthNum:i,actionWidth:n}}function d(e){const{isMoving:n,moveDistance:r}=t;if(n){const i=g(P),c=g(b);if(!i||!c)return;const{offset:v,widthNum:_,actionWidth:O}=a(i),x=I(e)-r;f("move",{event:e,moveDistance:r,moveX:x}),x>0&&x<=v?(i.style.left=`${x}px`,c.style.width=`${x+O/2}px`):x>v&&(i.style.left=`${_-O}px`,c.style.width=`${_-O/2}px`,o.isSlot||D())}}function m(e){const{isMoving:n,isPassing:r,moveDistance:i}=t;if(n&&!r){f("end",e);const c=g(P),v=g(b);if(!c||!v)return;const _=I(e)-i,{offset:O,widthNum:x,actionWidth:k}=a(c);_{if(!o.value)w();else{const E=g(M);E&&(E.style.width=`${parseInt(v.style.width)}px`)}},0):w():(c.style.left=`${x-k}px`,v.style.width=`${x-k/2}px`,D()),t.isMoving=!1}}function D(){if(o.isSlot){w();return}t.endTime=new Date().getTime(),t.isPassing=!0,t.isMoving=!1}function w(){t.isMoving=!1,t.isPassing=!1,t.moveDistance=0,t.toLeft=!1,t.startTime=0,t.endTime=0;const e=g(P),n=g(b),r=g(M);!e||!n||!r||(t.toLeft=!0,z(()=>{t.toLeft=!1,e.style.left="0",n.style.width="0"},300),r.style.width=g(B).width)}return y({resume:w}),()=>{const e=()=>{const i=["darg-verify-bar"];return t.toLeft&&i.push("to-left"),h("div",{class:i,ref:b,style:g(j)},null)},n=()=>{const i=["darg-verify-content"],{isPassing:c}=t,{text:v,successText:_}=o;return c&&i.push("success"),h("div",{class:i,ref:M,style:g(B)},[G(S,"text",c)||(c?_:v)])},r=()=>{const i=["darg-verify-action"],{toLeft:c,isPassing:v}=t;return c&&i.push("to-left"),h("div",{class:i,onMousedown:R,onTouchstart:R,style:g(X),ref:P},[G(S,"actionIcon",v)||(v?h(ce,{class:"darg-verify-action__icon"},null):h(le,{class:"darg-verify-action__icon"},null))])};return h("div",{class:"darg-verify",ref:s,style:g(F),onMousemove:d,onTouchmove:d,onMouseleave:m,onMouseup:m,onTouchend:m},[e(),n(),r()])}}}),L=K({name:"ImgRotateDragVerify",inheritAttrs:!1,props:u,emits:["success","change","update:value"],setup(o,{emit:f,attrs:S,expose:y}){const t=N(null),s=Q({showTip:!1,isPassing:!1,imgStyle:{},randomRotate:0,currentRotate:0,toOrigin:!1,startTime:0,endTime:0,draged:!1}),{t:b}=q();U(()=>s.isPassing,a=>{if(a){const{startTime:d,endTime:m}=s,D=(m-d)/1e3;f("success",{isPassing:a,time:D.toFixed(1)}),f("change",a),f("update:value",a)}});const M=$(()=>{const{imgWrapStyle:a,imgWidth:d}=o;return T({width:`${d}px`,height:`${d}px`},a)}),P=$(()=>{const{minDegree:a,maxDegree:d}=o;return a===d?Math.floor(1+Math.random()*1)/10+1:1});function X(){s.startTime=new Date().getTime()}function F(a){s.draged=!0;const{imgWidth:d,height:m,maxDegree:D}=o,{moveX:w}=a,e=Math.ceil(w/(d-parseInt(m))*D*g(P));s.currentRotate=e,s.imgStyle=Z("transform",`rotateZ(${s.randomRotate-e}deg)`)}function j(){const{minDegree:a,maxDegree:d}=o,m=Math.floor(a+Math.random()*(d-a));s.randomRotate=m,s.imgStyle=Z("transform",`rotateZ(${m}deg)`)}function B(){const{randomRotate:a,currentRotate:d}=s,{diffDegree:m}=o;Math.abs(a-d)>=(m||20)?(s.imgStyle=Z("transform",`rotateZ(${a}deg)`),s.toOrigin=!0,z(()=>{s.toOrigin=!1,s.showTip=!0},300)):I(),s.showTip=!0}function I(){s.isPassing=!0,s.endTime=new Date().getTime()}function R(){s.showTip=!1;const a=g(t);a&&(s.isPassing=!1,a.resume(),j())}return y({resume:R}),()=>{const{src:a}=o,{toOrigin:d,isPassing:m,startTime:D,endTime:w}=s,e=[];d&&e.push("to-origin");const n=(w-D)/1e3;return h("div",{class:"ir-dv"},[h("div",{class:"ir-dv-img__wrap",style:g(M)},[h("img",{src:a,onLoad:j,width:parseInt(o.width),class:e,style:s.imgStyle,onClick:()=>{R()},alt:"verify"},null),s.showTip&&h("span",{class:["ir-dv-img__tip",s.isPassing?"success":"error"]},[s.isPassing?b("component.verify.time",{time:n.toFixed(1)}):b("component.verify.error")]),!s.showTip&&!s.draged&&h("span",{class:["ir-dv-img__tip","normal"]},[b("component.verify.redoTip")])]),h(W,de({class:"ir-dv-drag__bar",onMove:F,onEnd:B,onStart:X,ref:t},T(T({},S),o),{value:m,isSlot:!0}),null)])}}});Y=J(W),ee=J(L)}));export{Y as B,ee as R,ge as __tla};