1import{_ as e}from"./app.CepNJbvh.js";import{o as a,p as o,C as r,f as t,q as n,x as i,m as s,u as l,aC as c,y as u,G as d,j as v,l as p,b4 as h,t as m,v as f,w as y}from"./2c1ab0fe.GMbxnz74.js";import{H as g}from"./5fd968f2.B6YCmvlZ.js";import{iz as b,i as _,bH as k,cb as C,dJ as S,c as E,W as L,F as w,ah as O,a3 as j,c0 as q}from"./164ad2e3.BbIvMjRY.js";import{bE as V,bF as x,bk as B,ak as P,S as R,cX as z,y as D,cq as J,aa as T,W as F,bo as I,bp as H}from"./4c290a1e.C6TDJ9Fn.js";import{c as K}from"./01973ac7.BeRwXye5.js";const M=a({displayName:"Captcha",load:()=>o(()=>e(()=>Promise.resolve().then(()=>G),void 0))});function N(e,a){return"failed"===e?.status&&a===e.id}function U(){const{i18n:e}=R(),{progressing:a}=_(),{hasError:o,error:r}=k(z),t=function(){const[e,a]=b(B.LastSeenCaptchaRequestedErrorReceiptId),o=P(),{checkout:r}=R(),t=r.latestReceipt.value,[n,l]=i(()=>!o.peek()||N(t,e));return s(()=>{const o=N(t,e);l(o),"failed"===t?.status&&e!==t.id&&a(t.id),"failed"!==t?.status&&a(void 0)},[t?.id,t?.status]),n}();return a.value?null:o&&r&&!t?l(K,{identifier:"CaptchaRequiredBanner",tone:"critical",children:e.translate("payment_errors.captcha_required_without_payment_information")}):null}let W=!1;const A=c(e=>{const{appContext:{i18n:a,observability:o},captchaSignal:r,errorSignal:n,lastJourneyProgression:i,negotiate:s,onViolation:l}=e,c=u(t(()=>r.value?.sitekey)),p=u(W),h=u(t(()=>Boolean(r.value?.token))),m=d(()=>Boolean(n.value)),f=Date.now(),y=W,g=a.translate("captcha.errors.not_solved");v(()=>{const e=r.value;e?e.sitekey&&(c.value=e.sitekey):c.value=void 0}),v(()=>{const e=i.value,a="error"===e.type?e.violations.map(e=>e.code):[],o=r.value;o&&o.violationCode&&a.includes(o.violationCode)?(l?.(),n.value=g):o?.token&&(n.value=void 0)});const b=d(()=>Boolean(c.value));return{errorSignal:n,hasError:m,hasSiteKey:b,isLoaded:p,sitekey:c,solvedOnLoad:h,handleVerify(e){const a=r.value;a&&(r.value={...a,token:e,violationCode:void 0},s({legacyFiltering:{include:["captcha"]},silenceViolations:D(["captcha"]),skipStateUpdates:!0}))},handleLoad(){y||o.histogram({name:"captcha_load_time",value:Date.now()-f,attributes:{provider:r.value?.provider,success:!0}}),W=!0,p.value=!0},handleError(e){y||o.histogram({name:"captcha_load_time",value:Date.now()-f,attributes:{provider:r.peek()?.provider,success:!1,error:String(e)}})},validate(e){if(e)return e.token?void 0:g}}}),G=Object.freeze(Object.defineProperty({__proto__:null,default:function(){const e=R(),{client:a,i18n:o}=e,i="fast"!==a.unstable_getSerialization("workerVersion"),s=C(),c=J(),{lastJourneyProgression:u}=T(),{captcha:d}=F(),{negotiate:v}=_(),b=p(null),{onOpen:k,onClose:B}=function({embed:e},a){const o=V(e?.embedder),i=n(!1);return function({embed:e},a){r(()=>{if(!a.value||!V(e?.embedder))return;const o=t(()=>e?.presentation?.acquire());return()=>t(()=>o?.())})}({embed:e},i),r(()=>{a.value?o&&t(()=>x(e,"captcha")):i.value=!1}),{onOpen:()=>{i.value=o&&Boolean(a.value)},onClose:()=>{i.value=!1}}}(e,d),P=h(()=>new A({appContext:e,captchaSignal:d,errorSignal:c,lastJourneyProgression:u,negotiate:v,onViolation:()=>{B(),b.current?.resetCaptcha()}}));I(d,c,P.validate,H.InvalidCaptcha);const z=p(null),D=S({active:P.hasError.value});r(()=>{d.value&&P.isLoaded.value&&z.current&&(D.current=z.current.querySelector("iframe"))});const K=m(()=>P.isLoaded.value?void 0:"none"),M=m(()=>P.hasError.value?f("MTtRU"):void 0);return l(y,{when:()=>{const e=P.solvedOnLoad.value&&!d.value?.sitekey;return Boolean("hcaptcha"===d.value?.provider&&!e&&Boolean(P.sitekey.value))},children:l(E,{gap:"large-100",children:[l(y,{when:()=>s.value&&P.isLoaded.value&&P.hasSiteKey.value,children:l(L,{tone:"critical",errorType:w.CheckoutError,children:o.translate("payment_errors.captcha_required_without_payment_information")})}),l(y,{when:()=>!P.isLoaded.value,children:l(O,{delay:i,contentDisplay:"block",inlineSize:"302px",blockSize:"83px"})}),l(j,{accessibilityLabel:o.translate("captcha.title"),display:K.value,children:l(E,{gap:"small-400",children:[l(U,{}),l("div",{className:M.value,ref:z,children:l(g,{sitekey:P.sitekey.value,onVerify:e=>{B(),P.handleVerify(e)},languageOverride:o.locale,ref:b,onLoad:P.handleLoad,onError:e=>{B(),P.handleError(e)},onOpen:k,onClose:B,onChalExpired:B})}),l(y,{when:P.errorSignal,children:e=>l(q,{children:e?.message??e})})]})})]})})}},Symbol.toStringTag,{value:"Module"}));
1export{M as C};
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.