import{i as E,a as y}from"./app-JmgyQoR0.js";import{b,a as p,c as o,e as g,w as x,$ as V,D as B,h as d,t as u,K as C,E as M,z as j,l as N,H as D,u as S}from"./vue-y3KLWBaS.js";const T={key:0},I=b({__name:"MkCaptcha",props:{provider:{},sitekey:{},modelValue:{}},emits:["update:modelValue"],setup(h,{expose:m,emit:v}){const e=h,f=v,a=p(!1),c=p(),l=o(()=>{switch(e.provider){case"hcaptcha":return"hcaptcha";case"recaptcha":return"grecaptcha"}}),k=!!window[l.value],w=o(()=>{switch(e.provider){case"hcaptcha":return"https://js.hcaptcha.com/1/api.js?render=explicit&recaptchacompat=off";case"recaptcha":return"https://www.recaptcha.net/recaptcha/api.js?render=explicit"}}),t=o(()=>window[l.value]||{});k?a.value=!0:(document.getElementById(e.provider)||document.head.appendChild(Object.assign(document.createElement("script"),{async:!0,id:e.provider,src:w.value}))).addEventListener("load",()=>a.value=!0);function i(){t.value.reset&&t.value.reset()}function r(){t.value.render&&c.value instanceof Element?t.value.render(c.value,{sitekey:e.sitekey,theme:y.state.darkMode?"dark":"light",callback:s,"expired-callback":s,"error-callback":s}):window.setTimeout(r,1)}function s(n){f("update:modelValue",typeof n=="string"?n:null)}return g(()=>{a.value?r():x(a,r)}),V(()=>{i()}),m({reset:i}),(n,q)=>{const _=B("MkEllipsis");return d(),u("div",null,[a.value?D("",!0):(d(),u("span",T,[C(M(j(E).ts.waiting),1),N(_)])),S("div",{ref_key:"captchaEl",ref:c},null,512)])}}});export{I as _};
