(function(S,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(S=typeof globalThis<"u"?globalThis:S||self,e(S.VueBehavioralCaptcha={},S.vue))})(this,function(S,e){"use strict";const _=(t,n)=>{const a=t.__vccOpts||t;for(const[o,r]of n)a[o]=r;return a},F={},U={class:"z-icon-arrow-right",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 15.6 11.1",width:"1em",height:"1em",fill:"currentColor"},J=[e.createElementVNode("path",{d:`M9.3,10.9C9.1,10.6,9,10.4,9,10.1c0-0.3,0.1-0.5,0.3-0.7l2.8-2.8H1c-0.3,0-0.5-0.1-0.7-0.3C0.1,6.1,0,5.9,0,5.6 s0.1-0.5,0.3-0.7C0.5,4.7,0.7,4.6,1,4.6h11.1L9.3,1.7C9.1,1.5,9,1.3,9,1c0-0.3,0.1-0.5,0.3-0.7C9.5,0.1,9.7,0,10,0 c0.3,0,0.5,0.1,0.7,0.3l4.6,4.6c0.1,0.1,0.2,0.2,0.2,0.3c0,0.1,0.1,0.2,0.1,0.4s0,0.3-0.1,0.4c0,0.1-0.1,0.2-0.2,0.3l-4.6,4.6 c-0.2,0.2-0.4,0.3-0.7,0.3C9.7,11.1,9.5,11,9.3,10.9z`},null,-1)];function Z(t,n){return e.openBlock(),e.createElementBlock("svg",U,J)}const G=_(F,[["render",Z]]),K={},Q={class:"z-icon-check",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 8.5 6",width:"1em",height:"1em",fill:"currentColor"},ee=[e.createElementVNode("path",{d:`M3,6C2.9,6,2.7,6,2.6,5.9L0.1,3.4C0,3.2,0,2.8,0.1,2.6s0.5-0.2,0.7,0L3,4.8l4.6-4.6C7.8,0,8.2,0,8.4,0.1s0.2,0.5,0,0.7l-5,5 C3.3,6,3.1,6,3,6z`},null,-1)];function te(t,n){return e.openBlock(),e.createElementBlock("svg",Q,ee)}const A=_(K,[["render",te]]),ae={},ne={class:"z-icon-close",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 12",width:"1em",height:"1em",fill:"currentColor"},re=[e.createElementVNode("path",{d:`M7,6.1l3-3c0.3-0.3,0.3-0.8,0-1.1C9.7,1.5,9.2,1.5,8.9,2l0,0l-3,3l-3-3C2.6,1.7,2.1,1.7,1.8,2S1.5,2.8,1.8,3l3,3l-3,3 c-0.3,0.3-0.3,0.8,0,1.1s0.8,0.3,1.1,0l3-3l3,3c0.3,0.3,0.8,0.3,1.1,0c0.3-0.3,0.3-0.8,0-1.1L7,6.1z`},null,-1)];function oe(t,n){return e.openBlock(),e.createElementBlock("svg",ne,re)}const L=_(ae,[["render",oe]]),le={},ie={class:"z-icon-reload",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 10 10",width:"1em",height:"1em",fill:"currentColor"},se=[e.createElementVNode("path",{d:`M6.5,3h1.4C7.1,1.8,5.6,1.2,4.1,1.6C2.7,2,1.7,3.1,1.5,4.5c-0.2,1.9,1.1,3.7,3,3.9c1.9,0.2,3.7-1.1,3.9-3 C8.5,5.2,8.8,5,9,5c0.3,0,0.5,0.3,0.4,0.6C9.2,7.8,7.2,9.5,5,9.5c-0.2,0-0.4,0-0.6,0C2,9.1,0.2,6.9,0.5,4.4 c0.2-1.8,1.6-3.3,3.3-3.8c1.7-0.4,3.5,0.2,4.6,1.5V1c0-0.3,0.2-0.5,0.5-0.5S9.5,0.7,9.5,1v2.5C9.5,3.8,9.3,4,9,4H6.5 C6.2,4,6,3.8,6,3.5S6.2,3,6.5,3z`},null,-1)];function ce(t,n){return e.openBlock(),e.createElementBlock("svg",ie,se)}const de=_(le,[["render",ce]]),ue={},fe={class:"z-icon-image-error",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24"},he=[e.createElementVNode("path",{fill:"currentColor",d:"m7 19l5-5l1.88 1.88c-.55.91-.88 1.98-.88 3.12H7m3-8.5C10 9.67 9.33 9 8.5 9S7 9.67 7 10.5S7.67 12 8.5 12s1.5-.67 1.5-1.5m3.09 9.5H6V4h7v5h5v4.09c.33-.05.66-.09 1-.09c.34 0 .67.04 1 .09V8l-6-6H6a2 2 0 0 0-2 2v16c0 1.11.89 2 2 2h7.81c-.35-.61-.6-1.28-.72-2m8.03-4.54L19 17.59l-2.12-2.12l-1.41 1.41L17.59 19l-2.12 2.12l1.41 1.42L19 20.41l2.12 2.13l1.42-1.42L20.41 19l2.13-2.12l-1.42-1.42Z"},null,-1)];function ge(t,n){return e.openBlock(),e.createElementBlock("svg",fe,he)}const me=_(ue,[["render",ge]]),_t="",pe={},ye={class:"z-icon-loading"};function be(t,n){return e.openBlock(),e.createElementBlock("div",ye)}const we=_(pe,[["render",be],["__scopeId","data-v-e0dd307b"]]),Ce={class:"tip__text"},_e={key:0,class:"tip__anawer-text"},xe=e.defineComponent({__name:"PointControl",props:{width:{type:Number,required:!0},height:{type:Number,required:!0},borderRadius:{type:Number,required:!0},tipText:{type:String,required:!0},answer:{type:Array,required:!0},state:{type:String,required:!0},clickabled:{type:Boolean,required:!0}},emits:["refresh"],setup(t,{emit:n}){const a=t,o=e.computed(()=>a.state==="error"?L:a.state==="success"?A:null),r=e.computed(()=>a.answer.map(l=>`"${l}"`).join(" "));function i(){a.clickabled&&n("refresh")}return(l,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["point-control",`point-control--${t.state}`]),style:e.normalizeStyle({height:`${t.height}px`,borderRadius:`${t.borderRadius}px`})},[e.createElementVNode("div",{class:e.normalizeClass(["tip",{"tip--clickabled":t.clickabled}]),onClick:i},[e.unref(o)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(o)),{key:0,class:"tip__icon"})):e.createCommentVNode("",!0),e.createElementVNode("div",Ce,[e.createTextVNode(e.toDisplayString(t.tipText)+" ",1),t.answer.length?(e.openBlock(),e.createElementBlock("span",_e,e.toDisplayString(e.unref(r)),1)):e.createCommentVNode("",!0)])],2)],6))}}),xt="",ke=_(xe,[["__scopeId","data-v-53cad6fe"]]),Ee={class:"point"},Re={class:"point__text"},Se=e.defineComponent({__name:"Point",props:{value:{type:Number,required:!0}},setup(t){return(n,a)=>(e.openBlock(),e.createElementBlock("div",Ee,[e.createElementVNode("span",Re,e.toDisplayString(t.value),1)]))}}),kt="",$e=_(Se,[["__scopeId","data-v-3fa5de62"]]);function E(t,n,a=!1){return a?t+Math.random()*(n-t):(t=Math.ceil(t),n=Math.floor(n),Math.floor(t+Math.random()*(n-t)))}function Ne(t,n,a){return t<=n?n:t>=a?a:t}function Be(t,n,a,o){return Math.sqrt(Math.pow(t-a,2)+Math.pow(n-o,2))}function Te(t){let n=0;return t.forEach(a=>{n+=a}),n/t.length}function Ve(t){const n=Te(t);let a=0;return t.forEach(o=>{a+=Math.pow(o-n,2)}),a/t.length}function ve(t){const n=Ve(t);return Math.sqrt(n)}function ze(t){return typeof t=="number"&&Object.prototype.toString.call(t)==="[object Number]"}function Y(t,n){const a=[],o=[...t];n=n??t.length;for(let r=0;r{const o=new Image;o.onload=()=>n(o),o.onerror=()=>a("加载失败"),o.src=t})}function q(t){return t[E(0,t.length)]}const j="惨淡经营便宜从事嗷嗷待哺别无长物不寒而栗不刊之论弹冠相庆罪不容诛罄竹难书秦晋之好贻笑大方万人空巷豆蔻年华裹足不前不期而遇不落窠臼陈词滥调踌躇满志不胜枚举蠢蠢欲动登峰造极等量齐观耳濡目染耳闻目睹改弦更张顾此失彼釜底抽薪凤毛麟角短小精悍鬼斧神工海市蜃楼囫囵吞枣讳疾忌医讳莫如深明察秋毫明日黄花墨守成规扑朔迷离前车之鉴杀鸡取卵矢志不渝事倍功半殊途同归脱颖而出无懈可击无与伦比息息相关休戚与共循规蹈矩偃旗息鼓饮鸩止渴直截了当作茧自缚捉襟见肘白璧无瑕杯弓蛇影筚路蓝缕鞭辟入里鞭长莫及并驾齐驱束之高阁望其项背欣欣向荣文不加点鳞次栉比三人成虎一言九鼎蓬荜生辉不可理喻差强人意抛砖引玉忍俊不禁汗牛充栋不耻下问石破天惊侃侃而谈南辕北辙晨光熹微千钧一发信手拈来琳琅满目焕然一新草木皆兵赤膊上阵乌合之众四面楚歌坚壁清野引颈受戮如鲠在喉仰事俯畜人定胜天悬梁刺股咄咄逼人马到成功马革裹尸破釜沉舟晨钟暮鼓卷土重来投笔从戎前车之鉴",W="一乙二十丁厂七卜人入八九几儿了力乃刀又三于干亏士工土才寸下大丈与万上小口巾山千乞川亿个勺久凡及夕丸么广亡门义之尸弓己已子卫也女飞刃习叉马乡丰王井开夫天无元专云扎艺木五支厅不太犬区历尤友匹车巨牙屯比互切瓦止少日中冈贝内水见午牛手毛气升长仁什片仆化仇币仍仅斤爪反介父从今凶分乏公仓月氏勿欠风丹匀乌凤勾文六方火为斗忆订计户认心尺引丑巴孔队办以允予劝双书幻玉刊示末未击打巧正扑扒功扔去甘世古节本术可丙左厉右石布龙平灭轧东卡北占业旧帅归且旦目叶甲申叮电号田由史只央兄叼叫另叨叹四生失禾丘付仗代仙们仪白仔他斥瓜乎丛令用甩印乐句匆册犯外处冬鸟务包饥主市立闪兰半汁汇头汉宁穴它讨写让礼训必议讯记永司尼民出辽奶奴加召皮边发孕圣对台矛纠母幼丝式刑动扛寺吉扣考托老执巩圾扩扫地扬场耳共芒亚芝朽朴机权过臣再协西压厌在有百存而页匠夸夺灰达列死成夹轨邪划迈毕至此贞师尘尖劣光当早吐吓虫曲团同吊吃因吸吗屿帆岁回岂刚则肉网年朱先丢舌竹迁乔伟传乒乓休伍伏优伐延件任伤价份华仰仿伙伪自血向似后行舟全会杀合兆企众爷伞创肌朵杂危旬旨负各名多争色壮冲冰庄庆亦刘齐交次衣产决充妄闭问闯羊并关米灯州汗污江池汤忙兴宇守宅字安讲军许论农讽设访寻那迅尽导异孙阵阳收阶阴防奸如妇好她妈戏羽观欢买红纤级约纪驰巡寿弄麦形进戒吞远违运扶抚坛技坏扰拒找批扯址走抄坝贡攻赤折抓扮抢孝均抛投坟抗坑坊抖护壳志扭块声把报却劫芽花芹芬苍芳严芦劳克苏杆杠杜材村杏极李杨求更束豆两丽医辰励否还歼来连步坚旱盯呈时吴助县里呆园旷围呀吨足邮男困吵串员听吩吹呜吧吼别岗帐财针钉告我乱利秃秀私每兵估体何但伸作伯伶佣低你住位伴身皂佛近彻役返余希坐谷妥含邻岔肝肚肠龟免狂犹角删条卵岛迎饭饮系言冻状亩况床库疗应冷这序辛弃冶忘闲间闷判灶灿弟汪沙汽沃泛沟没沈沉怀忧快完宋宏牢究穷灾良证启评补初社识诉诊词译君灵即层尿尾迟局改张忌际陆阿陈阻附妙妖妨努忍劲鸡驱纯纱纳纲驳纵纷纸纹纺驴纽奉玩环武青责现表规抹拢拔拣担坦押抽拐拖拍者顶拆拥抵拘势抱垃拉拦拌幸招坡披拨择抬其取苦若茂苹苗英范直茄茎茅林枝杯柜析板松枪构杰述枕丧或画卧事刺枣雨卖矿码厕奔奇奋态欧垄妻轰顷转斩轮软到非叔肯齿些虎虏肾贤尚旺具果味昆国昌畅明易昂典固忠咐呼鸣咏呢岸岩帖罗帜岭凯败贩购图钓制知垂牧物乖刮秆和季委佳侍供使例版侄侦侧凭侨佩货依的迫质欣征往爬彼径所舍金命斧爸采受乳贪念贫肤肺肢肿胀朋股肥服胁周昏鱼兔狐忽狗备饰饱饲变京享店夜庙府底剂郊废净盲放刻育闸闹郑券卷单炒炊炕炎炉沫浅法泄河沾泪油泊沿泡注泻泳泥沸波泼泽治怖性怕怜怪学宝宗定宜审宙官空帘实试郎诗肩房诚衬衫视话诞询该详建肃录隶居届刷屈弦承孟孤陕降限妹姑姐姓始驾参艰线练组细驶织终驻驼绍经贯奏春帮珍玻毒型挂封持项垮挎城挠政赴赵挡挺括拴拾挑指垫挣挤拼挖按挥挪某甚革荐巷带草茧茶荒茫荡荣故胡南药标枯柄栋相查柏柳柱柿栏树要咸威歪研砖厘厚砌砍面耐耍牵残殃轻鸦皆背战点临览竖省削尝是盼眨哄显哑冒映星昨畏趴胃贵界虹虾蚁思蚂虽品咽骂哗咱响哈咬咳哪炭峡罚贱贴骨钞钟钢钥钩卸缸拜看矩怎牲选适秒香种秋科重复竿段便俩贷顺修保促侮俭俗俘信皇泉鬼侵追俊盾待律很须叙剑逃食盆胆胜胞胖脉勉狭狮独狡狱狠贸怨急饶蚀饺饼弯将奖哀亭亮度迹庭疮疯疫疤姿亲音帝施闻阀阁差养美姜叛送类迷前首逆总炼炸炮烂剃洁洪洒浇浊洞测洗活派洽染济洋洲浑浓津恒恢恰恼恨举觉宣室宫宪突穿窃客冠语扁袄祖神祝误诱说诵垦退既屋昼费陡眉孩除险院娃姥姨姻娇怒架贺盈勇怠柔垒绑绒结绕骄绘给络骆绝绞统耕耗艳泰珠班素蚕顽盏匪捞栽捕振载赶起盐捎捏埋捉捆捐损都哲逝捡换挽热恐壶挨耻耽恭莲莫荷获晋恶真框桂档桐株桥桃格校核样根索哥速逗栗配翅辱唇夏础破原套逐烈殊顾轿较顿毙致柴桌虑监紧党晒眠晓鸭晃晌晕蚊哨哭恩唤啊唉罢峰圆贼贿钱钳钻铁铃铅缺氧特牺造乘敌秤租积秧秩称秘透笔笑笋债借值倚倾倒倘俱倡候俯倍倦健臭射躬息徒徐舰舱般航途拿爹爱颂翁脆脂胸胳脏胶脑狸狼逢留皱饿恋桨浆衰高席准座脊症病疾疼疲效离唐资凉站剖竞部旁旅畜阅羞瓶拳粉料益兼烤烘烦烧烛烟递涛浙涝酒涉消浩海涂浴浮流润浪浸涨烫涌悟悄悔悦害宽家宵宴宾窄容宰案请朗诸读扇袜袖袍被祥课谁调冤谅谈谊剥恳展剧屑弱陵陶陷陪娱娘通能难预桑绢绣验继球理捧堵描域掩捷排掉堆推掀授教掏掠培接控探据掘职基著勒黄萌萝菌菜萄菊萍菠营械梦梢梅检梳梯桶救副票戚爽聋袭盛雪辅辆虚雀堂常匙晨睁眯眼悬野啦晚啄距跃略蛇累唱患唯崖崭崇圈铜铲银甜梨犁移笨笼笛符第敏做袋悠偿偶偷您售停偏假得衔盘船斜盒鸽悉欲彩领脚脖脸脱象够猜猪猎猫猛馅馆凑减毫麻痒痕廊康庸鹿盗章竟商族旋望率着盖粘粗粒断剪兽清添淋淹渠渐混渔淘液淡深婆梁渗情惜惭悼惧惕惊惨惯寇寄宿窑密谋谎祸谜逮敢屠弹随蛋隆隐婚婶颈绩绪续骑绳维绵绸绿琴斑替款堪搭塔越趁趋超提堤博揭喜插揪搜煮援裁搁搂搅握揉斯期欺联散惹葬葛董葡敬葱落朝辜葵棒棋植森椅椒棵棍棉棚棕惠惑逼厨厦硬确雁殖裂雄暂雅辈悲紫辉敞赏掌晴暑最量喷晶喇遇喊景践跌跑遗蛙蛛蜓喝喂喘喉幅帽赌赔黑铸铺链销锁锄锅锈锋锐短智毯鹅剩稍程稀税筐等筑策筛筒答筋筝傲傅牌堡集焦傍储奥街惩御循艇舒番释禽腊脾腔鲁猾猴然馋装蛮就痛童阔善羡普粪尊道曾焰港湖渣湿温渴滑湾渡游滋溉愤慌惰愧愉慨割寒富窜窝窗遍裕裤裙谢谣谦属屡强粥疏隔隙絮嫂登缎缓编骗缘瑞魂肆摄摸填搏塌鼓摆携搬摇搞塘摊蒜勤鹊蓝墓幕蓬蓄蒙蒸献禁楚想槐榆楼概赖酬感碍碑碎碰碗碌雷零雾雹输督龄鉴睛睡睬鄙愚暖盟歇暗照跨跳跪路跟遣蛾蜂嗓置罪罩错锡锣锤锦键锯矮辞稠愁筹签简毁舅鼠催傻像躲微愈遥腰腥腹腾腿触解酱痰廉新韵意粮数煎塑慈煤煌满漠源滤滥滔溪溜滚滨粱滩慎誉塞谨福群殿辟障嫌嫁叠缝缠静碧璃墙撇嘉摧截誓境摘摔聚蔽慕暮蔑模榴榜榨歌遭酷酿酸磁愿需弊裳颗嗽蜻蜡蝇蜘赚锹锻舞稳算箩管僚鼻魄貌膜膊膀鲜疑馒裹敲豪膏遮腐瘦辣竭端旗精歉熄熔漆漂漫滴演漏慢寨赛察蜜谱嫩翠熊凳骡缩慧撕撒趣趟撑播撞撤增聪鞋蕉蔬横槽樱橡飘醋醉震霉瞒题暴瞎影踢踏踩踪蝶蝴嘱墨镇靠稻黎稿稼箱箭篇僵躺僻德艘膝膛熟摩颜毅糊遵潜潮懂额慰劈操燕薯薪薄颠橘整融醒餐嘴蹄器赠默镜赞篮邀衡膨雕磨凝辨辩糖糕燃澡激懒壁避缴戴擦鞠藏霜霞瞧蹈螺穗繁辫赢糟糠燥臂翼骤鞭覆蹦镰翻鹰警攀蹲颤瓣爆疆壤耀躁嚼嚷籍魔灌蠢霸露囊罐",Me=W.length,Pe=j.length/4;function Ie(t=4){return Y(H(Me),t).map(a=>W.slice(a,a+1))}function Le(){const t=E(0,Pe)*4;return j.slice(t,t+4)}function De(){return"#"+E(0,16777215).toString(16).padEnd(6,"0")}function qe(t,n){t.save();const a=n.fontSize/2;t.translate(n.x+a,n.y+a),t.rotate(Math.PI/180*n.angle),t.fillStyle=n.color,t.textAlign="start",t.textBaseline="top",t.font=`bold ${n.fontSize}px sans-serif`,t.fillText(n.text,-a,-a),t.restore()}function Oe(t,n){const{x:a,y:o,r,rangle:i,img:l}=n,u=Math.min(l.width,l.height);t.arc(a+r,o+r,r,0,Math.PI*2),t.clip(),t.save(),t.translate(a+r,o+r),t.rotate(Math.PI/180*i),t.drawImage(l,0,0,u,u,-r,-r,r*2,r*2),t.restore()}function Xe(t,n){const{x:a,y:o,width:r,height:i,bulgeR:l,bulgeOffset:u}=n,s=Math.PI,c=l+u,d=Math.acos(u/l);t.beginPath(),t.moveTo(a,o+c),t.arc(a+r/2,o+l,l,.5*s+d,.5*s-d),t.lineTo(a+r,o+c),t.arc(a+r+u,o+c+i/2,l,s+d,s-d),t.lineTo(a+r,o+c+i),t.arc(a+r/2,o+i+l,l,.5*s-d,.5*s+d,!0),t.lineTo(a,o+i+c),t.lineTo(a,o+c)}function Ae(t,n){const{x:a,y:o,width:r,height:i,radius:l}=n;t.beginPath(),t.moveTo(a+l,o),t.arcTo(a+r,o,a+r,o+i,l),t.arcTo(a+r,o+i,a,o+i,l),t.arcTo(a,o+i,a,o,l),t.arcTo(a,o,a+r,o,l)}function P(t,n){const{type:a}=n;a==="jigsaw"?Xe(t,n):Ae(t,n)}function Ye(t,n){const{x:a,y:o,width:r,height:i}=n;t.save(),P(t,n),t.globalAlpha=.8,t.fillStyle="#ffffff",t.fill(),t.restore(),t.save(),t.globalCompositeOperation="source-atop",P(t,n),t.arc(a+Math.ceil(r/2),o+Math.ceil(i/2),r*1.2,0,Math.PI*2,!0),t.shadowColor="#000",t.shadowOffsetX=2,t.shadowOffsetY=2,t.shadowBlur=16,t.fill(),t.restore()}function He(t,n){const{x:a,y:o,width:r,height:i,img:l,canvasHeight:u,canvasWidth:s,safePadding:c}=n;t.save(),P(t,{...n,x:c}),t.closePath(),t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor="#000",t.shadowBlur=3,t.fill(),t.clip(),t.drawImage(l,a-c,0,s,u,0,0,s,u),t.globalCompositeOperation="source-atop",P(t,{...n,x:c}),t.arc(c+Math.ceil(r/2),o+Math.ceil(i/2),r*1.2,0,Math.PI*2,!0),t.closePath(),t.shadowColor="rgba(255, 255, 255, .8)",t.shadowOffsetX=-1,t.shadowOffsetY=-1,t.shadowBlur=12,t.fillStyle="#ffffaa",t.fill(),t.restore()}const je={class:"load-container"},We={class:"load-text"},Fe={class:"top-container"},Ue={class:"top-btn-list"},Je=["disabled"],Ze=e.defineComponent({__name:"CaptchaContainer",props:{width:{type:Number,required:!0},height:{type:Number,required:!0},borderRadius:{type:[Number,String],default:0},loading:{type:Boolean,default:!1},loadingText:{type:String,default:"加载中…"},loadingError:{type:String,default:"加载失败"},refreshVisible:{type:Boolean,default:!1},refreshDisabled:{type:Boolean,default:!1}},emits:["refresh","click:canvas"],setup(t,{emit:n}){const a=t,o=e.computed(()=>a.loading?we:me),r=e.computed(()=>a.loading?a.loadingText:a.loadingError),i=e.computed(()=>{const{width:s,height:c,borderRadius:d}=a,g=ze(d)?`${d}px`:d;return{width:`${s}px`,height:`${c}px`,borderRadius:g}}),l=e.ref();function u(s){const{left:c,top:d}=l.value.getBoundingClientRect(),g=s.clientX-c,f=s.clientY-d;n("click:canvas",g,f,s)}return(s,c)=>(e.openBlock(),e.createElementBlock("div",{class:"captcha-container",style:e.normalizeStyle(e.unref(i))},[e.createElementVNode("div",{ref_key:"imgContainerRef",ref:l,class:"img-container",onClick:u},[e.renderSlot(s.$slots,"default",{},void 0,!0)],512),e.withDirectives(e.createElementVNode("div",je,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(o)),{class:"load-icon"})),e.createElementVNode("div",We,e.toDisplayString(e.unref(r)),1)],512),[[e.vShow,t.loading||t.loadingError]]),e.createElementVNode("div",Fe,[e.createElementVNode("div",Ue,[e.withDirectives(e.createElementVNode("button",{class:"top-btn",type:"button",title:"刷新",disabled:t.refreshDisabled,onClick:c[0]||(c[0]=d=>s.$emit("refresh"))},[e.createVNode(e.unref(de),{class:"top-btn__icon"})],8,Je),[[e.vShow,t.refreshVisible]])])])],4))}}),Et="",O=_(Ze,[["__scopeId","data-v-7c0a1201"]]);function v(t,n){e.onMounted(()=>{window.addEventListener(t,n)}),e.onBeforeUnmount(()=>{window.removeEventListener(t,n)})}function Ge(t,n,a,o=26,r=36,i=15){const l=r*1.6,u=Math.floor((t-i*2)/l),s=Math.floor((n-i*2)/l),c=Y(H(u*s),a.length);function d(f,p){const m=(t-u*l)/2+f*l,y=m+l-p;return E(m,y)}function g(f,p){const m=(n-s*l)/2+f*l,y=m+l-p;return E(m,y)}return c.map((f,p)=>{const m=f%u,y=Math.floor(f/u),h=E(o,r);return{x:d(m,h),y:g(y,h),text:a[p],fontSize:h,color:De(),angle:E(-90,90)}})}function Ke(t,n,a,o){const r=e.ref();let i=null;const l=e.ref([]),u=e.ref([]),s=e.reactive({loadingError:"",loading:!1});async function c(){l.value=[],u.value=[],s.loading=!0,s.loadingError="";let f=[];a.value==="order"?f=Ie(5):f=Le().split(""),l.value=Ge(t.value,n.value,f);const p=q(o.value);i.clearRect(0,0,t.value,n.value);try{const m=await D(p);i.drawImage(m,0,0,t.value,n.value,0,0,t.value,n.value),l.value.forEach(y=>{qe(i,y)})}catch(m){throw s.loadingError=m,m}finally{s.loading=!1}}function d(){let f=!0;return u.value.forEach((p,m)=>{const{text:y,inRange:h}=g(p.x,p.y);(!h||l.value[m].text!==y)&&(f=!1)}),f}function g(f,p){let m="",y=!1,h=-1;return l.value.forEach(b=>{const w=Be(b.x+b.fontSize/2,b.y+b.fontSize/2,f,p);(h<0||w{i=r.value.getContext("2d")}),{imgCanvasRef:r,textList:l,pointList:u,state:s,initCaptcha:c,validateCaptcha:d}}function Qe(t,n){const a=e.reactive({loadingError:"",loading:!1}),o=e.ref();let r=null;const i=e.ref(0);let l=0;async function u(){a.loading=!0,a.loadingError="",i.value=0,l=E(10,350);const c=q(n.value);r.clearRect(0,0,t.value,t.value);try{const d=await D(c);Oe(r,{x:0,y:0,r:t.value/2,rangle:l,img:d})}catch(d){throw a.loadingError=d,d}finally{a.loading=!1}}function s(c){return Math.abs(l+i.value-360){r=o.value.getContext("2d")}),{imgCanvasRef:o,state:a,imgAngle:i,initCaptcha:u,validateCaptcha:s}}function et(t,n,a){const o=e.computed(()=>n.value/5),r=e.computed(()=>o.value*Math.cos(.7)),i=e.computed(()=>t.value==="jigsaw"?n.value+o.value+r.value:n.value),l=e.computed(()=>i.value+a*2);return{bulgeR:o,bulgeOffset:r,blockBaseWidth:i,blockRealWidth:l}}function tt(t,n,a,o,r,i){const{bulgeR:s,bulgeOffset:c,blockBaseWidth:d,blockRealWidth:g}=et(a,o,2),f=e.reactive({loadingError:"",loading:!1}),p=e.ref(),m=e.ref(),y=e.ref();let h=null,b=null,w=null;const k=e.ref(0);let x=0;async function N(){f.loading=!0,f.loadingError="",k.value=0;const C=E(g.value+4,t.value-4-d.value),T=E(4,n.value-4-d.value);x=C-2;const M=q(i.value);V();try{const $=await D(M);R(h,$),B(b,$,C,T),I(w,$,C,T)}catch($){throw f.loadingError=$,$}finally{f.loading=!1}}function V(){h.clearRect(0,0,t.value,n.value),b.clearRect(0,0,t.value,n.value),w.clearRect(0,0,t.value,n.value)}function R(C,T){C.drawImage(T,0,0,t.value,n.value,0,0,t.value,n.value)}function B(C,T,M,$){Ye(C,{type:a.value,x:M,y:$,width:o.value,height:o.value,bulgeR:s.value,bulgeOffset:c.value,radius:r.value}),C.save(),C.globalCompositeOperation="destination-over",C.drawImage(T,0,0,t.value,n.value,0,0,t.value,n.value),C.restore()}function I(C,T,M,$){He(C,{type:a.value,x:M,y:$,width:o.value,height:o.value,bulgeR:s.value,bulgeOffset:c.value,radius:r.value,img:T,canvasHeight:n.value,canvasWidth:g.value,safePadding:2})}function z(C){return Math.abs(x-k.value){h=p.value.getContext("2d"),b=m.value.getContext("2d"),w=y.value.getContext("2d")}),{fullCanvasRef:p,bgCanvasRef:m,blockCanvasRef:y,blockLeft:k,state:f,blockRealWidth:g,initCaptcha:N,validateCaptcha:z}}const at=["width","height"],nt=e.defineComponent({__name:"PointCaptcha",props:{width:{type:Number,default:320},height:{type:Number,default:160},borderRadius:{type:Number,default:2},type:{type:String,default:"order"},maxErrorText:{type:String,default:"失败过多,点击重试"},loadingText:{type:String,default:"加载中…"},imgList:{type:Array,default:()=>["https://picsum.photos/id/20/320/160.webp","https://picsum.photos/id/30/320/160.webp","https://picsum.photos/id/40/320/160.webp","https://picsum.photos/id/50/320/160.webp","https://picsum.photos/id/60/320/160.webp"]}},emits:["success","fail"],setup(t,{emit:n}){const a=t,{imgCanvasRef:o,pointList:r,textList:i,state:l,initCaptcha:u,validateCaptcha:s}=Ke(e.toRef(a,"width"),e.toRef(a,"height"),e.toRef(a,"type"),e.toRef(a,"imgList"));let c=0;const d=e.ref(!1),g=e.ref("ready"),f=e.computed(()=>l.loading?a.loadingText:l.loadingError?l.loadingError:d.value?a.maxErrorText:g.value==="error"?"验证失败请重试":g.value==="success"?"验证成功":a.type==="idiom"?"请按语序依次点击文字":"请依次点击"),p=e.computed(()=>a.type==="idiom"?4:3),m=e.computed(()=>r.value.length>=p.value||l.loading||l.loadingError!==""),y=e.computed(()=>d.value||l.loadingError!==""),h=e.computed(()=>g.value!=="success"),b=e.computed(()=>l.loading),w=e.computed(()=>a.type==="order"&&g.value==="ready"&&!l.loading&&!l.loadingError?i.value.map(R=>R.text).slice(0,3):[]);function k(){s()?(g.value="success",c=0,n("success")):(g.value="error",c+=1,n("fail"),c<5?x():d.value=!0)}async function x(){d.value=!1;try{await u(),g.value="ready"}catch{g.value="error"}}e.onMounted(()=>{x()});function N(R,B){m.value||(r.value.push({x:R,y:B}),r.value.length>=p.value&&e.nextTick(k))}function V(R,B){m.value||R===r.value.length-1&&(r.value.pop(),B.stopPropagation())}return(R,B)=>(e.openBlock(),e.createElementBlock("div",{class:"z-point-captcha",style:e.normalizeStyle({width:`${t.width}px`})},[e.createVNode(O,{width:t.width,height:t.height,"border-radius":t.borderRadius,loading:e.unref(l).loading,"loading-error":e.unref(l).loadingError,"loading-text":t.loadingText,"refresh-visible":e.unref(h),"refresh-disabled":e.unref(b),"onClick:canvas":N,onRefresh:x},{default:e.withCtx(()=>[e.createElementVNode("canvas",{ref_key:"imgCanvasRef",ref:o,class:"canvas-img",width:t.width,height:t.height},null,8,at),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(r),(I,z)=>(e.openBlock(),e.createBlock($e,{key:z,value:z+1,style:e.normalizeStyle({left:`${I.x}px`,top:`${I.y}px`}),onClick:C=>V(z,C)},null,8,["value","style","onClick"]))),128))]),_:1},8,["width","height","border-radius","loading","loading-error","loading-text","refresh-visible","refresh-disabled"]),e.createVNode(ke,{width:t.width,height:40,"border-radius":t.borderRadius,"tip-text":e.unref(f),answer:e.unref(w),state:g.value,clickabled:e.unref(y),onRefresh:x},null,8,["width","border-radius","tip-text","answer","state","clickabled"])],4))}}),Rt="",rt=_(nt,[["__scopeId","data-v-fd8a3107"]]),ot={class:"slider-tip__text"},lt=e.defineComponent({__name:"SlideControl",props:{modelValue:{type:Number,required:!0},min:{type:Number,default:0},max:{type:Number,default:100},width:{type:Number,required:!0},height:{type:Number,required:!0},borderRadius:{type:Number,required:!0},tipText:{type:String,required:!0},state:{type:String,default:"ready"},maxError:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","refresh","finish"],setup(t,{emit:n}){const a=t,o=e.computed(()=>a.disabled||a.state==="success"||a.state==="error"),r=e.ref(!1),i={pageX:0,value:0};let l=[];const u=e.computed(()=>{const{modelValue:h,min:b,max:w,height:k,width:x}=a;return(h-b)/(w-b)*(x-k)+k}),s=e.computed(()=>a.state==="success"?A:a.state==="error"?L:G),c=e.computed(()=>r.value||a.state==="success"?"":a.tipText);function d(h){return"pageX"in h?h.pageX:h.changedTouches[0].pageX}function g(h){return"pageY"in h?h.pageY:h.changedTouches[0].pageY}function f(h){o.value||(r.value=!0,i.pageX=d(h),i.value=a.modelValue,l=[])}function p(h){if(!r.value||o.value)return;const{min:b,max:w,height:k,width:x}=a,N=d(h),V=g(h);l.push(V);const R=(N-i.pageX)/(x-k)*(w-b),B=Ne(R+i.value,b,w);n("update:modelValue",B)}function m(){if(!r.value||o.value)return;r.value=!1;const h=ve(l);n("finish",h)}function y(){a.maxError&&n("refresh")}return v("mousemove",p),v("mouseup",m),v("touchmove",p),v("touchend",m),v("blur",m),(h,b)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["slide-control",{"slide-control--error":t.maxError}]),style:e.normalizeStyle({height:`${t.height}px`,borderRadius:`${t.borderRadius}px`})},[e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(["slider-bar",{[`slider-bar--${t.state}`]:!0,"slider-bar--moving":r.value}]),style:e.normalizeStyle({width:`${e.unref(u)}px`,height:`${t.height}px`,borderRadius:`${t.borderRadius}px`})},[e.createElementVNode("div",{class:e.normalizeClass(["slider-btn",{"slider-btn--disabled":e.unref(o)}]),style:e.normalizeStyle({width:`${t.height-2}px`,borderRadius:`${t.borderRadius}px`}),onMousedown:f,onTouchstart:f},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(s))))],38)],6),[[e.vShow,!t.maxError]]),e.withDirectives(e.createElementVNode("div",{class:"slider-tip",style:e.normalizeStyle({paddingLeft:`${t.maxError?0:t.height-2}px`}),onClick:y},[t.maxError?(e.openBlock(),e.createBlock(e.unref(L),{key:0,class:"slider-tip__icon"})):e.createCommentVNode("",!0),e.createElementVNode("span",ot,e.toDisplayString(e.unref(c)),1)],4),[[e.vShow,e.unref(c)]])],6))}}),St="",X=_(lt,[["__scopeId","data-v-e3c548fb"]]),it=["width","height"],st=e.defineComponent({__name:"RotateCaptcha",props:{width:{type:Number,default:320},range:{type:Number,default:3},sliderSize:{type:Number,default:40},borderRadius:{type:Number,default:2},imgList:{type:Array,default:()=>["https://picsum.photos/id/20/320.webp","https://picsum.photos/id/30/320.webp","https://picsum.photos/id/40/320.webp","https://picsum.photos/id/50/320.webp","https://picsum.photos/id/60/320.webp"]},tipText:{type:String,default:"拖动滑块旋转到正确位置"},maxErrorText:{type:String,default:"失败过多,点击重试"},loadingText:{type:String,default:"加载中…"}},emits:["success","fail"],setup(t,{emit:n}){const a=t,{imgCanvasRef:o,state:r,imgAngle:i,initCaptcha:l,validateCaptcha:u}=Qe(e.toRef(a,"width"),e.toRef(a,"imgList")),s=e.ref("ready");let c=0;const d=e.ref(!1),g=e.computed(()=>r.loading?a.loadingText:r.loadingError?r.loadingError:d.value?a.maxErrorText:a.tipText);async function f(){d.value=!1;try{await l(),s.value="ready"}catch{s.value="error"}}function p(){u(a.range)?(s.value="success",c=0,n("success")):(s.value="error",c+=1,n("fail"),c<5?f():d.value=!0)}return e.onMounted(()=>{f()}),(m,y)=>(e.openBlock(),e.createElementBlock("div",{class:"z-rotate-captcha",style:e.normalizeStyle({width:`${t.width}px`})},[e.createVNode(O,{width:t.width,height:t.width,"border-radius":"50%",loading:e.unref(r).loading,"loading-error":e.unref(r).loadingError,"loading-text":t.loadingText,onRefresh:f},{default:e.withCtx(()=>[e.createElementVNode("canvas",{ref_key:"imgCanvasRef",ref:o,class:"canvas-img",width:t.width,height:t.width,style:e.normalizeStyle({transform:`rotate(${e.unref(i)}deg)`})},null,12,it)]),_:1},8,["width","height","loading","loading-error","loading-text"]),e.createVNode(X,{modelValue:e.unref(i),"onUpdate:modelValue":y[0]||(y[0]=h=>e.isRef(i)?i.value=h:null),width:t.width,height:t.sliderSize,"border-radius":t.borderRadius,max:360,state:s.value,"tip-text":e.unref(g),"max-error":d.value,disabled:e.unref(r).loading,onFinish:p,onRefresh:f},null,8,["modelValue","width","height","border-radius","state","tip-text","max-error","disabled"])],4))}}),$t="",ct=_(st,[["__scopeId","data-v-f1139e78"]]),dt=e.defineComponent({__name:"SlideCaptcha",props:{width:{type:Number,default:320},borderRadius:{type:Number,default:2},sliderSize:{type:Number,default:40},tipText:{type:String,default:"向右滑动"},maxErrorText:{type:String,default:"失败过多,点击重试"}},emits:["success","fail"],setup(t,{emit:n}){const a=t,o=e.ref("ready"),r=e.ref(0);let i=0;const l=e.ref(!1),u=e.computed(()=>l.value?a.maxErrorText:a.tipText);function s(){l.value=!1,r.value=0,o.value="ready"}function c(d){r.value===100&&d>0?(o.value="success",i=0,n("success")):(o.value="error",i+=1,n("fail"),setTimeout(()=>{i<5?s():l.value=!0},200))}return e.onMounted(()=>{s()}),(d,g)=>(e.openBlock(),e.createElementBlock("div",{class:"z-slide-captcha",style:e.normalizeStyle({width:`${t.width}px`})},[e.createVNode(X,{modelValue:r.value,"onUpdate:modelValue":g[0]||(g[0]=f=>r.value=f),width:t.width,height:t.sliderSize,"border-radius":t.borderRadius,state:o.value,"tip-text":e.unref(u),"max-error":l.value,onFinish:c,onRefresh:s},null,8,["modelValue","width","height","border-radius","state","tip-text","max-error"])],4))}}),ut=["width","height"],ft=["width","height"],ht=["width","height"],gt=e.defineComponent({__name:"SlidePuzzleCaptcha",props:{width:{type:Number,default:320},height:{type:Number,default:160},borderRadius:{type:Number,default:2},blockSize:{type:Number,default:40},blockType:{type:String,default:"jigsaw"},blockRadius:{type:Number,default:5},sliderSize:{type:Number,default:40},range:{type:Number,default:4},imgList:{type:Array,default:()=>["https://picsum.photos/id/20/320/160.webp","https://picsum.photos/id/30/320/160.webp","https://picsum.photos/id/40/320/160.webp","https://picsum.photos/id/50/320/160.webp","https://picsum.photos/id/60/320/160.webp"]},tipText:{type:String,default:"向右拖动滑块填充拼图"},maxErrorText:{type:String,default:"失败过多,点击重试"},loadingText:{type:String,default:"加载中…"}},emits:["success","fail"],setup(t,{emit:n}){const a=t,{fullCanvasRef:o,bgCanvasRef:r,blockCanvasRef:i,blockLeft:l,state:u,blockRealWidth:s,initCaptcha:c,validateCaptcha:d}=tt(e.toRef(a,"width"),e.toRef(a,"height"),e.toRef(a,"blockType"),e.toRef(a,"blockSize"),e.toRef(a,"blockRadius"),e.toRef(a,"imgList")),g=e.ref("ready");let f=0;const p=e.ref(!1),m=e.computed(()=>u.loading?a.loadingText:u.loadingError?u.loadingError:p.value?a.maxErrorText:a.tipText),y=e.computed(()=>g.value!=="success"),h=e.computed(()=>u.loading),b=e.computed(()=>a.width-s.value);async function w(){p.value=!1;try{await c(),g.value="ready"}catch{g.value="error"}}function k(){d(a.range)?(g.value="success",f=0,n("success")):(g.value="error",f+=1,n("fail"),f<5?w():p.value=!0)}return e.onMounted(()=>{w()}),(x,N)=>(e.openBlock(),e.createElementBlock("div",{class:"z-slide-puzzle-captcha",style:e.normalizeStyle({width:`${t.width}px`})},[e.createVNode(O,{width:t.width,height:t.height,"border-radius":t.borderRadius,loading:e.unref(u).loading,"loading-error":e.unref(u).loadingError,"loading-text":t.loadingText,"refresh-visible":e.unref(y),"refresh-disabled":e.unref(h),onRefresh:w},{default:e.withCtx(()=>[e.createElementVNode("canvas",{ref_key:"bgCanvasRef",ref:r,class:"canvas-bg",width:t.width,height:t.height},null,8,ut),e.createElementVNode("canvas",{ref_key:"blockCanvasRef",ref:i,class:"canvas-block",width:e.unref(s),height:t.height,style:e.normalizeStyle({left:`${e.unref(l)}px`})},null,12,ft),e.createElementVNode("canvas",{ref_key:"fullCanvasRef",ref:o,class:"canvas-full",width:t.width,height:t.height,style:e.normalizeStyle({opacity:g.value==="success"?"1":""})},null,12,ht)]),_:1},8,["width","height","border-radius","loading","loading-error","loading-text","refresh-visible","refresh-disabled"]),e.createVNode(X,{modelValue:e.unref(l),"onUpdate:modelValue":N[0]||(N[0]=V=>e.isRef(l)?l.value=V:null),width:t.width,height:t.sliderSize,"border-radius":t.borderRadius,max:e.unref(b),state:g.value,"tip-text":e.unref(m),"max-error":p.value,disabled:e.unref(u).loading,onFinish:k,onRefresh:w},null,8,["modelValue","width","height","border-radius","max","state","tip-text","max-error","disabled"])],4))}}),Nt="",mt=_(gt,[["__scopeId","data-v-c0cd0549"]]);S.PointCaptcha=rt,S.RotateCaptcha=ct,S.SlideCaptcha=dt,S.SlidePuzzleCaptcha=mt,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})});