1import{p as Y,aI as j,P as W,_ as G,a as $,o as z,y as K,h as x,i as w,k as v,$ as A,a7 as F,aJ as P,r as D,g as L,b as H}from"./e3jp4aij.js";import{_ as J}from"./CzHeHbBU.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"ecos-frontend-cp@12213eb99e1069e82980933c1ec51c50139958dd"};var n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="bd09b2f6-9b5f-489d-b755-db251bd7aaa6",e._sentryDebugIdIdentifier="sentry-dbid-bd09b2f6-9b5f-489d-b755-db251bd7aaa6")}catch{}})();const X=/^[a-z0-9_-]{1,32}$/u;function ge(e){return e===!0||e==="true"}function q(e){return X.test(e)}const Q="https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit",C="ecos-turnstile-api",Z=8e3,B=[500,1e3],U=B.length+1;class M extends Error{attempts;constructor(n,i){super(n),this.name="TurnstileLoadError",this.attempts=i}}function ee(e){return typeof e!="object"||e===null?!1:typeof Reflect.get(e,"ready")=="function"&&typeof Reflect.get(e,"render")=="function"&&typeof Reflect.get(e,"execute")=="function"&&typeof Reflect.get(e,"reset")=="function"&&typeof Reflect.get(e,"remove")=="function"&&typeof Reflect.get(e,"getResponse")=="function"&&typeof Reflect.get(e,"isExpired")=="function"}function te(e,n){return new Promise(i=>{e.schedule(i,n)})}function re(e){return new Promise((n,i)=>{let t=!1,c;const d=e.schedule(()=>{f("Cloudflare Turnstile did not become ready before the load timeout")},Z);function E(o){t||(t=!0,d(),n(o))}function f(o){t||(t=!0,d(),e.removeScript(C),c&&(e.invalidateApi(c),c=void 0),i(new Error(o)))}function a(o){if(!t){c=o;try{o.ready(()=>E(o))}catch{f("Cloudflare Turnstile readiness check failed")}}}const p=e.getApi();if(p){a(p);return}try{e.removeScript(C),e.appendScript({async:!1,defer:!1,id:C,src:Q,onLoad:()=>{const o=e.getApi();if(!o){f("Cloudflare Turnstile script loaded without exposing its API");return}a(o)},onError:()=>f("Cloudflare Turnstile script failed to load")})}catch{f("Cloudflare Turnstile script could not be added to the page")}})}function ne(e){let n;const i=async()=>{for(let t=1;t<=U;t+=1)try{return await re(e)}catch{const c=B[t-1];if(c===void 0)break;await te(e,c)}throw new M(`Cloudflare Turnstile failed to load after ${U} attempts`,U)};return()=>{if(n)return n;const t=i();return n=t,t.then(()=>{n===t&&(n=void 0)},()=>{n===t&&(n=void 0)}),t}}function ie(e,n){return{getApi:()=>{const i=Reflect.get(e,"turnstile");return ee(i)?i:void 0},invalidateApi:i=>{Reflect.get(e,"turnstile")===i&&(Reflect.deleteProperty(e,"turnstile")||Reflect.set(e,"turnstile",void 0))},appendScript:({async:i,defer:t,id:c,src:d,onLoad:E,onError:f})=>{const a=n.createElement("script");a.id=c,a.src=d,a.async=i,a.defer=t,a.addEventListener("load",E,{once:!0}),a.addEventListener("error",f,{once:!0}),n.head.append(a)},removeScript:i=>n.getElementById(i)?.remove(),schedule:(i,t)=>{const c=e.setTimeout(i,t);return()=>e.clearTimeout(c)}}}let V;function oe(){return typeof window>"u"||typeof document>"u"?Promise.reject(new M("Cloudflare Turnstile can only be loaded in a browser",0)):(V??=ne(ie(window,document)),V())}const ae=["data-state"],se={key:0,class:"auth-turnstile__status",role:"status","aria-live":"polite"},ce={key:1,class:"auth-turnstile__error",role:"alert"},le=25e3,ue=2e3,de=Y({__name:"SafeTurnstile",props:P({context:{default:"auth"}},{modelValue:{},modelModifiers:{}}),emits:P(["state-change"],["update:modelValue"]),setup(e,{expose:n,emit:i}){const t=e,c=i,d=j(e,"modelValue"),E=H(),{locale:f,t:a}=W(),p=D(null),o=D("loading");let y,m,s=0,h,l=!1;G({link:[{rel:"preconnect",href:"https://challenges.cloudflare.com"}]});function u(r){o.value!==r&&(o.value=r,c("state-change",r))}function b(){h!==void 0&&(clearTimeout(h),h=void 0)}function g(){d.value=void 0}function _(r){h===void 0&&(h=setTimeout(()=>{h=void 0,!l&&s===r&&!d.value&&(s+=1,S(),u("error"))},le))}function S(){if(b(),y&&m)try{y.remove(m)}catch(r){console.warn("[TURNSTILE] Widget cleanup failed",{context:t.context,message:r instanceof Error?r.message:"Unknown Turnstile cleanup error"})}m=void 0,p.value?.replaceChildren()}async function N(){const r=++s;g(),u("loading");const I=E.public.cpTurnstileSiteKey;if(!I||!p.value||!q(t.context)){u("error");return}try{if(y=await oe(),l||s!==r||!p.value)return;const T=y.render(p.value,{action:t.context,sitekey:I,language:f.value,retry:"auto","retry-interval":ue,"refresh-expired":"auto","refresh-timeout":"auto","response-field":!1,"before-interactive-callback":()=>{l||s!==r||b()},"after-interactive-callback":()=>{l||s!==r||d.value||_(r)},callback:k=>{l||s!==r||(b(),d.value=k,u("verified"))},"error-callback":k=>{if(!(l||s!==r))return g(),u("retrying"),_(r),console.warn("[TURNSTILE] Widget verification failed",{context:t.context,code:k}),!0},"expired-callback":()=>{l||s!==r||(g(),u("retrying"),_(r))},"timeout-callback":()=>{l||s!==r||(g(),u("retrying"),_(r))},"unsupported-callback":()=>{l||s!==r||(b(),g(),u("error"))}});if(!T)throw new Error("Cloudflare Turnstile did not return a widget ID");m=T,o.value==="loading"&&u("ready"),d.value||_(r)}catch(T){if(l||s!==r)return;g(),S(),u("error"),console.error("[TURNSTILE] Security check failed to initialize",{context:t.context,attempts:T instanceof M?T.attempts:void 0,message:T instanceof Error?T.message:"Unknown Turnstile error"})}}async function R(){S(),await N()}async function O(){if(g(),b(),!y||!m){await R();return}u("retrying");try{_(s),y.reset(m)}catch(r){console.warn("[TURNSTILE] Widget reset failed; recreating it",{context:t.context,message:r instanceof Error?r.message:"Unknown Turnstile reset error"}),await R()}}return $([f,()=>t.context],()=>{l||R()}),z(()=>{N()}),K(()=>{l=!0,s+=1,S(),g()}),n({reset:O,retry:R,state:o}),(r,I)=>(L(),x("div",{class:"auth-turnstile","data-state":v(o)},[w("div",{ref_key:"container",ref:p,class:"auth-turnstile__widget"},null,512),v(o)==="loading"?(L(),x("div",se,[I[0]||(I[0]=w("span",{class:"auth-turnstile__spinner","aria-hidden":"true"},null,-1)),w("span",null,A(v(a)("page.auth.captcha-loading")),1)])):v(o)==="error"?(L(),x("div",ce,[w("span",null,A(v(a)("page.auth.captcha-error")),1),w("button",{type:"button",class:"auth-turnstile__retry",onClick:R},A(v(a)("page.auth.captcha-retry")),1)])):F("",!0)],8,ae))}}),Te=Object.assign(J(de,[["__scopeId","data-v-fd92f404"]]),{__name:"AuthSafeTurnstile"});export{Te as _,ge as i};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.