UNPKG

go-captcha-vue

Version:

This is the vue package for go-captcha

40 lines (39 loc) 29.7 kB
(function($,l){typeof exports=="object"&&typeof module!="undefined"?l(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],l):($=typeof globalThis!="undefined"?globalThis:$||self,l($["go-captcha-vue"]={},$.Vue))})(this,function($,l){"use strict";var Mt="";const Z=()=>({width:300,height:220,thumbWidth:150,thumbHeight:40,verticalPadding:16,horizontalPadding:12,showTheme:!0,title:"\u8BF7\u5728\u4E0B\u56FE\u4F9D\u6B21\u70B9\u51FB",buttonText:"\u786E\u8BA4"}),ee={};ee.setup=(e,n)=>{const t=n.emit;function s(a){t("click",a)}return{emitClickEvent:s}};var Le=function(){var e=this,n=e.$createElement,t=e._self._c||n;return t("svg",e._b({attrs:{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 200 200",width:"20",height:"20"},on:{click:e.emitClickEvent}},"svg",e.$attrs,!1),[t("path",{attrs:{d:`M100.1,189.9C100.1,189.9,100,189.9,100.1,189.9c-49.7,0-90-40.4-90-89.9c0-49.6,40.4-89.9,89.9-89.9 c49.6,0,89.9,40.4,89.9,89.9c0,18.2-5.4,35.7-15.6,50.7c-1.5,2.1-3.6,3.4-6.1,3.9c-2.5,0.4-5-0.1-7-1.6c-4.2-3-5.3-8.6-2.4-12.9 c8.1-11.9,12.4-25.7,12.4-40.1c0-39.2-31.9-71.1-71.1-71.1c-39.2,0-71.1,31.9-71.1,71.1c0,39.2,31.9,71.1,71.1,71.1 c7.7,0,15.3-1.2,22.6-3.6c2.4-0.8,4.9-0.6,7.2,0.5c2.2,1.1,3.9,3.1,4.7,5.5c1.6,4.9-1,10.2-5.9,11.9 C119.3,188.4,109.8,189.9,100.1,189.9z M73,136.4C73,136.4,73,136.4,73,136.4c-2.5,0-4.9-1-6.7-2.8c-3.7-3.7-3.7-9.6,0-13.3 L86.7,100L66.4,79.7c-3.7-3.7-3.7-9.6,0-13.3c3.7-3.7,9.6-3.7,13.3,0L100,86.7l20.3-20.3c1.8-1.8,4.1-2.8,6.7-2.8c0,0,0,0,0,0 c2.5,0,4.9,1,6.7,2.8c1.8,1.8,2.8,4.1,2.8,6.7c0,2.5-1,4.9-2.8,6.7L113.3,100l20.3,20.3c3.7,3.7,3.7,9.6,0,13.3 c-3.7,3.7-9.6,3.7-13.3,0L100,113.3l-20.3,20.3C77.9,135.4,75.5,136.4,73,136.4z`}})])},ke=[],Pt="";function x(e,n,t,s,a,c,d,i){var r=typeof e=="function"?e.options:e;n&&(r.render=n,r.staticRenderFns=t,r._compiled=!0),s&&(r.functional=!0),c&&(r._scopeId="data-v-"+c);var o;if(d?(o=function(u){u=u||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!u&&typeof __VUE_SSR_CONTEXT__!="undefined"&&(u=__VUE_SSR_CONTEXT__),a&&a.call(this,u),u&&u._registeredComponents&&u._registeredComponents.add(d)},r._ssrRegister=o):a&&(o=i?function(){a.call(this,(r.functional?this.parent:this).$root.$options.shadowRoot)}:a),o)if(r.functional){r._injectStyles=o;var _=r.render;r.render=function(p,m){return o.call(m),_(p,m)}}else{var v=r.beforeCreate;r.beforeCreate=v?[].concat(v,o):[o]}return{exports:e,options:r}}const te={};var Ce=x(ee,Le,ke,!1,Se,"3972774c",null,null);function Se(e){for(let n in te)this[n]=te[n]}var R=function(){return Ce.exports}();const ne={};ne.setup=(e,n)=>{const t=n.emit;function s(a){t("click",a)}return{emitClickEvent:s}};var Te=function(){var e=this,n=e.$createElement,t=e._self._c||n;return t("svg",e._b({attrs:{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 200 200",width:"20",height:"20"},on:{click:e.emitClickEvent}},"svg",e.$attrs,!1),[t("path",{attrs:{d:`M135,149.9c-10.7,7.6-23.2,11.4-36,11.2c-1.7,0-3.4-0.1-5-0.3c-0.7-0.1-1.4-0.2-2-0.3c-1.3-0.2-2.6-0.4-3.9-0.6 c-0.8-0.2-1.6-0.4-2.3-0.5c-1.2-0.3-2.5-0.6-3.7-1c-0.6-0.2-1.2-0.4-1.7-0.6c-1.4-0.5-2.8-1-4.2-1.5c-0.3-0.1-0.6-0.3-0.9-0.4 c-1.6-0.7-3.2-1.4-4.7-2.3c-0.1,0-0.1-0.1-0.2-0.1c-5.1-2.9-9.8-6.4-14-10.6c-0.1-0.1-0.1-0.1-0.2-0.2c-1.3-1.3-2.5-2.7-3.7-4.1 c-0.2-0.3-0.5-0.6-0.7-0.9c-8.4-10.6-13.5-24.1-13.5-38.8h14.3c0.4,0,0.7-0.2,0.9-0.5c0.2-0.3,0.2-0.8,0-1.1L29.5,60.9 c-0.2-0.3-0.5-0.5-0.9-0.5c-0.4,0-0.7,0.2-0.9,0.5L3.8,97.3c-0.2,0.3-0.2,0.7,0,1.1c0.2,0.3,0.5,0.5,0.9,0.5h14.3 c0,17.2,5.3,33.2,14.3,46.4c0.1,0.2,0.2,0.4,0.3,0.6c0.9,1.4,2,2.6,3,3.9c0.4,0.5,0.7,1,1.1,1.5c1.5,1.8,3,3.5,4.6,5.2 c0.2,0.2,0.3,0.3,0.5,0.5c5.4,5.5,11.5,10.1,18.2,13.8c0.2,0.1,0.3,0.2,0.5,0.3c1.9,1,3.9,2,5.9,2.9c0.5,0.2,1,0.5,1.5,0.7 c1.7,0.7,3.5,1.3,5.2,1.9c0.8,0.3,1.7,0.6,2.5,0.8c1.5,0.5,3.1,0.8,4.7,1.2c1.1,0.2,2.1,0.5,3.2,0.7c0.4,0.1,0.9,0.2,1.3,0.3 c1.5,0.3,3,0.4,4.5,0.6c0.5,0.1,1.1,0.2,1.6,0.2c2.7,0.3,5.4,0.4,8.1,0.4c16.4,0,32.5-5.1,46.2-14.8c4.4-3.1,5.5-9.2,2.4-13.7 C145.5,147.8,139.4,146.7,135,149.9 M180.6,98.9c0-17.2-5.3-33.1-14.2-46.3c-0.1-0.2-0.2-0.5-0.4-0.7c-1.1-1.6-2.3-3.1-3.5-4.6 c-0.1-0.2-0.3-0.4-0.4-0.6c-8.2-10.1-18.5-17.9-30.2-23c-0.3-0.1-0.6-0.3-1-0.4c-1.9-0.8-3.8-1.5-5.7-2.1c-0.7-0.2-1.4-0.5-2.1-0.7 c-1.7-0.5-3.4-0.9-5.1-1.3c-0.9-0.2-1.9-0.5-2.8-0.7c-0.5-0.1-0.9-0.2-1.4-0.3c-1.3-0.2-2.6-0.3-3.8-0.5c-0.9-0.1-1.8-0.3-2.6-0.3 c-2.1-0.2-4.3-0.3-6.4-0.3c-0.4,0-0.8-0.1-1.2-0.1c-0.1,0-0.1,0-0.2,0c-16.4,0-32.4,5-46.2,14.8C49,35,48,41.1,51,45.6 c3.1,4.4,9.1,5.5,13.5,2.4c10.6-7.5,23-11.3,35.7-11.2c1.8,0,3.6,0.1,5.4,0.3c0.6,0.1,1.1,0.1,1.6,0.2c1.5,0.2,2.9,0.4,4.3,0.7 c0.6,0.1,1.3,0.3,1.9,0.4c1.4,0.3,2.8,0.7,4.2,1.1c0.4,0.1,0.9,0.3,1.3,0.4c1.6,0.5,3.1,1.1,4.6,1.7c0.2,0.1,0.3,0.1,0.5,0.2 c9,3.9,17,10,23.2,17.6c0,0,0.1,0.1,0.1,0.2c8.7,10.7,14,24.5,14,39.4H147c-0.4,0-0.7,0.2-0.9,0.5c-0.2,0.3-0.2,0.8,0,1.1l24,36.4 c0.2,0.3,0.5,0.5,0.9,0.5c0.4,0,0.7-0.2,0.9-0.5l23.9-36.4c0.2-0.3,0.2-0.7,0-1.1c-0.2-0.3-0.5-0.5-0.9-0.5L180.6,98.9L180.6,98.9 L180.6,98.9z`}})])},Fe=[],Xt="";const se={};var De=x(ne,Te,Fe,!1,Be,"1120f0d2",null,null);function Be(e){for(let n in se)this[n]=se[n]}var G=function(){return De.exports}();const ce={};ce.setup=(e,n)=>{const t=n.emit;function s(a){t("click",a)}return{emitClickEvent:s}};var Me=function(){var e=this,n=e.$createElement,t=e._self._c||n;return t("svg",e._b({attrs:{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid",width:"84",height:"84"},on:{click:e.emitClickEvent}},"svg",e.$attrs,!1),[t("circle",{attrs:{cx:"50",cy:"36.8101",r:"10"}},[t("animate",{attrs:{attributeName:"cy",dur:"1s",repeatCount:"indefinite",calcMode:"spline",keySplines:"0.45 0 0.9 0.55;0 0.45 0.55 0.9",keyTimes:"0;0.5;1",values:"23;77;23"}})])])},Pe=[],zt="";const ae={};var Xe=x(ce,Me,Pe,!1,ze,"c6fd8106",null,null);function ze(e){for(let n in ae)this[n]=ae[n]}var J=function(){return Xe.exports}();function We(e){let n=0,t=0;if(e.getBoundingClientRect){const s=e.getBoundingClientRect(),a=document.documentElement;n=s.left+Math.max(a.scrollLeft,document.body.scrollLeft)-a.clientLeft,t=s.top+Math.max(a.scrollTop,document.body.scrollTop)-a.clientTop}else for(;e!==document.body;)n+=e.offsetLeft,t+=e.offsetTop,e=e.offsetParent;return{domX:n,domY:t}}function K(e,n){let t=n.relatedTarget;try{for(;t&&t!==e;)t=t.parentNode}catch(s){console.warn(s)}return t!==e}function Ie(e,n){const t=l.reactive({list:[]});return{dots:t,clickEvent:i=>{const r=i.currentTarget,o=We(r),_=i.pageX||i.clientX,v=i.pageY||i.clientY,u=o.domX,p=o.domY,m=_-u,L=v-p,g=parseInt(m.toString()),E=parseInt(L.toString()),F=new Date,k=t.list.length,w=t.list;return w.push({key:F.getTime(),index:k+1,x:g,y:E}),t.list=w,n.click&&n.click(g,E),i.cancelBubble=!0,i.preventDefault(),!1},confirmEvent:i=>(n.confirm&&n.confirm(l.toRaw(t.list),()=>{t.list=[]}),i.cancelBubble=!0,i.preventDefault(),!1),closeEvent:i=>(n.close&&n.close(),t.list=[],i.cancelBubble=!0,i.preventDefault(),!1),refreshEvent:i=>(n.refresh&&n.refresh(),t.list=[],i.cancelBubble=!0,i.preventDefault(),!1)}}const z={};z.props={config:{key:"config",required:!1,type:null,default:Z},events:{key:"events",required:!1,type:null,default:()=>({})},data:{key:"data",required:!1,type:null,default:()=>({})}},z.setup=(e,n)=>{const t=e,{data:s,events:a}=t,c=l.ref({...Z(),...t.config});l.watch(()=>t.config,()=>{c.value={...c.value,...t.config}});const d=Ie(s,a),i=c.value.horizontalPadding||0,r=c.value.verticalPadding||0,o=(c.value.width||0)+i*2+(c.value.showTheme?2:0),_=d.dots,v=l.computed(()=>({width:o+"px",paddingLeft:i+"px",paddingRight:i+"px",paddingTop:r+"px",paddingBottom:r+"px"})),u=l.computed(()=>({width:c.value.thumbWidth+"px",height:c.value.thumbHeight+"px"})),p=l.computed(()=>({width:c.value.width+"px",height:c.value.height+"px"}));return{data:s,config:c,handler:d,dots:_,wrapperStyles:v,thumbStyles:u,imageStyles:p}},z.components=Object.assign({LoadingIcon:J,CloseIcon:R,RefreshIcon:G},z.components);var je=function(){var e=this,n=e.$createElement,t=e._self._c||n;return t("div",{class:"go-captcha gc-wrapper "+(e.config.showTheme?"gc-theme":""),style:e.wrapperStyles},[t("div",{staticClass:"gc-header"},[t("span",[e._v(e._s(e.config.title))]),t("img",{directives:[{name:"show",rawName:"v-show",value:e.data.thumb!=="",expression:"data.thumb !== ''"}],style:e.thumbStyles,attrs:{src:e.data.thumb,alt:"..."}})]),t("div",{staticClass:"gc-body",style:e.imageStyles},[t("div",{staticClass:"gc-loading"},[t("loading-icon")],1),t("img",{directives:[{name:"show",rawName:"v-show",value:e.data.image!=="",expression:"data.image !== ''"}],staticClass:"gc-picture",style:e.imageStyles,attrs:{src:e.data.image,alt:"..."},on:{click:e.handler.clickEvent}}),t("div",{staticClass:"gc-dots"},e._l(e.dots.list,function(s){return t("div",{key:s.key+"-"+s.index,staticClass:"gc-dot",style:{top:s.y-11+"px",left:s.x-11+"px"}},[e._v(e._s(s.index))])}),0)]),t("div",{staticClass:"gc-footer"},[t("div",{staticClass:"gc-icon-block gc-icon-block2"},[t("close-icon",{attrs:{width:22,height:22},on:{click:e.handler.closeEvent}}),t("refresh-icon",{attrs:{width:22,height:22},on:{click:e.handler.refreshEvent}})],1),t("div",{staticClass:"gc-button-block"},[t("button",{on:{click:e.handler.confirmEvent}},[e._v(e._s(e.config.buttonText))])])])])},qe=[],Wt="";const le={};var Ye=x(z,je,qe,!1,He,null,null,null);function He(e){for(let n in le)this[n]=le[n]}var W=function(){return Ye.exports}();W.name="gocaptcha-click",W.install=function(e){e.component("gocaptcha-click",W)};const oe=()=>({width:300,height:220,thumbWidth:150,thumbHeight:40,verticalPadding:16,horizontalPadding:12,showTheme:!0,title:"\u8BF7\u62D6\u52A8\u6ED1\u5757\u5B8C\u6210\u62FC\u56FE"}),ie={};ie.setup=(e,n)=>{const t=n.emit;function s(a){t("click",a)}return{emitClickEvent:s}};var Ae=function(){var e=this,n=e.$createElement,t=e._self._c||n;return t("svg",e._b({attrs:{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 200 200",width:"20",height:"20"},on:{click:e.emitClickEvent}},"svg",e.$attrs,!1),[t("path",{attrs:{d:`M131.6,116.3c0,0-75.6,0-109.7,0c-9.1,0-16.2-7.4-16.2-16.2c0-9.1,7.4-16.2,16.2-16.2c28.7,0,109.7,0,109.7,0 s-5.4-5.4-30.4-30.7c-6.4-6.4-6.4-16.7,0-23.1s16.7-6.4,23.1,0l58.4,58.4c6.4,6.4,6.4,16.7,0,23.1c0,0-32.9,32.9-57.9,57.9 c-6.4,6.4-16.7,6.4-23.1,0c-6.4-6.4-6.4-16.7,0-23.1C121.8,126.2,131.6,116.3,131.6,116.3z`}})])},Ne=[],It="";const re={};var Oe=x(ie,Ae,Ne,!1,Ve,"30853052",null,null);function Ve(e){for(let n in re)this[n]=re[n]}var ue=function(){return Oe.exports}();function Ue(e,n,t,s,a,c){const d=l.reactive({dragLeft:0,thumbLeft:e.thumbX||0}),i=()=>{d.dragLeft=0,d.thumbLeft=0};return{state:d,dragEvent:v=>{const u=v.touches&&v.touches[0],p=a.value.offsetLeft,m=t.value.offsetWidth,L=a.value.offsetWidth,g=m-L,E=e.thumbX||0,F=s.value.offsetWidth,k=L-F,w=(g-E+k)/g;let y=!1,C=null,D=0,B=0;u?D=u.pageX-p:D=v.clientX-p;const S=h=>{y=!0;const X=h.touches&&h.touches[0];let b=0;if(X?b=X.pageX-D:b=h.clientX-D,b>=g){d.dragLeft=g;return}if(b<=0){d.dragLeft=0;return}d.dragLeft=b,B=E+b*w,d.thumbLeft=B,n.move&&n.move(B,e.thumbY||0),h.cancelBubble=!0,h.preventDefault()},f=h=>{!K(c.value,h)||!y||(y=!1,U(),n.confirm&&n.confirm({x:parseInt(B.toString()),y:e.thumbY||0},()=>{i()}),h.cancelBubble=!0,h.preventDefault())},P=h=>{C=h},T=()=>{C=null},V=h=>{!C||(f(C),U())},U=()=>{c.value.removeEventListener("mousemove",S,!1),c.value.removeEventListener("touchmove",S,{passive:!1}),c.value.removeEventListener("mouseup",f,!1),c.value.removeEventListener("mouseenter",T,!1),c.value.removeEventListener("mouseleave",P,!1),c.value.removeEventListener("touchend",f,!1),document.body.removeEventListener("mouseleave",f,!1),document.body.removeEventListener("mouseup",V,!1)};c.value.addEventListener("mousemove",S,!1),c.value.addEventListener("touchmove",S,{passive:!1}),c.value.addEventListener("mouseup",f,!1),c.value.addEventListener("mouseenter",T,!1),c.value.addEventListener("mouseleave",P,!1),c.value.addEventListener("touchend",f,!1),document.body.addEventListener("mouseleave",f,!1),document.body.addEventListener("mouseup",V,!1)},closeEvent:v=>(n&&n.close&&n.close(),i(),v.cancelBubble=!0,v.preventDefault(),!1),refreshEvent:v=>(n&&n.refresh&&n.refresh(),i(),v.cancelBubble=!0,v.preventDefault(),!1)}}const I={};I.props={config:{key:"config",required:!1,type:null,default:oe},events:{key:"events",required:!1,type:null,default:()=>({})},data:{key:"data",required:!1,type:null,default:()=>({})}},I.setup=(e,n)=>{const t=e,{data:s,events:a}=t,c=l.ref({...oe(),...t.config});l.watch(()=>t.config,()=>{c.value={...c.value,...t.config}});const d=l.ref(null),i=l.ref(null),r=l.ref(null),o=l.ref(null),_=Ue(s,a,i,o,r,d),v=c.value.horizontalPadding||0,u=c.value.verticalPadding||0,p=(c.value.width||0)+v*2+(c.value.showTheme?2:0),m=l.computed(()=>({width:p+"px",paddingLeft:v+"px",paddingRight:v+"px",paddingTop:u+"px",paddingBottom:u+"px"})),L=l.computed(()=>({width:s.thumbWidth+"px",height:s.thumbHeight+"px",top:s.thumbY+"px",left:_.state.thumbLeft+"px"})),g=l.computed(()=>({width:c.value.width+"px",height:c.value.height+"px"}));return l.onMounted(async()=>{await l.nextTick(),r.value&&r.value.addEventListener("dragstart",E=>E.preventDefault())}),{data:s,config:c,dragBarRef:d,containerRef:i,dragBlockRef:r,tileRef:o,handler:_,wrapperStyles:m,thumbStyles:L,imageStyles:g}},I.components=Object.assign({CloseIcon:R,RefreshIcon:G,LoadingIcon:J,ArrowsIcon:ue},I.components);var Re=function(){var e=this,n=e.$createElement,t=e._self._c||n;return t("div",{class:"go-captcha gc-wrapper "+(e.config.showTheme?"gc-theme":""),style:e.wrapperStyles},[t("div",{staticClass:"gc-header"},[t("span",[e._v(e._s(e.config.title))]),t("div",{staticClass:"gc-icon-block"},[t("close-icon",{attrs:{width:22,height:22},on:{click:e.handler.closeEvent}}),t("refresh-icon",{attrs:{width:22,height:22},on:{click:e.handler.refreshEvent}})],1)]),t("div",{ref:"containerRef",staticClass:"gc-body",style:e.imageStyles},[t("div",{staticClass:"gc-loading"},[t("loading-icon")],1),t("img",{directives:[{name:"show",rawName:"v-show",value:e.data.image!=="",expression:"data.image !== ''"}],staticClass:"gc-picture",style:e.imageStyles,attrs:{src:e.data.image,alt:"..."}}),t("div",{ref:"tileRef",staticClass:"gc-tile",style:e.thumbStyles},[t("img",{directives:[{name:"show",rawName:"v-show",value:e.data.thumb!=="",expression:"data.thumb !== ''"}],attrs:{src:e.data.thumb,alt:"..."}})])]),t("div",{staticClass:"gc-footer"},[t("div",{ref:"dragBarRef",staticClass:"gc-drag-slide-bar"},[t("div",{staticClass:"gc-drag-line"}),t("div",{ref:"dragBlockRef",staticClass:"gc-drag-block",style:{left:e.handler.state.dragLeft+"px"},on:{mousedown:e.handler.dragEvent}},[t("div",{staticClass:"gc-drag-block-inline",on:{touchstart:e.handler.dragEvent}},[t("arrows-icon")],1)])])])])},Ge=[],jt="";const de={};var Je=x(I,Re,Ge,!1,Ke,null,null,null);function Ke(e){for(let n in de)this[n]=de[n]}var j=function(){return Je.exports}();j.name="gocaptcha-slide",j.install=function(e){e.component("gocaptcha-slide",j)};const ve=()=>({width:300,height:220,verticalPadding:16,horizontalPadding:12,showTheme:!0,title:"\u8BF7\u62D6\u62FD\u8D34\u56FE\u5B8C\u6210\u62FC\u56FE"});function Qe(e,n,t,s){const a=l.reactive({x:e.thumbX||0,y:e.thumbY||0}),c=()=>{a.x=e.thumbX||0,a.y=e.thumbY||0};return{state:a,dragEvent:o=>{const _=o.touches&&o.touches[0],v=s.value.offsetLeft,u=s.value.offsetTop,p=t.value.offsetWidth,m=t.value.offsetHeight,L=s.value.offsetWidth,g=s.value.offsetHeight,E=p-L,F=m-g;let k=!1,w=null,y=0,C=0,D=0,B=0;_?(y=_.pageX-v,C=_.pageY-u):(y=o.clientX-v,C=o.clientY-u);const S=h=>{k=!0;const X=h.touches&&h.touches[0];let b=0,M=0;X?(b=X.pageX-y,M=X.pageY-C):(b=h.clientX-y,M=h.clientY-C),b<=0&&(b=0),M<=0&&(M=0),b>=E&&(b=E),M>=F&&(M=F),a.x=b,a.y=M,D=b,B=M,n.move&&n.move(b,M),h.cancelBubble=!0,h.preventDefault()},f=h=>{!K(t.value,h)||!k||(k=!1,U(),n.confirm&&n.confirm({x:D,y:B},()=>{c()}),h.cancelBubble=!0,h.preventDefault())},P=h=>{w=h},T=()=>{w=null},V=h=>{!w||(f(w),U())},U=()=>{t.value.removeEventListener("mousemove",S,!1),t.value.removeEventListener("touchmove",S,{passive:!1}),t.value.removeEventListener("mouseup",f,!1),t.value.removeEventListener("mouseenter",T,!1),t.value.removeEventListener("mouseleave",P,!1),t.value.removeEventListener("touchend",f,!1),document.body.removeEventListener("mouseleave",f,!1),document.body.removeEventListener("mouseup",V,!1)};t.value.addEventListener("mousemove",S,!1),t.value.addEventListener("touchmove",S,{passive:!1}),t.value.addEventListener("mouseup",f,!1),t.value.addEventListener("mouseenter",T,!1),t.value.addEventListener("mouseleave",P,!1),t.value.addEventListener("touchend",f,!1),document.body.addEventListener("mouseleave",f,!1),document.body.addEventListener("mouseup",V,!1)},closeEvent:o=>(n&&n.close&&n.close(),c(),o.cancelBubble=!0,o.preventDefault(),!1),refreshEvent:o=>(n&&n.refresh&&n.refresh(),c(),o.cancelBubble=!0,o.preventDefault(),!1)}}const q={};q.props={config:{key:"config",required:!1,type:null,default:ve},events:{key:"events",required:!1,type:null,default:()=>({})},data:{key:"data",required:!1,type:null,default:()=>({})}},q.setup=(e,n)=>{const t=e,{data:s,events:a}=t,c=l.ref({...ve(),...t.config});l.watch(()=>t.config,()=>{c.value={...c.value,...t.config}});const d=l.ref(null),i=l.ref(null),r=Qe(s,a,d,i),o=c.value.horizontalPadding||0,_=c.value.verticalPadding||0;let v=(c.value.width||0)+o*2+(c.value.showTheme?2:0);const u=l.computed(()=>({width:v+"px",paddingLeft:o+"px",paddingRight:o+"px",paddingTop:_+"px",paddingBottom:_+"px"})),p=l.computed(()=>({width:s.thumbWidth+"px",height:s.thumbHeight+"px",top:r.state.y+"px",left:r.state.x+"px"})),m=l.computed(()=>({width:c.value.width+"px",height:c.value.height+"px"}));return l.onMounted(async()=>{await l.nextTick(),i.value&&i.value.addEventListener("dragstart",L=>L.preventDefault())}),{data:s,config:c,containerRef:d,tileRef:i,handler:r,wrapperStyles:u,thumbStyles:p,imageStyles:m}},q.components=Object.assign({LoadingIcon:J,CloseIcon:R,RefreshIcon:G},q.components);var Ze=function(){var e=this,n=e.$createElement,t=e._self._c||n;return t("div",{class:"go-captcha gc-wrapper "+(e.config.showTheme?"gc-theme":""),style:e.wrapperStyles},[t("div",{staticClass:"gc-header gc-header2"},[t("span",[e._v(e._s(e.config.title))])]),t("div",{ref:"containerRef",staticClass:"gc-body",style:e.imageStyles},[t("div",{staticClass:"gc-loading"},[t("loading-icon")],1),t("img",{directives:[{name:"show",rawName:"v-show",value:e.data.image!=="",expression:"data.image !== ''"}],staticClass:"gc-picture",style:e.imageStyles,attrs:{src:e.data.image,alt:"..."}}),t("div",{ref:"tileRef",staticClass:"gc-tile",style:e.thumbStyles,on:{mousedown:e.handler.dragEvent,touchstart:e.handler.dragEvent}},[t("img",{directives:[{name:"show",rawName:"v-show",value:e.data.thumb!=="",expression:"data.thumb !== ''"}],attrs:{src:e.data.thumb,alt:"..."}})])]),t("div",{staticClass:"gc-footer"},[t("div",{staticClass:"gc-icon-block"},[t("close-icon",{attrs:{width:22,height:22},on:{click:e.handler.closeEvent}}),t("refresh-icon",{attrs:{width:22,height:22},on:{click:e.handler.refreshEvent}})],1)])])},et=[],qt="";const fe={};var tt=x(q,Ze,et,!1,nt,null,null,null);function nt(e){for(let n in fe)this[n]=fe[n]}var Y=function(){return tt.exports}();Y.name="gocaptcha-slide-region",Y.install=function(e){e.component("gocaptcha-slide-region",Y)};const Q=()=>({width:300,height:220,size:220,verticalPadding:16,horizontalPadding:12,showTheme:!0,title:"\u8BF7\u62D6\u52A8\u6ED1\u5757\u5B8C\u6210\u62FC\u56FE"});function st(e,n,t,s){const a=l.reactive({dragLeft:0,thumbAngle:e.angle||0}),c=()=>{a.dragLeft=0,a.thumbAngle=0};return{state:a,dragEvent:o=>{const _=o.touches&&o.touches[0],v=t.value.offsetLeft,u=s.value.offsetWidth,p=t.value.offsetWidth,m=u-p,L=360/m;let g=0,E=!1,F=null,k=0;_?k=_.pageX-v:k=o.clientX-v;const w=f=>{E=!0;const P=f.touches&&f.touches[0];let T=0;if(P?T=P.pageX-k:T=f.clientX-k,T>=m){a.dragLeft=m;return}if(T<=0){a.dragLeft=0;return}a.dragLeft=T,g=T*L,a.thumbAngle=g,n.rotate&&n.rotate(g),f.cancelBubble=!0,f.preventDefault()},y=f=>{!K(s.value,f)||!E||(S(),E=!1,n.confirm&&n.confirm(parseInt(g.toString()),()=>{c()}),f.cancelBubble=!0,f.preventDefault())},C=f=>{F=f},D=()=>{F=null},B=f=>{!F||(y(F),S())},S=()=>{s.value.removeEventListener("mousemove",w,!1),s.value.removeEventListener("touchmove",w,{passive:!1}),s.value.removeEventListener("mouseup",y,!1),s.value.removeEventListener("mouseenter",D,!1),s.value.removeEventListener("mouseleave",C,!1),s.value.removeEventListener("touchend",y,!1),document.body.removeEventListener("mouseleave",y,!1),document.body.removeEventListener("mouseup",B,!1)};s.value.addEventListener("mousemove",w,!1),s.value.addEventListener("touchmove",w,{passive:!1}),s.value.addEventListener("mouseup",y,!1),s.value.addEventListener("mouseenter",D,!1),s.value.addEventListener("mouseleave",C,!1),s.value.addEventListener("touchend",y,!1),document.body.addEventListener("mouseleave",y,!1),document.body.addEventListener("mouseup",B,!1)},closeEvent:o=>(n&&n.close&&n.close(),c(),o.cancelBubble=!0,o.preventDefault(),!1),refreshEvent:o=>(n&&n.refresh&&n.refresh(),c(),o.cancelBubble=!0,o.preventDefault(),!1)}}const H={};H.props={config:{key:"config",required:!1,type:null,default:Q},events:{key:"events",required:!1,type:null,default:()=>({})},data:{key:"data",required:!1,type:null,default:()=>({})}},H.setup=(e,n)=>{const t=e,{data:s,events:a}=t,c=l.ref({...Q(),...t.config});l.watch(()=>t.config,()=>{c.value={...c.value,...t.config}});const d=l.ref(null),i=l.ref(null),r=st(s,a,i,d),o=l.computed(()=>{const u=c.value.horizontalPadding||0,p=c.value.verticalPadding||0;return{width:(c.value.width||0)+u*2+(c.value.showTheme?2:0)+"px",paddingLeft:u+"px",paddingRight:u+"px",paddingTop:p+"px",paddingBottom:p+"px"}}),_=l.computed(()=>({transform:`rotate(${r.state.thumbAngle}deg)`})),v=l.computed(()=>{var p;const u=(((p=c.value)==null?void 0:p.size)||0)>0?c.value.size:Q().size;return{width:u+"px",height:u+"px"}});return l.onMounted(async()=>{await l.nextTick(),i.value&&i.value.addEventListener("dragstart",u=>u.preventDefault())}),{data:s,config:c,dragBarRef:d,dragBlockRef:i,handler:r,wrapperStyles:o,thumbStyles:_,imageStyles:v}},H.components=Object.assign({CloseIcon:R,RefreshIcon:G,LoadingIcon:J,ArrowsIcon:ue},H.components);var ct=function(){var e=this,n=e.$createElement,t=e._self._c||n;return t("div",{class:"go-captcha gc-wrapper "+(e.config.showTheme?"gc-theme":""),style:e.wrapperStyles},[t("div",{staticClass:"gc-header"},[t("span",[e._v(e._s(e.config.title))]),t("div",{staticClass:"gc-icon-block"},[t("close-icon",{attrs:{width:22,height:22},on:{click:e.handler.closeEvent}}),t("refresh-icon",{attrs:{width:22,height:22},on:{click:e.handler.refreshEvent}})],1)]),t("div",{ref:"containerRef",staticClass:"gc-body gc-rotate-body",style:e.imageStyles},[t("div",{staticClass:"gc-loading"},[t("loading-icon")],1),t("div",{staticClass:"gc-picture gc-rotate-picture",style:e.imageStyles},[t("img",{directives:[{name:"show",rawName:"v-show",value:e.data.image!=="",expression:"data.image !== ''"}],attrs:{src:e.data.image,alt:"..."}}),t("div",{staticClass:"gc-round"})]),t("div",{staticClass:"gc-thumb gc-rotate-thumb"},[t("div",{staticClass:"gc-rotate-thumb-block",style:e.thumbStyles},[t("img",{directives:[{name:"show",rawName:"v-show",value:e.data.thumb!=="",expression:"data.thumb !== ''"}],attrs:{src:e.data.thumb,alt:"..."}})])])]),t("div",{staticClass:"gc-footer"},[t("div",{ref:"dragBarRef",staticClass:"gc-drag-slide-bar"},[t("div",{staticClass:"gc-drag-line"}),t("div",{ref:"dragBlockRef",staticClass:"gc-drag-block",style:{left:e.handler.state.dragLeft+"px"},on:{mousedown:e.handler.dragEvent}},[t("div",{staticClass:"gc-drag-block-inline",on:{touchstart:e.handler.dragEvent}},[t("arrows-icon")],1)])])])])},at=[],Yt="";const he={};var lt=x(H,ct,at,!1,ot,null,null,null);function ot(e){for(let n in he)this[n]=he[n]}var A=function(){return lt.exports}();A.name="gocaptcha-rotate",A.install=function(e){e.component("gocaptcha-rotate",A)};const _e={};_e.setup=(e,n)=>{const t=n.emit;function s(a){t("click",a)}return{emitClickEvent:s}};var it=function(){var e=this,n=e.$createElement,t=e._self._c||n;return t("svg",e._b({attrs:{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 200 200",width:"20",height:"20"},on:{click:e.emitClickEvent}},"svg",e.$attrs,!1),[t("circle",{attrs:{fill:"#3E7CFF",cx:"100",cy:"100",r:"96.3"}}),t("path",{attrs:{fill:"#FFFFFF",d:`M140.8,64.4l-39.6-11.9h-2.4L59.2,64.4c-1.6,0.8-2.8,2.4-2.8,4v24.1c0,25.3,15.8,45.9,42.3,54.6 c0.4,0,0.8,0.4,1.2,0.4c0.4,0,0.8,0,1.2-0.4c26.5-8.7,42.3-28.9,42.3-54.6V68.3C143.5,66.8,142.3,65.2,140.8,64.4z`}})])},rt=[],Ht="";const pe={};var ut=x(_e,it,rt,!1,dt,"5511614f",null,null);function dt(e){for(let n in pe)this[n]=pe[n]}var vt=function(){return ut.exports}();const me={};me.setup=(e,n)=>{const t=n.emit;function s(a){t("click",a)}return{emitClickEvent:s}};var ft=function(){var e=this,n=e.$createElement,t=e._self._c||n;return t("svg",e._b({attrs:{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 200 200",width:"20",height:"20"},on:{click:e.emitClickEvent}},"svg",e.$attrs,!1),[t("path",{attrs:{fill:"#FFA000",d:`M184,26.6L102.4,2.1h-4.9L16,26.6c-3.3,1.6-5.7,4.9-5.7,8.2v49.8c0,52.2,32.6,94.7,87.3,112.6 c0.8,0,1.6,0.8,2.4,0.8s1.6,0,2.4-0.8c54.7-18,87.3-59.6,87.3-112.6V34.7C189.8,31.5,187.3,28.2,184,26.6z M107.3,109.1 c-0.5,5.4-3.9,7.9-7.3,7.9c-2.5,0,0,0,0,0c-3.2-0.6-5.7-2-6.8-7.4l-4.4-50.9c0-5.1,6.2-9.7,11.5-9.7c5.3,0,11,4.7,11,9.9 L107.3,109.1z M109.3,133.3c0,5.1-4.2,9.3-9.3,9.3c-5.1,0-9.3-4.2-9.3-9.3c0-5.1,4.2-9.3,9.3-9.3C105.1,124,109.3,128.1,109.3,133.3 z`}})])},ht=[],At="";const ge={};var _t=x(me,ft,ht,!1,pt,"3fd7b394",null,null);function pt(e){for(let n in ge)this[n]=ge[n]}var mt=function(){return _t.exports}();const ye={};ye.setup=(e,n)=>{const t=n.emit;function s(a){t("click",a)}return{emitClickEvent:s}};var gt=function(){var e=this,n=e.$createElement,t=e._self._c||n;return t("svg",e._b({attrs:{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 200 200",width:"20",height:"20"},on:{click:e.emitClickEvent}},"svg",e.$attrs,!1),[t("path",{attrs:{fill:"#ED4630",d:`M184,26.6L102.4,2.1h-4.9L16,26.6c-3.3,1.6-5.7,4.9-5.7,8.2v49.8c0,52.2,32.6,94.7,87.3,112.6 c0.8,0,1.6,0.8,2.4,0.8s1.6,0,2.4-0.8c54.7-18,87.3-59.6,87.3-112.6V34.7C189.8,31.5,187.3,28.2,184,26.6z M134.5,123.1 c3.1,3.1,3.1,8.2,0,11.3c-1.6,1.6-3.6,2.3-5.7,2.3s-4.1-0.8-5.7-2.3L100,111.3l-23.1,23.1c-1.6,1.6-3.6,2.3-5.7,2.3 c-2,0-4.1-0.8-5.7-2.3c-3.1-3.1-3.1-8.2,0-11.3L88.7,100L65.5,76.9c-3.1-3.1-3.1-8.2,0-11.3c3.1-3.1,8.2-3.1,11.3,0L100,88.7 l23.1-23.1c3.1-3.1,8.2-3.1,11.3,0c3.1,3.1,3.1,8.2,0,11.3L111.3,100L134.5,123.1z`}})])},yt=[],Nt="";const be={};var bt=x(ye,gt,yt,!1,Et,"6c20e1c2",null,null);function Et(e){for(let n in be)this[n]=be[n]}var wt=function(){return bt.exports}();const Ee={};Ee.setup=(e,n)=>{const t=n.emit;function s(a){t("click",a)}return{emitClickEvent:s}};var xt=function(){var e=this,n=e.$createElement,t=e._self._c||n;return t("svg",e._b({attrs:{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 200 200",width:"20",height:"20"},on:{click:e.emitClickEvent}},"svg",e.$attrs,!1),[t("path",{attrs:{fill:"#5EAA2F",d:`M183.3,27.2L102.4,2.9h-4.9L16.7,27.2C13.4,28.8,11,32,11,35.3v49.4c0,51.8,32.4,93.9,86.6,111.7 c0.8,0,1.6,0.8,2.4,0.8c0.8,0,1.6,0,2.4-0.8c54.2-17.8,86.6-59.1,86.6-111.7V35.3C189,32,186.6,28.8,183.3,27.2z M146.1,81.4 l-48.5,48.5c-1.6,1.6-3.2,2.4-5.7,2.4c-2.4,0-4-0.8-5.7-2.4L62,105.7c-3.2-3.2-3.2-8.1,0-11.3c3.2-3.2,8.1-3.2,11.3,0l18.6,18.6 l42.9-42.9c3.2-3.2,8.1-3.2,11.3,0C149.4,73.3,149.4,78.2,146.1,81.4L146.1,81.4z`}})])},$t=[],Ot="";const we={};var Lt=x(Ee,xt,$t,!1,kt,"5a795cd4",null,null);function kt(e){for(let n in we)this[n]=we[n]}var Ct=function(){return Lt.exports}();const xe=()=>({width:330,height:44,verticalPadding:12,horizontalPadding:16}),N={};N.props={config:{key:"config",required:!1,type:null,default:xe},clickEvent:{key:"clickEvent",required:!1,type:Function},disabled:{key:"disabled",required:!1,type:Boolean,default:!1},type:{key:"type",required:!1,type:null,default:"default"},title:{key:"title",required:!1,type:String,default:"\u70B9\u51FB\u6309\u952E\u8FDB\u884C\u9A8C\u8BC1"}},N.setup=(e,n)=>{const t=e,{type:s,title:a,disabled:c}=l.toRefs(t),d=l.ref({...xe(),...t.config});l.watch(()=>t.config,()=>{d.value={...d.value,...t.config}});const i=l.computed(()=>{const v=`gc-${s.value}`;return["go-captcha","gc-btn-block",v,c.value?"gc-disabled":""]}),r=l.computed(()=>({width:d.value.width+"px",height:d.value.height+"px",paddingLeft:d.value.horizontalPadding+"px",paddingRight:d.value.horizontalPadding+"px",paddingTop:d.value.verticalPadding+"px",paddingBottom:d.value.verticalPadding+"px"})),o=n.emit;function _(v){o("click-event",v)}return{type:s,title:a,btnClass:i,btnStyle:r,emitClickEvent:_}},N.components=Object.assign({BtnDefaultIcon:vt,BtnWarnIcon:mt,BtnErrorIcon:wt,BtnSuccessIcon:Ct},N.components);var St=function(){var e=this,n=e.$createElement,t=e._self._c||n;return t("div",{class:e.btnClass,style:e.btnStyle,on:{click:e.emitClickEvent}},[t("div",{class:e.type==="default"?"gc-ripple":""},[e.type==="default"?t("btn-default-icon"):e.type==="warn"?t("btn-warn-icon"):e.type==="error"?t("btn-error-icon"):e.type==="success"?t("btn-success-icon"):e._e()],1),t("span",[e._v(e._s(e.title))])])},Tt=[],Vt="";const $e={};var Ft=x(N,St,Tt,!1,Dt,null,null,null);function Dt(e){for(let n in $e)this[n]=$e[n]}var O=function(){return Ft.exports}();O.name="gocaptcha-button",O.install=function(e){e.component("gocaptcha-button",O)};const Bt={install(e){W.install(e),j.install(e),Y.install(e),A.install(e),O.install(e)}};$.Button=O,$.Click=W,$.Rotate=A,$.Slide=j,$.SlideRegion=Y,$.default=Bt,Object.defineProperties($,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});