import{b as E,v as y}from"./app-QjDgb7aF.js";import{b,c as g,w as x,Z as V,j as p,p as d,J as j,D as B,u as C,k as M,H as N,q,a as u,f as o,E as D}from"./vue-Cm77DuTi.js";const S={key:0},J=b({__name:"MkCaptcha",props:{provider:{},sitekey:{},modelValue:{}},emits:["update:modelValue"],setup(m,{expose:h,emit:v}){const e=m,f=v,a=u(!1),c=u(),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()}),h({reset:i}),(n,T)=>{const _=D("MkEllipsis");return p(),d("div",null,[a.value?N("",!0):(p(),d("span",S,[j(B(C(E).ts.waiting),1),M(_)])),q("div",{ref_key:"captchaEl",ref:c},null,512)])}}});export{J as _};
//# sourceMappingURL=MkCaptcha.vue_vue_type_script_setup_true_lang-BXhUIZsD.js.map
