Commit da5a81a4 authored by 郑磊's avatar 郑磊

更新语言判断逻辑

parent 535f1b63
......@@ -28,5 +28,5 @@ Expected function or array of functions, received type ${typeof e}.`),oe)}functi
* vue v3.4.27
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/function Ua(){ia()}process.env.NODE_ENV!=="production"&&Ua();const Ka=e=>(Yt("data-v-fcfe5ea2"),e=e(),Xt(),e),Wa={class:"captcha--slider-bar"},za={class:"captcha--slider-bar--bar"},qa=[Ka(()=>B("svg",{class:"captcha--slider-bar--track-icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"4239",width:"64",height:"64"},[B("path",{d:"M576 192v256H0v128h576v256l448-320z","p-id":"4240"})],-1))],Ga=st({__name:"SliderBar",props:{x:{type:Number,default:0}},setup(e){return(t,n)=>(re(),Ve("div",Wa,[B("div",za,[B("div",{class:"captcha--slider-bar--active",style:Me({width:`${e.x}px`})},null,4)]),B("div",{class:"captcha--slider-bar--track",style:Me({transform:`translateX(${e.x}px)`})},qa,4)]))}}),Ye=(e,t)=>{const n=e.__vccOpts||e;for(const[o,r]of t)n[o]=r;return n},Ja=Ye(Ga,[["__scopeId","data-v-fcfe5ea2"]]),fi={en:{验证成功:"Success","验证失败,请再试一次":"Verification failed",验证码已过期:"Expired",拖动下方滑块完成拼图:"Drag the slider to complete the puzzle","网络异常,请点击重试":"Network error, click to retry"},"zh-cn":{验证成功:"验证成功","验证失败,请再试一次":"验证失败,请再试一次",验证码已过期:"验证码已过期",拖动下方滑块完成拼图:"拖动下方滑块完成拼图","网络异常,请点击重试":"网络异常,请点击重试"},"zh-tw":{验证成功:"驗證成功","验证失败,请再试一次":"驗證失敗,請再試一次",验证码已过期:"驗證碼已過期",拖动下方滑块完成拼图:"拖動下方滑塊完成拼圖","网络异常,请点击重试":"網路異常,請點擊重試"}},Ya=Object.keys(fi),Xa="zh-cn";function Za(e){const t=e.split(/_|-/);return t.length>2&&t.splice(1,t.length-2),t.map(n=>n.toLowerCase()).join("-")}function Qa(e){let t=typeof e=="string"&&e?[e]:navigator&&navigator.languages?navigator.languages:[Xa];t=t.map(n=>Za(n));for(let n of t){if(n==="en"||n.startsWith("en-"))return"en";if(Ya.includes(n))return n}return t.some(n=>n==="zh"||n.startsWith("zh-"))?"zh-cn":"en"}function eu(e){return fi[Qa(e)]??{}}function tu(e){const t=eu(e);return n=>t[n]??n}function nu(e,t,n){if(!t&&!n)return e;const o=new URL(e,t);return n&&Object.entries(n).forEach(([r,s])=>o.searchParams.append(r,s)),o.href}function ou(e){const t={};return e.getAllResponseHeaders().split(`
**/function Ua(){ia()}process.env.NODE_ENV!=="production"&&Ua();const Ka=e=>(Yt("data-v-fcfe5ea2"),e=e(),Xt(),e),Wa={class:"captcha--slider-bar"},za={class:"captcha--slider-bar--bar"},qa=[Ka(()=>B("svg",{class:"captcha--slider-bar--track-icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"4239",width:"64",height:"64"},[B("path",{d:"M576 192v256H0v128h576v256l448-320z","p-id":"4240"})],-1))],Ga=st({__name:"SliderBar",props:{x:{type:Number,default:0}},setup(e){return(t,n)=>(re(),Ve("div",Wa,[B("div",za,[B("div",{class:"captcha--slider-bar--active",style:Me({width:`${e.x}px`})},null,4)]),B("div",{class:"captcha--slider-bar--track",style:Me({transform:`translateX(${e.x}px)`})},qa,4)]))}}),Ye=(e,t)=>{const n=e.__vccOpts||e;for(const[o,r]of t)n[o]=r;return n},Ja=Ye(Ga,[["__scopeId","data-v-fcfe5ea2"]]),fi={en:{验证成功:"Success","验证失败,请再试一次":"Verification failed",验证码已过期:"Expired",拖动下方滑块完成拼图:"Drag the slider to complete the puzzle","网络异常,请点击重试":"Network error, click to retry"},"zh-cn":{验证成功:"验证成功","验证失败,请再试一次":"验证失败,请再试一次",验证码已过期:"验证码已过期",拖动下方滑块完成拼图:"拖动下方滑块完成拼图","网络异常,请点击重试":"网络异常,请点击重试"},"zh-tw":{验证成功:"驗證成功","验证失败,请再试一次":"驗證失敗,請再試一次",验证码已过期:"驗證碼已過期",拖动下方滑块完成拼图:"拖動下方滑塊完成拼圖","网络异常,请点击重试":"網路異常,請點擊重試"}},Ya=Object.keys(fi),Xa="zh-cn";function Za(e){const t=e.split(/_|-/);return t.length>2&&t.splice(1,t.length-2),t.map(n=>n.toLowerCase()).join("-")}function Qa(e){let t=typeof e=="string"&&e?[e]:navigator&&navigator.languages?navigator.languages:[Xa];t=t.map(n=>Za(n));for(let n of t){if(n==="en"||n.startsWith("en-"))return"en";if(n==="zh"||n.startsWith("zh-"))return Ya.includes(n)?n:"zh-cn"}return"en"}function eu(e){return fi[Qa(e)]??{}}function tu(e){const t=eu(e);return n=>t[n]??n}function nu(e,t,n){if(!t&&!n)return e;const o=new URL(e,t);return n&&Object.entries(n).forEach(([r,s])=>o.searchParams.append(r,s)),o.href}function ou(e){const t={};return e.getAllResponseHeaders().split(`
`).forEach(n=>{if(n=n.trim(),n==="")return;let[o]=n.split(":");if(o=o.trim(),o==="")return;const r=e.getResponseHeader(o);r!==null&&(t[o]=r)}),t}function di(e){const{url:t,baseURL:n,method:o,params:r,headers:s,data:i,timeout:c,withCredentials:a=!1}=e,u=new XMLHttpRequest;return u.responseType="text",u.withCredentials=a,typeof c=="number"&&(u.timeout=c),new Promise((p,d)=>{u.addEventListener("abort",d),u.addEventListener("error",d),u.addEventListener("timeout",d),u.addEventListener("load",function(){p({status:u.status,headers:ou(u),data:JSON.parse(u.responseText)})}),u.addEventListener("readystatechange",function(){if(u.readyState===XMLHttpRequest.OPENED){if(typeof s=="object"&&s&&Object.entries(s).forEach(([h,b])=>u.setRequestHeader(h,b)),typeof i<"u"&&i!==null){if(typeof i=="string"){u.send(i);return}else if(typeof i=="object"){u.setRequestHeader("Content-Type","application/json"),u.send(JSON.stringify(i));return}}u.send()}}),u.open(o??"GET",nu(t,n,r))})}async function ru(e){for(;;){const t=await di({method:"POST",data:{},...e});if(["SLIDER","ROTATE","CONCAT"].includes(t.data.data.captcha.type))return t.data}}async function su(e){const{data:t,...n}=e;let o;try{o=(await di({...n,method:"POST",data:t})).data}catch{return"验证失败,请再试一次"}if(o.code!==0)return o.code===4e3?"验证码已过期":"验证失败,请再试一次"}function Zo(e){if(e.pageX!==null&&e.pageX!==void 0)return{x:Math.round(e.pageX),y:Math.round(e.pageY)};let t;return e.changedTouches?t=e.changedTouches:e.targetTouches?t=e.targetTouches:e.originalEvent&&e.originalEvent.targetTouches&&(t=e.originalEvent.targetTouches),t[0].pageX!==null&&t[0].pageX!==void 0?{x:Math.round(t[0].pageX),y:Math.round(t[0].pageY)}:{x:Math.round(t[0].clientX),y:Math.round(t[0].clientY)}}function Qo(e){const{triggers:t=[],max:n,onDrag:o,onVerify:r}=e;let s=null,i=[];const c=h=>{s={...Zo(h),startTime:Date.now()},i.push({x:0,y:0,type:"down",t:0}),window.addEventListener("touchmove",a,{passive:!0}),window.addEventListener("mousemove",a,{passive:!0}),window.addEventListener("touchend",u,{passive:!0}),window.addEventListener("mouseup",u,{passive:!0})},a=h=>{if(!s)return;const b=Zo(h);i.push({x:b.x-s.x,y:b.y-s.y,type:"move",t:Date.now()-s.startTime});const S=Math.max(0,Math.min(n,b.x-s.x));o(S)},u=h=>{if(s){if(d(),!i.some(b=>b.type==="move"))i=[];else{const b=Zo(h);i.push({x:b.x-s.x,y:b.y-s.y,type:"up",t:Date.now()-s.startTime}),p(),r({startSlidingTime:new Date(s.startTime).toISOString(),endSlidingTime:new Date().toISOString(),trackList:i})}s=null}},p=()=>{t.forEach(h=>{h.removeEventListener("touchstart",c),h.removeEventListener("mousedown",c)})},d=()=>{window.removeEventListener("touchmove",a),window.removeEventListener("mousemove",a),window.removeEventListener("touchend",u),window.removeEventListener("mouseup",u)};return t.forEach(h=>{h.addEventListener("touchstart",c,{passive:!0}),h.addEventListener("mousedown",c,{passive:!0})}),{destroy:()=>{p(),d()},onDragStart:c}}function iu(e){const{captcha:t,ratio:n,onVerify:o,...r}=e,s=Math.round((t.backgroundImageWidth-t.templateImageWidth)*n);return Qo({...r,captcha:t,max:s,onVerify:i=>{o({...i,bgImageWidth:Math.round(t.backgroundImageWidth*n),bgImageHeight:Math.round(t.backgroundImageHeight*n),sliderImageWidth:Math.round(t.templateImageWidth*n),sliderImageHeight:Math.round(t.templateImageHeight*n)})}})}function cu(e){const{captcha:t,ratio:n,onVerify:o,onDrag:r,max:s,...i}=e;return Qo({...i,captcha:t,max:s,onDrag:c=>r(c,c/s*360),onVerify:c=>{o({...c,bgImageWidth:s,bgImageHeight:Math.round(t.backgroundImageHeight*n),sliderImageWidth:Math.round(t.templateImageWidth*n),sliderImageHeight:Math.round(t.templateImageHeight*n)})}})}function pi(e,t){return Math.round((e.backgroundImageHeight-e.data.randomY)*t)}function lu(e){const{captcha:t,ratio:n,onVerify:o,max:r,...s}=e;return Qo({...s,captcha:t,max:r,onVerify:i=>{o({...i,bgImageWidth:Math.round(t.backgroundImageWidth*n),bgImageHeight:Math.round(t.backgroundImageHeight*n),sliderImageWidth:Math.round(t.backgroundImageWidth*n),sliderImageHeight:pi(t,n)})}})}const hi=Symbol();function au(e){vs(hi,e)}function er(e){return e||(e=rn(hi,()=>fn(()=>{}),!0)),fn(()=>tu(e.value))}const gi=e=>(Yt("data-v-4b782e10"),e=e(),Xt(),e),uu=gi(()=>B("svg",{class:"captcha--status-tip--icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"5407",width:"64",height:"64"},[B("path",{d:"M896 512a384 384 0 1 0-768 0 384 384 0 0 0 768 0zM42.666667 512C42.666667 252.8 252.8 42.666667 512 42.666667s469.333333 210.133333 469.333333 469.333333-210.133333 469.333333-469.333333 469.333333S42.666667 771.2 42.666667 512z m652.501333-158.165333l60.330667 60.330666L469.333333 700.330667l-200.832-200.832 60.330667-60.330667L469.333333 579.669333l225.834667-225.834666z","p-id":"5408"})],-1)),fu=gi(()=>B("svg",{class:"captcha--status-tip--icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"6383",width:"64",height:"64"},[B("path",{d:"M575.986694 832.039919C575.986694 867.356032 547.316113 896.026613 512 896.026613 476.683887 896.026613 448.013306 867.356032 448.013306 832.039919 448.013306 796.723806 476.683887 768.048156 512 768.048156 547.316113 768.048156 575.986694 796.64777 575.986694 832.039919ZM512 255.997465C476.683887 255.997465 448.013306 284.668046 448.013306 319.984159L448.013306 639.998733C448.013306 675.314846 476.683887 703.990496 512 703.990496 547.316113 703.990496 575.986694 675.314846 575.986694 639.998733L575.986694 319.984159C575.986694 284.668046 547.316113 255.997465 512 255.997465ZM1023.979724 896.026613C1023.979724 966.729805 966.709529 1024.005069 896.006336 1024.005069L127.993664 1024.005069C57.290471 1024.005069 0.020276 966.658839 0.020276 896.026613 0.020276 874.868373 5.216059 854.931776 14.39105 837.311737L14.320083 837.24077 398.250384 69.304133 398.392317 69.304133C419.626593 28.133261 462.455047 0.040552 512 0.040552 561.544953 0.040552 604.373407 28.209297 625.67865 69.3751L1008.311272 834.711311C1018.348003 852.838256 1023.979724 873.783595 1023.979724 896.026613ZM959.99303 896.026613C959.99303 885.123073 957.392604 874.868373 952.191753 865.404445L951.613881 864.319667 951.112044 863.239958 568.621355 98.405584C557.499847 77.171308 535.834701 64.027246 512 64.027246 488.023365 64.027246 466.282184 77.318311 455.160675 98.765487L452.12938 104.544211 92.175714 824.527578 92.677551 825.034483 71.154339 866.778159C66.389426 875.948082 64.00697 885.842879 64.00697 896.097579 64.00697 931.413692 92.748517 960.089342 127.993664 960.089342L896.006336 960.089342C931.322449 960.013306 959.99303 931.342726 959.99303 896.026613Z","p-id":"6384"})],-1)),du=Ye(st({__name:"StatusTip",props:{status:{type:Boolean,required:!0},message:{type:String}},setup(e){const t=er();return(n,o)=>(re(),Ve("div",{class:_t(`captcha--status-tip captcha--status-tip--${e.status?"success":"fail"}`)},[e.status?(re(),Ve(ge,{key:0},[uu,B("div",null,yn(xe(t)("验证成功")),1)],64)):(re(),Ve(ge,{key:1},[fu,B("div",null,yn(xe(t)(e.message??"验证失败,请再试一次")),1)],64))],2))}}),[["__scopeId","data-v-4b782e10"]]),pu={class:"captcha--view"},hu={class:"captcha--view--tip"},gu={class:"captcha--view--content"},tr=Ye(st({__name:"CaptchaViewContainer",props:{verifyStatus:{type:Object},x:{type:Number,default:0}},setup(e){const t=er();return(n,o)=>(re(),Ve("div",pu,[B("div",hu,yn(xe(t)("拖动下方滑块完成拼图")),1),B("div",gu,[gl(n.$slots,"default",{},void 0),me(Go,{name:"captcha--status-tip"},{default:Zt(()=>[e.verifyStatus?(re(),Je(du,Mi(js({key:0},e.verifyStatus)),null,16)):Pt("",!0)]),_:1})]),me(Ja,{x:e.x},null,8,["x"])]))}}),[["__scopeId","data-v-ef209593"]]),mu=["src"],_u=Ye(st({__name:"ConcatCaptcha",props:{captcha:{type:Object,required:!0},verifyStatus:{type:Object}},emits:["verify"],setup(e,{emit:t}){const n=t,o=e,r=280/o.captcha.backgroundImageWidth,s=ye(0),i=fn(()=>pi(o.captcha,r)),c=lu({captcha:o.captcha,ratio:r,max:225,onDrag:a=>s.value=a,onVerify:a=>n("verify",a)});return tn(()=>c.destroy()),(a,u)=>(re(),Je(tr,{class:"captcha--view--concat",verifyStatus:e.verifyStatus,x:s.value,onTouchstart:xe(c).onDragStart,onMousedown:xe(c).onDragStart},{default:Zt(()=>[B("img",{src:e.captcha.backgroundImage,class:"captcha--view--concat--bg"},null,8,mu),B("div",{class:"captcha--view--concat--track",style:Me({height:`${i.value}px`,backgroundImage:`url('${e.captcha.backgroundImage}')`,backgroundPositionX:`${s.value}px`})},null,4)]),_:1},8,["verifyStatus","x","onTouchstart","onMousedown"]))}}),[["__scopeId","data-v-fd603259"]]),vu=["src"],Eu=["src"],yu=Ye(st({__name:"RotateCaptcha",props:{captcha:{type:Object,required:!0},verifyStatus:{type:Object}},emits:["verify"],setup(e,{emit:t}){const n=t,o=e,r=ye(0),s=ye(0),i=280/o.captcha.backgroundImageWidth,c=cu({captcha:o.captcha,ratio:i,max:225,onDrag:(a,u)=>{r.value=a,s.value=u},onVerify:a=>n("verify",a)});return tn(()=>c.destroy()),(a,u)=>(re(),Je(tr,{class:"captcha--view--rotate",verifyStatus:e.verifyStatus,x:r.value,onTouchstart:xe(c).onDragStart,onMousedown:xe(c).onDragStart},{default:Zt(()=>[B("img",{src:e.captcha.backgroundImage,class:"captcha--view--rotate--bg"},null,8,vu),B("img",{src:e.captcha.templateImage,class:"captcha--view--rotate--track",style:Me({transform:`rotate(${s.value}deg)`})},null,12,Eu)]),_:1},8,["verifyStatus","x","onTouchstart","onMousedown"]))}}),[["__scopeId","data-v-76bb4af9"]]),Nu=["src"],bu=["src"],Ou=Ye(st({__name:"SliderCaptcha",props:{captcha:{type:Object,required:!0},verifyStatus:{type:Object}},emits:["verify"],setup(e,{emit:t}){const n=t,o=e,r=280/o.captcha.backgroundImageWidth,s=ye(0),i=iu({captcha:o.captcha,ratio:r,onDrag:c=>{s.value=c},onVerify:c=>n("verify",c)});return tn(()=>i.destroy()),(c,a)=>(re(),Je(tr,{class:"captcha--view--slider",verifyStatus:e.verifyStatus,x:s.value,onTouchstart:xe(i).onDragStart,onMousedown:xe(i).onDragStart},{default:Zt(()=>[B("img",{src:e.captcha.backgroundImage,class:"captcha--view--slider--bg"},null,8,Nu),B("img",{src:e.captcha.templateImage,class:"captcha--view--slider--track",style:Me({transform:`translateX(${s.value}px)`})},null,12,bu)]),_:1},8,["verifyStatus","x","onTouchstart","onMousedown"]))}}),[["__scopeId","data-v-8fb0f971"]]),wu=(e=>(Yt("data-v-6ba70e16"),e=e(),Xt(),e))(()=>B("svg",{class:"captcha--error--icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"6383",width:"64",height:"64"},[B("path",{d:"M575.986694 832.039919C575.986694 867.356032 547.316113 896.026613 512 896.026613 476.683887 896.026613 448.013306 867.356032 448.013306 832.039919 448.013306 796.723806 476.683887 768.048156 512 768.048156 547.316113 768.048156 575.986694 796.64777 575.986694 832.039919ZM512 255.997465C476.683887 255.997465 448.013306 284.668046 448.013306 319.984159L448.013306 639.998733C448.013306 675.314846 476.683887 703.990496 512 703.990496 547.316113 703.990496 575.986694 675.314846 575.986694 639.998733L575.986694 319.984159C575.986694 284.668046 547.316113 255.997465 512 255.997465ZM1023.979724 896.026613C1023.979724 966.729805 966.709529 1024.005069 896.006336 1024.005069L127.993664 1024.005069C57.290471 1024.005069 0.020276 966.658839 0.020276 896.026613 0.020276 874.868373 5.216059 854.931776 14.39105 837.311737L14.320083 837.24077 398.250384 69.304133 398.392317 69.304133C419.626593 28.133261 462.455047 0.040552 512 0.040552 561.544953 0.040552 604.373407 28.209297 625.67865 69.3751L1008.311272 834.711311C1018.348003 852.838256 1023.979724 873.783595 1023.979724 896.026613ZM959.99303 896.026613C959.99303 885.123073 957.392604 874.868373 952.191753 865.404445L951.613881 864.319667 951.112044 863.239958 568.621355 98.405584C557.499847 77.171308 535.834701 64.027246 512 64.027246 488.023365 64.027246 466.282184 77.318311 455.160675 98.765487L452.12938 104.544211 92.175714 824.527578 92.677551 825.034483 71.154339 866.778159C66.389426 875.948082 64.00697 885.842879 64.00697 896.097579 64.00697 931.413692 92.748517 960.089342 127.993664 960.089342L896.006336 960.089342C931.322449 960.013306 959.99303 931.342726 959.99303 896.026613Z","p-id":"6384"})],-1)),xu={class:"captcha--error--text"},Cu=Ye(st({__name:"ErrorView",emits:["click"],setup(e,{emit:t}){const n=t,o=er();return(r,s)=>(re(),Ve("div",{className:"captcha--error",onClick:s[0]||(s[0]=i=>n("click",i))},[wu,B("div",xu,yn(xe(o)("网络异常,请点击重试")),1)]))}}),[["__scopeId","data-v-6ba70e16"]]),Du={},Vu=e=>(Yt("data-v-edb749e2"),e=e(),Xt(),e),Su={class:"captcha--loading"},Tu=[Vu(()=>B("div",{class:"lds-ellipsis"},[B("div"),B("div"),B("div"),B("div")],-1))];function $u(e,t){return re(),Ve("div",Su,Tu)}const Iu=Ye(Du,[["render",$u],["__scopeId","data-v-edb749e2"]]),nr=e=>(Yt("data-v-0a2d342a"),e=e(),Xt(),e),Mu={class:"captcha--box"},Lu={className:"captcha--bottom"},Au=[nr(()=>B("path",{d:"M715.7 794.7c-1.9-4.7-7.4-6.5-11.8-4-54.3 31.1-115.8 50.3-177.2 50.3-192.2 0-345.2-148.3-345.2-335.7 0-37.7 5.5-72.6 18.3-107.1l65.2 17.5c6.3 1.7 11.9-4.1 10-10.5l-55.5-183.1c-1.8-5.9-9.1-7.9-13.5-3.6l-139.4 131c-4.8 4.5-2.8 12.3 3.5 14.1l58.2 15.6c-15.7 42.6-25.4 86.5-25.4 135 0 226.6 187.9 409.8 419.5 409.8 76.7 0 149.6-18.6 215.5-55.9 3.6-2.1 5.2-6.5 3.6-10.4l-25.8-63zM308.2 229.2c1.9 4.7 7.4 6.5 11.8 4 54.3-31.2 115.8-50.3 177.2-50.3 192.2 0 345.2 148.3 345.2 335.7 0 37.7-5.5 72.6-18.3 107.1l-65.2-17.5c-6.3-1.7-11.9 4.1-10 10.5l55.5 183.1c1.8 5.9 9.1 7.9 13.5 3.6l139.5-130.8c4.8-4.5 2.8-12.3-3.5-14.1l-58.2-15.6c15.7-42.6 25.4-86.5 25.4-135 0-226.6-187.9-409.8-419.5-409.8-76.7 0-149.6 18.6-215.5 55.9-3.6 2.1-5.2 6.5-3.6 10.4l25.7 62.8z","p-id":"4400"},null,-1))],Ru=[nr(()=>B("path",{d:"M509.866667 32C245.333333 32 32 247.466667 32 512s213.333333 480 477.866667 480S987.733333 776.533333 987.733333 512 774.4 32 509.866667 32z m0 896C281.6 928 96 742.4 96 512S281.6 96 509.866667 96 923.733333 281.6 923.733333 512s-185.6 416-413.866666 416z","p-id":"5378"},null,-1)),nr(()=>B("path",{d:"M693.333333 330.666667c-12.8-12.8-32-12.8-44.8 0L512 467.2l-136.533333-136.533333c-12.8-12.8-32-12.8-44.8 0-12.8 12.8-12.8 32 0 44.8l136.533333 136.533333-136.533333 136.533333c-12.8 12.8-12.8 32 0 44.8 6.4 6.4 14.933333 8.533333 23.466666 8.533334s17.066667-2.133333 23.466667-8.533334l136.533333-136.533333 136.533334 136.533333c6.4 6.4 14.933333 8.533333 23.466666 8.533334s17.066667-2.133333 23.466667-8.533334c12.8-12.8 12.8-32 0-44.8L556.8 512l136.533333-136.533333c12.8-12.8 12.8-32 0-44.8z","p-id":"5379"},null,-1))],Pu=Ye(st({__name:"Captcha",props:{requestCaptchaDataUrl:{type:String,required:!0},validCaptchaUrl:{type:String,required:!0},showClose:{type:Boolean,default:!0},radius:{type:Number},shadow:{type:Boolean,default:!0},locale:{type:String},extra:{type:Object,default:()=>({})}},emits:["close","success"],setup(e,{expose:t,emit:n}){const o={CONCAT:_u,SLIDER:Ou,ROTATE:yu},r=n,s=e,i=fn(()=>typeof s.radius=="number"&&!isNaN(s.radius)&&s.radius>=0?{borderRadius:`${s.radius}px`}:{}),c=Ec(s,"locale");au(c);const a=ye(!1),u=ye(!1),p=ye(!1),d=ye(),h=ye(!1),b=ye(),S=ye(0),M=()=>{a.value=!0;const U=++S.value;return new Promise((L,j)=>{ru({url:s.requestCaptchaDataUrl,data:{extra:s.extra}}).then(ne=>{U===S.value&&(ne.code===0?L(ne.data):j(ne),a.value=!1)}).catch(ne=>{U===S.value&&(j(ne),a.value=!1)})})},ue=async()=>{try{d.value=await M()}catch{h.value=!0}},q=async()=>{u.value||p.value||(h.value=!1,u.value=!0,await ue(),u.value=!1)};To(q);const X=async U=>{if(!d.value)return;const L=d.value;p.value=!0;const j=await su({url:s.validCaptchaUrl,data:{key:L.key,data:U}});if(!j){L.verifyStatus={status:!0},setTimeout(()=>r("success",L.key),1500);return}L.verifyStatus={status:!1,message:j},setTimeout(()=>{p.value=!1,ue()},1500)};return t({containerRef:b,refresh:()=>{q()}}),(U,L)=>(re(),Ve("div",{ref_key:"containerRef",ref:b,class:_t(["captcha--container",{"captcha--container--radius":e.radius,"captcha--container--shadow":e.shadow}]),style:Me(i.value),onTouchmove:L[1]||(L[1]=ai(()=>{},["prevent"])),onMousemove:L[2]||(L[2]=ai(()=>{},["prevent"]))},[B("div",Mu,[d.value?(re(),Je(Yc(o[d.value.captcha.type]),{key:d.value.key,captcha:d.value.captcha,verifyStatus:d.value.verifyStatus,onVerify:X},null,40,["captcha","verifyStatus"])):Pt("",!0),d.value?(re(),Ve(ge,{key:1},[],64)):Pt("",!0),a.value?(re(),Je(Iu,{key:2})):Pt("",!0),h.value?(re(),Je(Cu,{key:3})):Pt("",!0)]),B("div",Lu,[(re(),Ve("svg",{class:_t(["captcha--svg-icon captcha--btn-refresh",{"captcha--btn-refresh--active":u.value}]),viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"4399",width:"64",height:"64",onClick:q},Au,2)),e.showClose?(re(),Ve("svg",{key:0,class:"captcha--svg-icon captcha--btn-close",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"5377",width:"64",height:"64",onClick:L[0]||(L[0]=()=>{p.value||r("close")})},Ru)):Pt("",!0)])],38))}}),[["__scopeId","data-v-0a2d342a"]]);function Fu(e,t){const n=Fa(Pu,{...t}),o=()=>{console.log(n)};return n.mount(e),{refresh:o}}return Xn.createCaptcha=Fu,Object.defineProperty(Xn,Symbol.toStringTag,{value:"Module"}),Xn}({});
import { defineComponent as C, openBlock as l, createElementBlock as f, createElementVNode as o, normalizeStyle as S, pushScopeId as E, popScopeId as T, provide as Q, inject as tt, computed as $, normalizeClass as R, Fragment as V, toDisplayString as D, unref as y, renderSlot as et, createVNode as A, Transition as at, withCtx as O, createBlock as x, normalizeProps as st, mergeProps as nt, createCommentVNode as b, ref as m, onBeforeUnmount as W, toRef as rt, onMounted as ot, withModifiers as P, resolveDynamicComponent as ct } from "vue";
const it = (t) => (E("data-v-fcfe5ea2"), t = t(), T(), t), ut = { class: "captcha--slider-bar" }, dt = { class: "captcha--slider-bar--bar" }, lt = /* @__PURE__ */ it(() => /* @__PURE__ */ o("svg", {
import { defineComponent as C, openBlock as l, createElementBlock as m, createElementVNode as c, normalizeStyle as S, pushScopeId as E, popScopeId as T, provide as Q, inject as tt, computed as $, normalizeClass as R, Fragment as V, toDisplayString as D, unref as y, renderSlot as et, createVNode as A, Transition as at, withCtx as O, createBlock as x, normalizeProps as st, mergeProps as nt, createCommentVNode as b, ref as f, onBeforeUnmount as W, toRef as rt, onMounted as ct, withModifiers as P, resolveDynamicComponent as ot } from "vue";
const it = (t) => (E("data-v-fcfe5ea2"), t = t(), T(), t), ut = { class: "captcha--slider-bar" }, dt = { class: "captcha--slider-bar--bar" }, lt = /* @__PURE__ */ it(() => /* @__PURE__ */ c("svg", {
class: "captcha--slider-bar--track-icon",
viewBox: "0 0 1024 1024",
version: "1.1",
......@@ -8,7 +8,7 @@ const it = (t) => (E("data-v-fcfe5ea2"), t = t(), T(), t), ut = { class: "captch
width: "64",
height: "64"
}, [
/* @__PURE__ */ o("path", {
/* @__PURE__ */ c("path", {
d: "M576 192v256H0v128h576v256l448-320z",
"p-id": "4240"
})
......@@ -23,14 +23,14 @@ const it = (t) => (E("data-v-fcfe5ea2"), t = t(), T(), t), ut = { class: "captch
}
},
setup(t) {
return (e, a) => (l(), f("div", ut, [
o("div", dt, [
o("div", {
return (e, a) => (l(), m("div", ut, [
c("div", dt, [
c("div", {
class: "captcha--slider-bar--active",
style: S({ width: `${t.x}px` })
}, null, 4)
]),
o("div", {
c("div", {
class: "captcha--slider-bar--track",
style: S({
transform: `translateX(${t.x}px)`
......@@ -49,13 +49,13 @@ const it = (t) => (E("data-v-fcfe5ea2"), t = t(), T(), t), ut = { class: "captch
验证码已过期: "Expired",
拖动下方滑块完成拼图: "Drag the slider to complete the puzzle",
"网络异常,请点击重试": "Network error, click to retry"
}, mt = {
}, ft = {
验证成功: "验证成功",
"验证失败,请再试一次": "验证失败,请再试一次",
验证码已过期: "验证码已过期",
拖动下方滑块完成拼图: "拖动下方滑块完成拼图",
"网络异常,请点击重试": "网络异常,请点击重试"
}, ft = {
}, mt = {
验证成功: "驗證成功",
"验证失败,请再试一次": "驗證失敗,請再試一次",
验证码已过期: "驗證碼已過期",
......@@ -63,8 +63,8 @@ const it = (t) => (E("data-v-fcfe5ea2"), t = t(), T(), t), ut = { class: "captch
"网络异常,请点击重试": "網路異常,請點擊重試"
}, U = {
en: gt,
"zh-cn": mt,
"zh-tw": ft
"zh-cn": ft,
"zh-tw": mt
}, yt = Object.keys(U), wt = "zh-cn";
function _t(t) {
const e = t.split(/_|-/);
......@@ -76,10 +76,10 @@ function Ct(t) {
for (let a of e) {
if (a === "en" || a.startsWith("en-"))
return "en";
if (yt.includes(a))
return a;
if (a === "zh" || a.startsWith("zh-"))
return yt.includes(a) ? a : "zh-cn";
}
return e.some((a) => a === "zh" || a.startsWith("zh-")) ? "zh-cn" : "en";
return "en";
}
function xt(t) {
return U[Ct(t)] ?? {};
......@@ -116,7 +116,7 @@ function Z(t) {
method: n,
params: i,
headers: s,
data: c,
data: o,
timeout: u,
withCredentials: d = !1
} = t, r = new XMLHttpRequest();
......@@ -131,12 +131,12 @@ function Z(t) {
if (r.readyState === XMLHttpRequest.OPENED) {
if (typeof s == "object" && s && Object.entries(s).forEach(
([h, v]) => r.setRequestHeader(h, v)
), typeof c < "u" && c !== null) {
if (typeof c == "string") {
r.send(c);
), typeof o < "u" && o !== null) {
if (typeof o == "string") {
r.send(o);
return;
} else if (typeof c == "object") {
r.setRequestHeader("Content-Type", "application/json"), r.send(JSON.stringify(c));
} else if (typeof o == "object") {
r.setRequestHeader("Content-Type", "application/json"), r.send(JSON.stringify(o));
return;
}
}
......@@ -188,12 +188,12 @@ function H(t) {
}
function N(t) {
const { triggers: e = [], max: a, onDrag: n, onVerify: i } = t;
let s = null, c = [];
let s = null, o = [];
const u = (h) => {
s = {
...H(h),
startTime: Date.now()
}, c.push({
}, o.push({
x: 0,
y: 0,
type: "down",
......@@ -203,7 +203,7 @@ function N(t) {
if (!s)
return;
const v = H(h);
c.push({
o.push({
x: v.x - s.x,
y: v.y - s.y,
type: "move",
......@@ -213,11 +213,11 @@ function N(t) {
n(I);
}, r = (h) => {
if (s) {
if (p(), !c.some((v) => v.type === "move"))
c = [];
if (p(), !o.some((v) => v.type === "move"))
o = [];
else {
const v = H(h);
c.push({
o.push({
x: v.x - s.x,
y: v.y - s.y,
type: "up",
......@@ -225,7 +225,7 @@ function N(t) {
}), w(), i({
startSlidingTime: new Date(s.startTime).toISOString(),
endSlidingTime: (/* @__PURE__ */ new Date()).toISOString(),
trackList: c
trackList: o
});
}
s = null;
......@@ -254,9 +254,9 @@ function Mt(t) {
...i,
captcha: e,
max: s,
onVerify: (c) => {
onVerify: (o) => {
n({
...c,
...o,
bgImageWidth: Math.round(e.backgroundImageWidth * a),
bgImageHeight: Math.round(
e.backgroundImageHeight * a
......@@ -272,9 +272,9 @@ function Mt(t) {
});
}
function Et(t) {
const { captcha: e, ratio: a, onVerify: n, onDrag: i, max: s, ...c } = t;
const { captcha: e, ratio: a, onVerify: n, onDrag: i, max: s, ...o } = t;
return N({
...c,
...o,
captcha: e,
max: s,
onDrag: (u) => i(u, u / s * 360),
......@@ -306,9 +306,9 @@ function Tt(t) {
...s,
captcha: e,
max: i,
onVerify: (c) => {
onVerify: (o) => {
n({
...c,
...o,
bgImageWidth: Math.round(e.backgroundImageWidth * a),
bgImageHeight: Math.round(
e.backgroundImageHeight * a
......@@ -329,7 +329,7 @@ function B(t) {
return t || (t = tt(G, () => $(() => {
}), !0)), $(() => bt(t.value));
}
const F = (t) => (E("data-v-4b782e10"), t = t(), T(), t), Dt = /* @__PURE__ */ F(() => /* @__PURE__ */ o("svg", {
const F = (t) => (E("data-v-4b782e10"), t = t(), T(), t), Dt = /* @__PURE__ */ F(() => /* @__PURE__ */ c("svg", {
class: "captcha--status-tip--icon",
viewBox: "0 0 1024 1024",
version: "1.1",
......@@ -338,11 +338,11 @@ const F = (t) => (E("data-v-4b782e10"), t = t(), T(), t), Dt = /* @__PURE__ */ F
width: "64",
height: "64"
}, [
/* @__PURE__ */ o("path", {
/* @__PURE__ */ c("path", {
d: "M896 512a384 384 0 1 0-768 0 384 384 0 0 0 768 0zM42.666667 512C42.666667 252.8 252.8 42.666667 512 42.666667s469.333333 210.133333 469.333333 469.333333-210.133333 469.333333-469.333333 469.333333S42.666667 771.2 42.666667 512z m652.501333-158.165333l60.330667 60.330666L469.333333 700.330667l-200.832-200.832 60.330667-60.330667L469.333333 579.669333l225.834667-225.834666z",
"p-id": "5408"
})
], -1)), Ot = /* @__PURE__ */ F(() => /* @__PURE__ */ o("svg", {
], -1)), Ot = /* @__PURE__ */ F(() => /* @__PURE__ */ c("svg", {
class: "captcha--status-tip--icon",
viewBox: "0 0 1024 1024",
version: "1.1",
......@@ -351,7 +351,7 @@ const F = (t) => (E("data-v-4b782e10"), t = t(), T(), t), Dt = /* @__PURE__ */ F
width: "64",
height: "64"
}, [
/* @__PURE__ */ o("path", {
/* @__PURE__ */ c("path", {
d: "M575.986694 832.039919C575.986694 867.356032 547.316113 896.026613 512 896.026613 476.683887 896.026613 448.013306 867.356032 448.013306 832.039919 448.013306 796.723806 476.683887 768.048156 512 768.048156 547.316113 768.048156 575.986694 796.64777 575.986694 832.039919ZM512 255.997465C476.683887 255.997465 448.013306 284.668046 448.013306 319.984159L448.013306 639.998733C448.013306 675.314846 476.683887 703.990496 512 703.990496 547.316113 703.990496 575.986694 675.314846 575.986694 639.998733L575.986694 319.984159C575.986694 284.668046 547.316113 255.997465 512 255.997465ZM1023.979724 896.026613C1023.979724 966.729805 966.709529 1024.005069 896.006336 1024.005069L127.993664 1024.005069C57.290471 1024.005069 0.020276 966.658839 0.020276 896.026613 0.020276 874.868373 5.216059 854.931776 14.39105 837.311737L14.320083 837.24077 398.250384 69.304133 398.392317 69.304133C419.626593 28.133261 462.455047 0.040552 512 0.040552 561.544953 0.040552 604.373407 28.209297 625.67865 69.3751L1008.311272 834.711311C1018.348003 852.838256 1023.979724 873.783595 1023.979724 896.026613ZM959.99303 896.026613C959.99303 885.123073 957.392604 874.868373 952.191753 865.404445L951.613881 864.319667 951.112044 863.239958 568.621355 98.405584C557.499847 77.171308 535.834701 64.027246 512 64.027246 488.023365 64.027246 466.282184 77.318311 455.160675 98.765487L452.12938 104.544211 92.175714 824.527578 92.677551 825.034483 71.154339 866.778159C66.389426 875.948082 64.00697 885.842879 64.00697 896.097579 64.00697 931.413692 92.748517 960.089342 127.993664 960.089342L896.006336 960.089342C931.322449 960.013306 959.99303 931.342726 959.99303 896.026613Z",
"p-id": "6384"
})
......@@ -368,15 +368,15 @@ const F = (t) => (E("data-v-4b782e10"), t = t(), T(), t), Dt = /* @__PURE__ */ F
},
setup(t) {
const e = B();
return (a, n) => (l(), f("div", {
return (a, n) => (l(), m("div", {
class: R(`captcha--status-tip captcha--status-tip--${t.status ? "success" : "fail"}`)
}, [
t.status ? (l(), f(V, { key: 0 }, [
t.status ? (l(), m(V, { key: 0 }, [
Dt,
o("div", null, D(y(e)("验证成功")), 1)
], 64)) : (l(), f(V, { key: 1 }, [
c("div", null, D(y(e)("验证成功")), 1)
], 64)) : (l(), m(V, { key: 1 }, [
Ot,
o("div", null, D(y(e)(t.message ?? "验证失败,请再试一次")), 1)
c("div", null, D(y(e)(t.message ?? "验证失败,请再试一次")), 1)
], 64))
], 2));
}
......@@ -393,9 +393,9 @@ const F = (t) => (E("data-v-4b782e10"), t = t(), T(), t), Dt = /* @__PURE__ */ F
},
setup(t) {
const e = B();
return (a, n) => (l(), f("div", Rt, [
o("div", Vt, D(y(e)("拖动下方滑块完成拼图")), 1),
o("div", Wt, [
return (a, n) => (l(), m("div", Rt, [
c("div", Vt, D(y(e)("拖动下方滑块完成拼图")), 1),
c("div", Wt, [
et(a.$slots, "default", {}, void 0, !0),
A(at, { name: "captcha--status-tip" }, {
default: O(() => [
......@@ -420,7 +420,7 @@ const F = (t) => (E("data-v-4b782e10"), t = t(), T(), t), Dt = /* @__PURE__ */ F
},
emits: ["verify"],
setup(t, { emit: e }) {
const a = e, n = t, i = 280 / n.captcha.backgroundImageWidth, s = m(0), c = $(() => Y(n.captcha, i)), u = Tt({
const a = e, n = t, i = 280 / n.captcha.backgroundImageWidth, s = f(0), o = $(() => Y(n.captcha, i)), u = Tt({
captcha: n.captcha,
ratio: i,
max: 225,
......@@ -435,14 +435,14 @@ const F = (t) => (E("data-v-4b782e10"), t = t(), T(), t), Dt = /* @__PURE__ */ F
onMousedown: y(u).onDragStart
}, {
default: O(() => [
o("img", {
c("img", {
src: t.captcha.backgroundImage,
class: "captcha--view--concat--bg"
}, null, 8, Bt),
o("div", {
c("div", {
class: "captcha--view--concat--track",
style: S({
height: `${c.value}px`,
height: `${o.value}px`,
backgroundImage: `url('${t.captcha.backgroundImage}')`,
backgroundPositionX: `${s.value}px`
})
......@@ -464,9 +464,9 @@ const F = (t) => (E("data-v-4b782e10"), t = t(), T(), t), Dt = /* @__PURE__ */ F
},
emits: ["verify"],
setup(t, { emit: e }) {
const a = e, n = t, i = m(0), s = m(0), c = 280 / n.captcha.backgroundImageWidth, u = Et({
const a = e, n = t, i = f(0), s = f(0), o = 280 / n.captcha.backgroundImageWidth, u = Et({
captcha: n.captcha,
ratio: c,
ratio: o,
max: 225,
onDrag: (d, r) => {
i.value = d, s.value = r;
......@@ -481,11 +481,11 @@ const F = (t) => (E("data-v-4b782e10"), t = t(), T(), t), Dt = /* @__PURE__ */ F
onMousedown: y(u).onDragStart
}, {
default: O(() => [
o("img", {
c("img", {
src: t.captcha.backgroundImage,
class: "captcha--view--rotate--bg"
}, null, 8, Xt),
o("img", {
c("img", {
src: t.captcha.templateImage,
class: "captcha--view--rotate--track",
style: S({ transform: `rotate(${s.value}deg)` })
......@@ -507,7 +507,7 @@ const F = (t) => (E("data-v-4b782e10"), t = t(), T(), t), Dt = /* @__PURE__ */ F
},
emits: ["verify"],
setup(t, { emit: e }) {
const a = e, n = t, i = 280 / n.captcha.backgroundImageWidth, s = m(0), c = Mt({
const a = e, n = t, i = 280 / n.captcha.backgroundImageWidth, s = f(0), o = Mt({
captcha: n.captcha,
ratio: i,
onDrag: (u) => {
......@@ -515,19 +515,19 @@ const F = (t) => (E("data-v-4b782e10"), t = t(), T(), t), Dt = /* @__PURE__ */ F
},
onVerify: (u) => a("verify", u)
});
return W(() => c.destroy()), (u, d) => (l(), x(j, {
return W(() => o.destroy()), (u, d) => (l(), x(j, {
class: "captcha--view--slider",
verifyStatus: t.verifyStatus,
x: s.value,
onTouchstart: y(c).onDragStart,
onMousedown: y(c).onDragStart
onTouchstart: y(o).onDragStart,
onMousedown: y(o).onDragStart
}, {
default: O(() => [
o("img", {
c("img", {
src: t.captcha.backgroundImage,
class: "captcha--view--slider--bg"
}, null, 8, Zt),
o("img", {
c("img", {
src: t.captcha.templateImage,
class: "captcha--view--slider--track",
style: S({ transform: `translateX(${s.value}px)` })
......@@ -536,7 +536,7 @@ const F = (t) => (E("data-v-4b782e10"), t = t(), T(), t), Dt = /* @__PURE__ */ F
_: 1
}, 8, ["verifyStatus", "x", "onTouchstart", "onMousedown"]));
}
}), Ft = /* @__PURE__ */ _(Gt, [["__scopeId", "data-v-8fb0f971"]]), Jt = (t) => (E("data-v-6ba70e16"), t = t(), T(), t), Kt = /* @__PURE__ */ Jt(() => /* @__PURE__ */ o("svg", {
}), Ft = /* @__PURE__ */ _(Gt, [["__scopeId", "data-v-8fb0f971"]]), Jt = (t) => (E("data-v-6ba70e16"), t = t(), T(), t), Kt = /* @__PURE__ */ Jt(() => /* @__PURE__ */ c("svg", {
class: "captcha--error--icon",
viewBox: "0 0 1024 1024",
version: "1.1",
......@@ -545,7 +545,7 @@ const F = (t) => (E("data-v-4b782e10"), t = t(), T(), t), Dt = /* @__PURE__ */ F
width: "64",
height: "64"
}, [
/* @__PURE__ */ o("path", {
/* @__PURE__ */ c("path", {
d: "M575.986694 832.039919C575.986694 867.356032 547.316113 896.026613 512 896.026613 476.683887 896.026613 448.013306 867.356032 448.013306 832.039919 448.013306 796.723806 476.683887 768.048156 512 768.048156 547.316113 768.048156 575.986694 796.64777 575.986694 832.039919ZM512 255.997465C476.683887 255.997465 448.013306 284.668046 448.013306 319.984159L448.013306 639.998733C448.013306 675.314846 476.683887 703.990496 512 703.990496 547.316113 703.990496 575.986694 675.314846 575.986694 639.998733L575.986694 319.984159C575.986694 284.668046 547.316113 255.997465 512 255.997465ZM1023.979724 896.026613C1023.979724 966.729805 966.709529 1024.005069 896.006336 1024.005069L127.993664 1024.005069C57.290471 1024.005069 0.020276 966.658839 0.020276 896.026613 0.020276 874.868373 5.216059 854.931776 14.39105 837.311737L14.320083 837.24077 398.250384 69.304133 398.392317 69.304133C419.626593 28.133261 462.455047 0.040552 512 0.040552 561.544953 0.040552 604.373407 28.209297 625.67865 69.3751L1008.311272 834.711311C1018.348003 852.838256 1023.979724 873.783595 1023.979724 896.026613ZM959.99303 896.026613C959.99303 885.123073 957.392604 874.868373 952.191753 865.404445L951.613881 864.319667 951.112044 863.239958 568.621355 98.405584C557.499847 77.171308 535.834701 64.027246 512 64.027246 488.023365 64.027246 466.282184 77.318311 455.160675 98.765487L452.12938 104.544211 92.175714 824.527578 92.677551 825.034483 71.154339 866.778159C66.389426 875.948082 64.00697 885.842879 64.00697 896.097579 64.00697 931.413692 92.748517 960.089342 127.993664 960.089342L896.006336 960.089342C931.322449 960.013306 959.99303 931.342726 959.99303 896.026613Z",
"p-id": "6384"
})
......@@ -554,40 +554,40 @@ const F = (t) => (E("data-v-4b782e10"), t = t(), T(), t), Dt = /* @__PURE__ */ F
emits: ["click"],
setup(t, { emit: e }) {
const a = e, n = B();
return (i, s) => (l(), f("div", {
return (i, s) => (l(), m("div", {
className: "captcha--error",
onClick: s[0] || (s[0] = (c) => a("click", c))
onClick: s[0] || (s[0] = (o) => a("click", o))
}, [
Kt,
o("div", Qt, D(y(n)("网络异常,请点击重试")), 1)
c("div", Qt, D(y(n)("网络异常,请点击重试")), 1)
]));
}
}), ee = /* @__PURE__ */ _(te, [["__scopeId", "data-v-6ba70e16"]]), ae = {}, se = (t) => (E("data-v-edb749e2"), t = t(), T(), t), ne = { class: "captcha--loading" }, re = /* @__PURE__ */ se(() => /* @__PURE__ */ o("div", { class: "lds-ellipsis" }, [
/* @__PURE__ */ o("div"),
/* @__PURE__ */ o("div"),
/* @__PURE__ */ o("div"),
/* @__PURE__ */ o("div")
], -1)), oe = [
}), ee = /* @__PURE__ */ _(te, [["__scopeId", "data-v-6ba70e16"]]), ae = {}, se = (t) => (E("data-v-edb749e2"), t = t(), T(), t), ne = { class: "captcha--loading" }, re = /* @__PURE__ */ se(() => /* @__PURE__ */ c("div", { class: "lds-ellipsis" }, [
/* @__PURE__ */ c("div"),
/* @__PURE__ */ c("div"),
/* @__PURE__ */ c("div"),
/* @__PURE__ */ c("div")
], -1)), ce = [
re
];
function ce(t, e) {
return l(), f("div", ne, oe);
function oe(t, e) {
return l(), m("div", ne, ce);
}
const ie = /* @__PURE__ */ _(ae, [["render", ce], ["__scopeId", "data-v-edb749e2"]]), q = (t) => (E("data-v-0a2d342a"), t = t(), T(), t), ue = { class: "captcha--box" }, de = { className: "captcha--bottom" }, le = /* @__PURE__ */ q(() => /* @__PURE__ */ o("path", {
const ie = /* @__PURE__ */ _(ae, [["render", oe], ["__scopeId", "data-v-edb749e2"]]), q = (t) => (E("data-v-0a2d342a"), t = t(), T(), t), ue = { class: "captcha--box" }, de = { className: "captcha--bottom" }, le = /* @__PURE__ */ q(() => /* @__PURE__ */ c("path", {
d: "M715.7 794.7c-1.9-4.7-7.4-6.5-11.8-4-54.3 31.1-115.8 50.3-177.2 50.3-192.2 0-345.2-148.3-345.2-335.7 0-37.7 5.5-72.6 18.3-107.1l65.2 17.5c6.3 1.7 11.9-4.1 10-10.5l-55.5-183.1c-1.8-5.9-9.1-7.9-13.5-3.6l-139.4 131c-4.8 4.5-2.8 12.3 3.5 14.1l58.2 15.6c-15.7 42.6-25.4 86.5-25.4 135 0 226.6 187.9 409.8 419.5 409.8 76.7 0 149.6-18.6 215.5-55.9 3.6-2.1 5.2-6.5 3.6-10.4l-25.8-63zM308.2 229.2c1.9 4.7 7.4 6.5 11.8 4 54.3-31.2 115.8-50.3 177.2-50.3 192.2 0 345.2 148.3 345.2 335.7 0 37.7-5.5 72.6-18.3 107.1l-65.2-17.5c-6.3-1.7-11.9 4.1-10 10.5l55.5 183.1c1.8 5.9 9.1 7.9 13.5 3.6l139.5-130.8c4.8-4.5 2.8-12.3-3.5-14.1l-58.2-15.6c15.7-42.6 25.4-86.5 25.4-135 0-226.6-187.9-409.8-419.5-409.8-76.7 0-149.6 18.6-215.5 55.9-3.6 2.1-5.2 6.5-3.6 10.4l25.7 62.8z",
"p-id": "4400"
}, null, -1)), he = [
le
], pe = /* @__PURE__ */ q(() => /* @__PURE__ */ o("path", {
], pe = /* @__PURE__ */ q(() => /* @__PURE__ */ c("path", {
d: "M509.866667 32C245.333333 32 32 247.466667 32 512s213.333333 480 477.866667 480S987.733333 776.533333 987.733333 512 774.4 32 509.866667 32z m0 896C281.6 928 96 742.4 96 512S281.6 96 509.866667 96 923.733333 281.6 923.733333 512s-185.6 416-413.866666 416z",
"p-id": "5378"
}, null, -1)), ve = /* @__PURE__ */ q(() => /* @__PURE__ */ o("path", {
}, null, -1)), ve = /* @__PURE__ */ q(() => /* @__PURE__ */ c("path", {
d: "M693.333333 330.666667c-12.8-12.8-32-12.8-44.8 0L512 467.2l-136.533333-136.533333c-12.8-12.8-32-12.8-44.8 0-12.8 12.8-12.8 32 0 44.8l136.533333 136.533333-136.533333 136.533333c-12.8 12.8-12.8 32 0 44.8 6.4 6.4 14.933333 8.533333 23.466666 8.533334s17.066667-2.133333 23.466667-8.533334l136.533333-136.533333 136.533334 136.533333c6.4 6.4 14.933333 8.533333 23.466666 8.533334s17.066667-2.133333 23.466667-8.533334c12.8-12.8 12.8-32 0-44.8L556.8 512l136.533333-136.533333c12.8-12.8 12.8-32 0-44.8z",
"p-id": "5379"
}, null, -1)), ge = [
pe,
ve
], me = /* @__PURE__ */ C({
], fe = /* @__PURE__ */ C({
__name: "Captcha",
props: {
requestCaptchaDataUrl: {
......@@ -623,11 +623,11 @@ const ie = /* @__PURE__ */ _(ae, [["render", ce], ["__scopeId", "data-v-edb749e2
CONCAT: qt,
SLIDER: Ft,
ROTATE: Ut
}, i = a, s = t, c = $(
}, i = a, s = t, o = $(
() => typeof s.radius == "number" && !isNaN(s.radius) && s.radius >= 0 ? { borderRadius: `${s.radius}px` } : {}
), u = rt(s, "locale");
$t(u);
const d = m(!1), r = m(!1), w = m(!1), p = m(), h = m(!1), v = m(), I = m(0), J = () => {
const d = f(!1), r = f(!1), w = f(!1), p = f(), h = f(!1), v = f(), I = f(0), J = () => {
d.value = !0;
const L = ++I.value;
return new Promise((g, k) => {
......@@ -651,7 +651,7 @@ const ie = /* @__PURE__ */ _(ae, [["render", ce], ["__scopeId", "data-v-edb749e2
}, z = async () => {
r.value || w.value || (h.value = !1, r.value = !0, await X(), r.value = !1);
};
ot(z);
ct(z);
const K = async (L) => {
if (!p.value)
return;
......@@ -680,32 +680,32 @@ const ie = /* @__PURE__ */ _(ae, [["render", ce], ["__scopeId", "data-v-edb749e2
refresh: () => {
z();
}
}), (L, g) => (l(), f("div", {
}), (L, g) => (l(), m("div", {
ref_key: "containerRef",
ref: v,
class: R(["captcha--container", {
"captcha--container--radius": t.radius,
"captcha--container--shadow": t.shadow
}]),
style: S(c.value),
style: S(o.value),
onTouchmove: g[1] || (g[1] = P(() => {
}, ["prevent"])),
onMousemove: g[2] || (g[2] = P(() => {
}, ["prevent"]))
}, [
o("div", ue, [
p.value ? (l(), x(ct(n[p.value.captcha.type]), {
c("div", ue, [
p.value ? (l(), x(ot(n[p.value.captcha.type]), {
key: p.value.key,
captcha: p.value.captcha,
verifyStatus: p.value.verifyStatus,
onVerify: K
}, null, 40, ["captcha", "verifyStatus"])) : b("", !0),
p.value ? (l(), f(V, { key: 1 }, [], 64)) : b("", !0),
p.value ? (l(), m(V, { key: 1 }, [], 64)) : b("", !0),
d.value ? (l(), x(ie, { key: 2 })) : b("", !0),
h.value ? (l(), x(ee, { key: 3 })) : b("", !0)
]),
o("div", de, [
(l(), f("svg", {
c("div", de, [
(l(), m("svg", {
class: R(["captcha--svg-icon captcha--btn-refresh", {
"captcha--btn-refresh--active": r.value
}]),
......@@ -717,7 +717,7 @@ const ie = /* @__PURE__ */ _(ae, [["render", ce], ["__scopeId", "data-v-edb749e2
height: "64",
onClick: z
}, he, 2)),
t.showClose ? (l(), f("svg", {
t.showClose ? (l(), m("svg", {
key: 0,
class: "captcha--svg-icon captcha--btn-close",
viewBox: "0 0 1024 1024",
......@@ -733,7 +733,7 @@ const ie = /* @__PURE__ */ _(ae, [["render", ce], ["__scopeId", "data-v-edb749e2
])
], 38));
}
}), ye = /* @__PURE__ */ _(me, [["__scopeId", "data-v-0a2d342a"]]);
}), ye = /* @__PURE__ */ _(fe, [["__scopeId", "data-v-0a2d342a"]]);
export {
ye as Captcha
};
......@@ -54,17 +54,18 @@ export function getLanguage(language?: string): string {
}
//如果是中文那就判断是简体还是繁体
if (availableLanguages.includes(language)) {
return language
if (language === 'zh' || language.startsWith('zh-')) {
if (availableLanguages.includes(language)) {
return language
}
//中文就默认用简体
return 'zh-cn'
}
//都不是就继续循环
}
//到这里表示既不是英文,也不包含任何中文标识,那么判断标识里有没有中文,有就用简体中文,没有就用英文
if (languages.some((t) => t === 'zh' || t.startsWith('zh-'))) {
return 'zh-cn'
}
//到这里表示既不是英文,也不包含任何中文标识,那就用英文
return 'en'
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment